using System; using System.Data; namespace Core.Mes.IBaseInterface { /// /// 消息原型 /// [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; } } /// /// 消息原型 /// [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; } } /// /// /// 网络传输方式枚举 /// public enum NetWorkTransType { Remoting, XmlWebService } /// /// 服务类型 /// public enum MesServerType { IComponentContainServer, MesSystemBaseServer } /// /// 访问类型 /// public enum VisitType { Method, Property } /// /// 请求方式 /// public enum RequestType { DirectReturn, DirectBroakcast, AfterHandlerBroakcast } /// /// 用户验证信息 /// [Serializable] public struct ValidateInfo { public string ValidateGuid; public string LoginID; public ValidateInfo(string validateGuid, string loginID) { this.ValidateGuid = validateGuid; this.LoginID = loginID; } } /// /// 存储于服务端的客户信息 /// [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; } /// /// 客户端调用服务端的返回对象,包括错误代码、错误信息和返回对象实体。 /// 在Web传输中,返回对象实体如果是DataSet类型,将存入RealDataSet中。 /// [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; } } /// /// 客户端调用服务端的返回对象,包括错误代码、错误信息和返回对象实体。 /// 在Web传输中,返回对象实体如果是DataSet类型,将存入RealDataSet中。 /// [Serializable] public struct ReturnObjectEx { //== 错误代码 public int ErrCode; //== 错误信息 public string ErrMessage; public object RealObject; public string ReDirectURL; //== 用于Web传输时存放DataSet类型的返回实体 public DataSet RealDataSet; public ReturnObjectEx(object RealObject) { this.RealObject = RealObject; this.ErrCode = 0; this.ErrMessage = ""; this.ReDirectURL = ""; this.RealDataSet = null; } public ReturnObjectEx(string ReDirectTo) { this.RealObject = null; this.ErrCode = 0; this.ErrMessage = ""; this.RealDataSet = null; this.ReDirectURL = ReDirectTo; } public ReturnObjectEx(object RealObject, string ErrMessage) { this.RealObject = RealObject; this.ErrCode = 1; this.ErrMessage = ErrMessage; this.RealDataSet = null; this.ReDirectURL = ""; } public ReturnObjectEx(object RealObject, int ErrCode) { this.RealObject = RealObject; this.ErrCode = ErrCode; this.ErrMessage = ""; this.ReDirectURL = ""; this.RealDataSet = null; } public ReturnObjectEx(object RealObject, int ErrCode, string ErrMessage) { this.RealObject = RealObject; this.ErrCode = ErrCode; this.ErrMessage = ErrMessage; this.ReDirectURL = ""; this.RealDataSet = null; } } /// /// 客户端调用服务端的返回对象,包括错误代码、错误信息。 /// [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); } }