d020b29f27887b466f8bdddce8a1d306d93327eb.svn-base 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. using System;
  2. using System.Data;
  3. namespace Core.Mes.IBaseInterface
  4. {
  5. /// <summary>
  6. /// 消息原型
  7. /// </summary>
  8. [Serializable]
  9. public struct CallingMessage
  10. {
  11. //== 服务名
  12. public string ServerName;
  13. //== 程序集名
  14. public string AssemblyName;
  15. //== 类名
  16. public string ClassName;
  17. //== 方法名
  18. public string MethodName;
  19. //== 参数数组
  20. public object[] args;
  21. //== 网络传输方式
  22. public NetWorkTransType TransType;
  23. //== 服务类型
  24. public MesServerType ServerType;
  25. //== 访问类型
  26. public VisitType visitType;
  27. public RequestType requestType;
  28. public CallingMessage(string ServerName, string AssemblyName, string ClassName, string MethodName, object[] args)
  29. {
  30. this.ServerName = ServerName;
  31. //== 常用
  32. this.AssemblyName = AssemblyName;
  33. this.ClassName = ClassName;
  34. this.MethodName = MethodName;
  35. this.args = args;
  36. //== 特殊
  37. this.TransType = NetWorkTransType.Remoting;
  38. this.ServerType = MesServerType.IComponentContainServer;
  39. this.visitType = VisitType.Method;
  40. this.requestType = RequestType.DirectReturn;
  41. }
  42. }
  43. /// <summary>
  44. /// 消息原型
  45. /// </summary>
  46. [Serializable]
  47. public struct CallingMessageEx
  48. {
  49. //== 服务名
  50. public string ServerName;
  51. //== 程序集名
  52. public string AssemblyName;
  53. //== 类名
  54. public string ClassName;
  55. //== 方法名
  56. public string MethodName;
  57. //== 参数数组
  58. public object[] args;
  59. //== 网络传输方式
  60. public NetWorkTransType TransType;
  61. //== 服务类型
  62. public MesServerType ServerType;
  63. //== 访问类型
  64. public VisitType visitType;
  65. public RequestType requestType;
  66. public int RedirectLimit;
  67. public bool InnerServerRedirect;
  68. public CallingMessageEx(string ServerName, string AssemblyName, string ClassName, string MethodName, object[] args)
  69. {
  70. this.ServerName = ServerName;
  71. //== 常用
  72. this.AssemblyName = AssemblyName;
  73. this.ClassName = ClassName;
  74. this.MethodName = MethodName;
  75. this.args = args;
  76. //== 特殊
  77. this.TransType = NetWorkTransType.Remoting;
  78. this.ServerType = MesServerType.IComponentContainServer;
  79. this.visitType = VisitType.Method;
  80. this.requestType = RequestType.DirectReturn;
  81. this.RedirectLimit = 3;
  82. this.InnerServerRedirect = true;
  83. }
  84. public CallingMessage ToCallingMessage()
  85. {
  86. CallingMessage cm;
  87. cm.args = this.args;
  88. cm.AssemblyName = this.AssemblyName;
  89. cm.ClassName = this.ClassName;
  90. cm.MethodName = this.MethodName;
  91. cm.requestType = this.requestType;
  92. cm.ServerName = this.ServerName;
  93. cm.ServerType = this.ServerType;
  94. cm.TransType = this.TransType;
  95. cm.visitType = this.visitType;
  96. return cm;
  97. }
  98. public void FromCallingMessage(CallingMessage cm)
  99. {
  100. this.args = cm.args;
  101. this.AssemblyName = cm.AssemblyName;
  102. this.ClassName = cm.ClassName;
  103. this.MethodName = cm.MethodName;
  104. this.requestType = cm.requestType;
  105. this.ServerName = cm.ServerName;
  106. this.ServerType = cm.ServerType;
  107. this.TransType = cm.TransType;
  108. this.visitType = cm.visitType;
  109. this.RedirectLimit = 0;
  110. this.InnerServerRedirect = true;
  111. }
  112. }
  113. ///
  114. /// <summary>
  115. /// 网络传输方式枚举
  116. /// </summary>
  117. public enum NetWorkTransType
  118. {
  119. Remoting,
  120. XmlWebService
  121. }
  122. /// <summary>
  123. /// 服务类型
  124. /// </summary>
  125. public enum MesServerType
  126. {
  127. IComponentContainServer,
  128. MesSystemBaseServer
  129. }
  130. /// <summary>
  131. /// 访问类型
  132. /// </summary>
  133. public enum VisitType
  134. {
  135. Method,
  136. Property
  137. }
  138. /// <summary>
  139. /// 请求方式
  140. /// </summary>
  141. public enum RequestType
  142. {
  143. DirectReturn,
  144. DirectBroakcast,
  145. AfterHandlerBroakcast
  146. }
  147. /// <summary>
  148. /// 用户验证信息
  149. /// </summary>
  150. [Serializable]
  151. public struct ValidateInfo
  152. {
  153. public string ValidateGuid;
  154. public string LoginID;
  155. public ValidateInfo(string validateGuid, string loginID)
  156. {
  157. this.ValidateGuid = validateGuid;
  158. this.LoginID = loginID;
  159. }
  160. }
  161. /// <summary>
  162. /// 存储于服务端的客户信息
  163. /// </summary>
  164. [Serializable]
  165. public struct UserInfo
  166. {
  167. public string ValidateGuid;
  168. public string UserName;
  169. public string LoginID; //登录ID
  170. public string UserID; //用户ID
  171. public string UserBc; //班次
  172. public string UserBb; //班别
  173. public string UserRz; //工作制
  174. public string UserDepID; //部门
  175. public string UserDepName;
  176. public string UserRoleID; //角色
  177. public string UserRoleName;
  178. public System.IO.Stream MenuConfigStream;
  179. }
  180. /// <summary>
  181. /// 客户端调用服务端的返回对象,包括错误代码、错误信息和返回对象实体。
  182. /// 在Web传输中,返回对象实体如果是DataSet类型,将存入RealDataSet中。
  183. /// </summary>
  184. [Serializable]
  185. public struct ReturnObject
  186. {
  187. //== 错误代码
  188. public int ErrCode;
  189. //== 错误信息
  190. public string ErrMessage;
  191. public object RealObject;
  192. //== 用于Web传输时存放DataSet类型的返回实体
  193. public DataSet RealDataSet;
  194. public ReturnObject(object RealObject)
  195. {
  196. this.RealObject = RealObject;
  197. this.ErrCode = 0;
  198. this.ErrMessage = "";
  199. this.RealDataSet = null;
  200. }
  201. public ReturnObject(object RealObject, string ErrMessage)
  202. {
  203. this.RealObject = RealObject;
  204. this.ErrCode = 1;
  205. this.ErrMessage = ErrMessage;
  206. this.RealDataSet = null;
  207. }
  208. public ReturnObject(object RealObject, int ErrCode)
  209. {
  210. this.RealObject = RealObject;
  211. this.ErrCode = ErrCode;
  212. this.ErrMessage = "";
  213. this.RealDataSet = null;
  214. }
  215. public ReturnObject(object RealObject, int ErrCode, string ErrMessage)
  216. {
  217. this.RealObject = RealObject;
  218. this.ErrCode = ErrCode;
  219. this.ErrMessage = ErrMessage;
  220. this.RealDataSet = null;
  221. }
  222. }
  223. /// <summary>
  224. /// 客户端调用服务端的返回对象,包括错误代码、错误信息和返回对象实体。
  225. /// 在Web传输中,返回对象实体如果是DataSet类型,将存入RealDataSet中。
  226. /// </summary>
  227. [Serializable]
  228. public struct ReturnObjectEx
  229. {
  230. //== 错误代码
  231. public int ErrCode;
  232. //== 错误信息
  233. public string ErrMessage;
  234. public object RealObject;
  235. public string ReDirectURL;
  236. //== 用于Web传输时存放DataSet类型的返回实体
  237. public DataSet RealDataSet;
  238. public ReturnObjectEx(object RealObject)
  239. {
  240. this.RealObject = RealObject;
  241. this.ErrCode = 0;
  242. this.ErrMessage = "";
  243. this.ReDirectURL = "";
  244. this.RealDataSet = null;
  245. }
  246. public ReturnObjectEx(string ReDirectTo)
  247. {
  248. this.RealObject = null;
  249. this.ErrCode = 0;
  250. this.ErrMessage = "";
  251. this.RealDataSet = null;
  252. this.ReDirectURL = ReDirectTo;
  253. }
  254. public ReturnObjectEx(object RealObject, string ErrMessage)
  255. {
  256. this.RealObject = RealObject;
  257. this.ErrCode = 1;
  258. this.ErrMessage = ErrMessage;
  259. this.RealDataSet = null;
  260. this.ReDirectURL = "";
  261. }
  262. public ReturnObjectEx(object RealObject, int ErrCode)
  263. {
  264. this.RealObject = RealObject;
  265. this.ErrCode = ErrCode;
  266. this.ErrMessage = "";
  267. this.ReDirectURL = "";
  268. this.RealDataSet = null;
  269. }
  270. public ReturnObjectEx(object RealObject, int ErrCode, string ErrMessage)
  271. {
  272. this.RealObject = RealObject;
  273. this.ErrCode = ErrCode;
  274. this.ErrMessage = ErrMessage;
  275. this.ReDirectURL = "";
  276. this.RealDataSet = null;
  277. }
  278. }
  279. /// <summary>
  280. /// 客户端调用服务端的返回对象,包括错误代码、错误信息。
  281. /// </summary>
  282. [Serializable]
  283. public struct SimpleReturnObject
  284. {
  285. //== 错误代码
  286. public int ErrCode;
  287. //== 错误信息
  288. public string ErrMessage;
  289. public SimpleReturnObject(string ErrMessage)
  290. {
  291. this.ErrCode = 1;
  292. this.ErrMessage = ErrMessage;
  293. }
  294. public SimpleReturnObject(int ErrCode)
  295. {
  296. this.ErrCode = ErrCode;
  297. this.ErrMessage = "";
  298. }
  299. public SimpleReturnObject(int ErrCode, string ErrMessage)
  300. {
  301. this.ErrCode = ErrCode;
  302. this.ErrMessage = ErrMessage;
  303. }
  304. }
  305. public interface ICommon
  306. {
  307. ReturnObject MethodHandler(CallingMessage message, ValidateInfo info);
  308. ReturnObjectEx MethodHandlerEx(CallingMessageEx message, ValidateInfo info);
  309. }
  310. }