e2f8d57f6289bf3d42fb558dd4f49816e882f135.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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. [Serializable]
  117. public enum NetWorkTransType
  118. {
  119. Remoting,
  120. XmlWebService
  121. }
  122. /// <summary>
  123. /// 服务类型
  124. [Serializable]
  125. public enum MesServerType
  126. {
  127. IComponentContainServer,
  128. MesSystemBaseServer
  129. }
  130. /// <summary>
  131. /// 访问类型
  132. /// </summary>
  133. [Serializable]
  134. public enum VisitType
  135. {
  136. Method,
  137. Property
  138. }
  139. /// <summary>
  140. /// 请求方式
  141. /// </summary>
  142. [Serializable]
  143. public enum RequestType
  144. {
  145. DirectReturn,
  146. DirectBroakcast,
  147. AfterHandlerBroakcast
  148. }
  149. /// <summary>
  150. /// 用户验证信息
  151. /// </summary>
  152. [Serializable]
  153. public struct ValidateInfo
  154. {
  155. public string ValidateGuid;
  156. public string LoginID;
  157. public ValidateInfo(string validateGuid, string loginID)
  158. {
  159. this.ValidateGuid = validateGuid;
  160. this.LoginID = loginID;
  161. }
  162. }
  163. /// <summary>
  164. /// 存储于服务端的客户信息
  165. /// </summary>
  166. [Serializable]
  167. public struct UserInfo
  168. {
  169. public string ValidateGuid;
  170. public string UserName;
  171. public string LoginID; //登录ID
  172. public string UserID; //用户ID
  173. public string UserBc; //班次
  174. public string UserBb; //班别
  175. public string UserRz; //工作制
  176. public string UserDepID; //部门
  177. public string UserDepName;
  178. public string UserRoleID; //角色
  179. public string UserRoleName;
  180. public System.IO.Stream MenuConfigStream;
  181. }
  182. /// <summary>
  183. /// 客户端调用服务端的返回对象,包括错误代码、错误信息和返回对象实体。
  184. /// 在Web传输中,返回对象实体如果是DataSet类型,将存入RealDataSet中。
  185. /// </summary>
  186. [Serializable]
  187. public struct ReturnObject
  188. {
  189. //== 错误代码
  190. public int ErrCode;
  191. //== 错误信息
  192. public string ErrMessage;
  193. public object RealObject;
  194. //== 用于Web传输时存放DataSet类型的返回实体
  195. public DataSet RealDataSet;
  196. public ReturnObject(object RealObject)
  197. {
  198. this.RealObject = RealObject;
  199. this.ErrCode = 0;
  200. this.ErrMessage = "";
  201. this.RealDataSet = null;
  202. }
  203. public ReturnObject(object RealObject, string ErrMessage)
  204. {
  205. this.RealObject = RealObject;
  206. this.ErrCode = 1;
  207. this.ErrMessage = ErrMessage;
  208. this.RealDataSet = null;
  209. }
  210. public ReturnObject(object RealObject, int ErrCode)
  211. {
  212. this.RealObject = RealObject;
  213. this.ErrCode = ErrCode;
  214. this.ErrMessage = "";
  215. this.RealDataSet = null;
  216. }
  217. public ReturnObject(object RealObject, int ErrCode, string ErrMessage)
  218. {
  219. this.RealObject = RealObject;
  220. this.ErrCode = ErrCode;
  221. this.ErrMessage = ErrMessage;
  222. this.RealDataSet = null;
  223. }
  224. }
  225. /// <summary>
  226. /// 客户端调用服务端的返回对象类型,用于指示返回值类型:正常数据集;重定向请求地址;服务器端缓存文件类型。
  227. /// </summary>
  228. [Serializable]
  229. public enum ReturnObjectType
  230. {
  231. NormalDataSet = 1,
  232. RedirectURL = 2,
  233. FileAddress = 3
  234. }
  235. /// <summary>
  236. /// 客户端调用服务端的返回对象 , 用于指示服务器端缓存文件地址。
  237. /// </summary>
  238. [Serializable]
  239. public class ReturnFileInfo
  240. {
  241. string _serverAddress = "";
  242. public string Server { get { return _serverAddress; } }
  243. string _fullFileName = "";
  244. public string FullFileName { get { return _fullFileName; } }
  245. int _fileSize = 0;
  246. public int FileSize { get { return FileSize; } }
  247. string _taskId = "";
  248. public string TaskID { get { return _taskId; } }
  249. public ReturnFileInfo(string _server, string _filename, int _size, string _taskid)
  250. {
  251. _serverAddress = _server;
  252. _fullFileName = _filename;
  253. _fileSize = _size;
  254. _taskId = _taskid;
  255. }
  256. }
  257. /// <summary>
  258. /// 客户端调用服务端的返回对象,包括错误代码、错误信息和返回对象实体。
  259. /// 在Web传输中,返回对象实体如果是DataSet类型,将存入RealDataSet中。
  260. /// </summary>
  261. [Serializable]
  262. public struct ReturnObjectEx
  263. {
  264. //== 错误代码
  265. public int ErrCode;
  266. //== 错误信息
  267. public string ErrMessage;
  268. public object RealObject;
  269. public string ReDirectURL;
  270. public ReturnObjectType ObjectType;
  271. //== 用于Web传输时存放DataSet类型的返回实体
  272. public DataSet RealDataSet;
  273. public ReturnObjectEx(object RealObject)
  274. {
  275. this.RealObject = RealObject;
  276. this.ErrCode = 0;
  277. this.ErrMessage = "";
  278. this.ReDirectURL = "";
  279. this.RealDataSet = null;
  280. this.ObjectType = ReturnObjectType.NormalDataSet;
  281. }
  282. public ReturnObjectEx(string ReDirectTo)
  283. {
  284. this.RealObject = null;
  285. this.ErrCode = 0;
  286. this.ErrMessage = "";
  287. this.RealDataSet = null;
  288. this.ReDirectURL = ReDirectTo;
  289. this.ObjectType = ReturnObjectType.RedirectURL;
  290. }
  291. public ReturnObjectEx(object RealObject, string ErrMessage)
  292. {
  293. this.RealObject = RealObject;
  294. this.ErrCode = 1;
  295. this.ErrMessage = ErrMessage;
  296. this.RealDataSet = null;
  297. this.ReDirectURL = "";
  298. this.ObjectType = ReturnObjectType.NormalDataSet;
  299. }
  300. public ReturnObjectEx(object RealObject, int ErrCode)
  301. {
  302. this.RealObject = RealObject;
  303. this.ErrCode = ErrCode;
  304. this.ErrMessage = "";
  305. this.ReDirectURL = "";
  306. this.RealDataSet = null;
  307. this.ObjectType = ReturnObjectType.NormalDataSet;
  308. }
  309. public ReturnObjectEx(object RealObject, int ErrCode, string ErrMessage)
  310. {
  311. this.RealObject = RealObject;
  312. this.ErrCode = ErrCode;
  313. this.ErrMessage = ErrMessage;
  314. this.ReDirectURL = "";
  315. this.RealDataSet = null;
  316. this.ObjectType = ReturnObjectType.NormalDataSet;
  317. }
  318. }
  319. /// <summary>
  320. /// 客户端调用服务端的返回对象,包括错误代码、错误信息。
  321. /// </summary>
  322. [Serializable]
  323. public struct SimpleReturnObject
  324. {
  325. //== 错误代码
  326. public int ErrCode;
  327. //== 错误信息
  328. public string ErrMessage;
  329. public SimpleReturnObject(string ErrMessage)
  330. {
  331. this.ErrCode = 1;
  332. this.ErrMessage = ErrMessage;
  333. }
  334. public SimpleReturnObject(int ErrCode)
  335. {
  336. this.ErrCode = ErrCode;
  337. this.ErrMessage = "";
  338. }
  339. public SimpleReturnObject(int ErrCode, string ErrMessage)
  340. {
  341. this.ErrCode = ErrCode;
  342. this.ErrMessage = ErrMessage;
  343. }
  344. }
  345. public interface ICommon
  346. {
  347. ReturnObject MethodHandler(CallingMessage message, ValidateInfo info);
  348. ReturnObjectEx MethodHandlerEx(CallingMessageEx message, ValidateInfo info);
  349. }
  350. }