| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415 |
- using System;
- using System.Data;
- namespace Core.Mes.IBaseInterface
- {
- /// <summary>
- /// 消息原型
- /// </summary>
- [Serializable]
- public struct CallingMessage
- {
- //== 服务名
- public string ServerName;
- //== 程序集名
- public string AssemblyName;
- //== 类名
- public string ClassName;
- //== 方法名
- public string MethodName;
- //== 参数数组
- public object[] args;
- //== 网络传输方式
- public NetWorkTransType TransType;
- //== 服务类型
- public MesServerType ServerType;
- //== 访问类型
- public VisitType visitType;
- public RequestType requestType;
- public CallingMessage(string ServerName, string AssemblyName, string ClassName, string MethodName, object[] args)
- {
- this.ServerName = ServerName;
- //== 常用
- this.AssemblyName = AssemblyName;
- this.ClassName = ClassName;
- this.MethodName = MethodName;
- this.args = args;
- //== 特殊
- this.TransType = NetWorkTransType.Remoting;
- this.ServerType = MesServerType.IComponentContainServer;
- this.visitType = VisitType.Method;
- this.requestType = RequestType.DirectReturn;
- }
- }
- /// <summary>
- /// 消息原型
- /// </summary>
- [Serializable]
- public struct CallingMessageEx
- {
- //== 服务名
- public string ServerName;
- //== 程序集名
- public string AssemblyName;
- //== 类名
- public string ClassName;
- //== 方法名
- public string MethodName;
- //== 参数数组
- public object[] args;
- //== 网络传输方式
- public NetWorkTransType TransType;
- //== 服务类型
- public MesServerType ServerType;
- //== 访问类型
- public VisitType visitType;
- public RequestType requestType;
- public int RedirectLimit;
- public bool InnerServerRedirect;
- public CallingMessageEx(string ServerName, string AssemblyName, string ClassName, string MethodName, object[] args)
- {
- this.ServerName = ServerName;
- //== 常用
- this.AssemblyName = AssemblyName;
- this.ClassName = ClassName;
- this.MethodName = MethodName;
- this.args = args;
- //== 特殊
- this.TransType = NetWorkTransType.Remoting;
- this.ServerType = MesServerType.IComponentContainServer;
- this.visitType = VisitType.Method;
- this.requestType = RequestType.DirectReturn;
- this.RedirectLimit = 3;
- this.InnerServerRedirect = true;
- }
- public CallingMessage ToCallingMessage()
- {
- CallingMessage cm;
- cm.args = this.args;
- cm.AssemblyName = this.AssemblyName;
- cm.ClassName = this.ClassName;
- cm.MethodName = this.MethodName;
- cm.requestType = this.requestType;
- cm.ServerName = this.ServerName;
- cm.ServerType = this.ServerType;
- cm.TransType = this.TransType;
- cm.visitType = this.visitType;
- return cm;
- }
- public void FromCallingMessage(CallingMessage cm)
- {
- this.args = cm.args;
- this.AssemblyName = cm.AssemblyName;
- this.ClassName = cm.ClassName;
- this.MethodName = cm.MethodName;
- this.requestType = cm.requestType;
- this.ServerName = cm.ServerName;
- this.ServerType = cm.ServerType;
- this.TransType = cm.TransType;
- this.visitType = cm.visitType;
- this.RedirectLimit = 0;
- this.InnerServerRedirect = true;
- }
- }
- ///
- /// <summary>
- /// 网络传输方式枚举
- [Serializable]
- public enum NetWorkTransType
- {
- Remoting,
- XmlWebService
- }
- /// <summary>
- /// 服务类型
- [Serializable]
- public enum MesServerType
- {
- IComponentContainServer,
- MesSystemBaseServer
- }
- /// <summary>
- /// 访问类型
- /// </summary>
- [Serializable]
- public enum VisitType
- {
- Method,
- Property
- }
- /// <summary>
- /// 请求方式
- /// </summary>
- [Serializable]
- public enum RequestType
- {
- DirectReturn,
- DirectBroakcast,
- AfterHandlerBroakcast
- }
- /// <summary>
- /// 用户验证信息
- /// </summary>
- [Serializable]
- public struct ValidateInfo
- {
- public string ValidateGuid;
- public string LoginID;
- public ValidateInfo(string validateGuid, string loginID)
- {
- this.ValidateGuid = validateGuid;
- this.LoginID = loginID;
- }
- }
- /// <summary>
- /// 存储于服务端的客户信息
- /// </summary>
- [Serializable]
- public struct UserInfo
- {
- public string ValidateGuid;
- public string UserName;
- public string LoginID; //登录ID
- public string UserID; //用户ID
- public string UserBc; //班次
- public string UserBb; //班别
- public string UserRz; //工作制
- public string UserDepID; //部门
- public string UserDepName;
- public string UserRoleID; //角色
- public string UserRoleName;
- public System.IO.Stream MenuConfigStream;
- }
- /// <summary>
- /// 客户端调用服务端的返回对象,包括错误代码、错误信息和返回对象实体。
- /// 在Web传输中,返回对象实体如果是DataSet类型,将存入RealDataSet中。
- /// </summary>
- [Serializable]
- public struct ReturnObject
- {
- //== 错误代码
- public int ErrCode;
- //== 错误信息
- public string ErrMessage;
- public object RealObject;
- //== 用于Web传输时存放DataSet类型的返回实体
- public DataSet RealDataSet;
- public ReturnObject(object RealObject)
- {
- this.RealObject = RealObject;
- this.ErrCode = 0;
- this.ErrMessage = "";
- this.RealDataSet = null;
- }
- public ReturnObject(object RealObject, string ErrMessage)
- {
- this.RealObject = RealObject;
- this.ErrCode = 1;
- this.ErrMessage = ErrMessage;
- this.RealDataSet = null;
- }
- public ReturnObject(object RealObject, int ErrCode)
- {
- this.RealObject = RealObject;
- this.ErrCode = ErrCode;
- this.ErrMessage = "";
- this.RealDataSet = null;
- }
- public ReturnObject(object RealObject, int ErrCode, string ErrMessage)
- {
- this.RealObject = RealObject;
- this.ErrCode = ErrCode;
- this.ErrMessage = ErrMessage;
- this.RealDataSet = null;
- }
- }
- /// <summary>
- /// 客户端调用服务端的返回对象类型,用于指示返回值类型:正常数据集;重定向请求地址;服务器端缓存文件类型。
- /// </summary>
- [Serializable]
- public enum ReturnObjectType
- {
- NormalDataSet = 1,
- RedirectURL = 2,
- FileAddress = 3
- }
- /// <summary>
- /// 客户端调用服务端的返回对象 , 用于指示服务器端缓存文件地址。
- /// </summary>
- [Serializable]
- public class ReturnFileInfo
- {
- string _serverAddress = "";
- public string Server { get { return _serverAddress; } }
- string _fullFileName = "";
- public string FullFileName { get { return _fullFileName; } }
- int _fileSize = 0;
- public int FileSize { get { return FileSize; } }
- string _taskId = "";
- public string TaskID { get { return _taskId; } }
- public ReturnFileInfo(string _server, string _filename, int _size, string _taskid)
- {
- _serverAddress = _server;
- _fullFileName = _filename;
- _fileSize = _size;
- _taskId = _taskid;
- }
- }
- /// <summary>
- /// 客户端调用服务端的返回对象,包括错误代码、错误信息和返回对象实体。
- /// 在Web传输中,返回对象实体如果是DataSet类型,将存入RealDataSet中。
- /// </summary>
- [Serializable]
- public struct ReturnObjectEx
- {
- //== 错误代码
- public int ErrCode;
- //== 错误信息
- public string ErrMessage;
- public object RealObject;
- public string ReDirectURL;
- public ReturnObjectType ObjectType;
- //== 用于Web传输时存放DataSet类型的返回实体
- public DataSet RealDataSet;
- public ReturnObjectEx(object RealObject)
- {
- this.RealObject = RealObject;
- this.ErrCode = 0;
- this.ErrMessage = "";
- this.ReDirectURL = "";
- this.RealDataSet = null;
- this.ObjectType = ReturnObjectType.NormalDataSet;
- }
- public ReturnObjectEx(string ReDirectTo)
- {
- this.RealObject = null;
- this.ErrCode = 0;
- this.ErrMessage = "";
- this.RealDataSet = null;
- this.ReDirectURL = ReDirectTo;
- this.ObjectType = ReturnObjectType.RedirectURL;
- }
- public ReturnObjectEx(object RealObject, string ErrMessage)
- {
- this.RealObject = RealObject;
- this.ErrCode = 1;
- this.ErrMessage = ErrMessage;
- this.RealDataSet = null;
- this.ReDirectURL = "";
- this.ObjectType = ReturnObjectType.NormalDataSet;
- }
- public ReturnObjectEx(object RealObject, int ErrCode)
- {
- this.RealObject = RealObject;
- this.ErrCode = ErrCode;
- this.ErrMessage = "";
- this.ReDirectURL = "";
- this.RealDataSet = null;
- this.ObjectType = ReturnObjectType.NormalDataSet;
- }
- public ReturnObjectEx(object RealObject, int ErrCode, string ErrMessage)
- {
- this.RealObject = RealObject;
- this.ErrCode = ErrCode;
- this.ErrMessage = ErrMessage;
- this.ReDirectURL = "";
- this.RealDataSet = null;
- this.ObjectType = ReturnObjectType.NormalDataSet;
- }
- }
- /// <summary>
- /// 客户端调用服务端的返回对象,包括错误代码、错误信息。
- /// </summary>
- [Serializable]
- public struct SimpleReturnObject
- {
- //== 错误代码
- public int ErrCode;
- //== 错误信息
- public string ErrMessage;
- public SimpleReturnObject(string ErrMessage)
- {
- this.ErrCode = 1;
- this.ErrMessage = ErrMessage;
- }
- public SimpleReturnObject(int ErrCode)
- {
- this.ErrCode = ErrCode;
- this.ErrMessage = "";
- }
- public SimpleReturnObject(int ErrCode, string ErrMessage)
- {
- this.ErrCode = ErrCode;
- this.ErrMessage = ErrMessage;
- }
- }
- public interface ICommon
- {
- ReturnObject MethodHandler(CallingMessage message, ValidateInfo info);
- ReturnObjectEx MethodHandlerEx(CallingMessageEx message, ValidateInfo info);
- }
- }
|