/Components/BP.WFV4/FlowDesc/FlowExt/ExpDtl.cs

# · C# · 295 lines · 202 code · 23 blank · 70 comment · 8 complexity · d7f942e22cc304db6c20d66661d75ebc MD5 · raw file

  1. using System;
  2. using System.Data;
  3. using BP.DA;
  4. using BP.En;
  5. using BP.En;
  6. using System.Collections;
  7. using BP.Port;
  8. namespace BP.WF
  9. {
  10. /// <summary>
  11. /// ??????
  12. /// </summary>
  13. public class ExpDtlAttr
  14. {
  15. #region ????
  16. public const string MyPK = "MyPK";
  17. /// <summary>
  18. /// ??
  19. /// </summary>
  20. public const string FK_Node = "FK_Node";
  21. /// <summary>
  22. /// ??
  23. /// </summary>
  24. public const string Field = "Field";
  25. /// <summary>
  26. /// ????
  27. /// </summary>
  28. public const string FieldName = "FieldName";
  29. /// <summary>
  30. /// ????
  31. /// </summary>
  32. public const string RefField = "RefField";
  33. /// <summary>
  34. /// ??
  35. /// </summary>
  36. public const string IDX = "IDX";
  37. public const string FK_Exp = "FK_Exp";
  38. #endregion
  39. }
  40. /// <summary>
  41. /// ???????????????.
  42. /// </summary>
  43. public class ExpDtl : EntityMyPK
  44. {
  45. #region ????
  46. public override UAC HisUAC
  47. {
  48. get
  49. {
  50. UAC uac = new UAC();
  51. uac.IsUpdate = true;
  52. return uac;
  53. }
  54. }
  55. /// <summary>
  56. /// ???????????
  57. /// </summary>
  58. public int FK_Node
  59. {
  60. get
  61. {
  62. return this.GetValIntByKey(ExpDtlAttr.FK_Node);
  63. }
  64. set
  65. {
  66. SetValByKey(ExpDtlAttr.FK_Node, value);
  67. }
  68. }
  69. public int IDX
  70. {
  71. get
  72. {
  73. return this.GetValIntByKey(ExpDtlAttr.IDX);
  74. }
  75. set
  76. {
  77. SetValByKey(ExpDtlAttr.IDX, value);
  78. }
  79. }
  80. public string RefField
  81. {
  82. get
  83. {
  84. return this.GetValStringByKey(ExpDtlAttr.RefField);
  85. }
  86. set
  87. {
  88. SetValByKey(ExpDtlAttr.RefField, value);
  89. }
  90. }
  91. public string FK_Exp
  92. {
  93. get
  94. {
  95. return this.GetValStringByKey(ExpDtlAttr.FK_Exp);
  96. }
  97. set
  98. {
  99. SetValByKey(ExpDtlAttr.FK_Exp, value);
  100. }
  101. }
  102. public string FieldName
  103. {
  104. get
  105. {
  106. string s = this.GetValStringByKey(ExpDtlAttr.FieldName);
  107. //if (s == "")
  108. // return this.RefFieldName;
  109. return s;
  110. }
  111. set
  112. {
  113. SetValByKey(ExpDtlAttr.FieldName, value);
  114. }
  115. }
  116. public string Field
  117. {
  118. get
  119. {
  120. string s = this.GetValStringByKey(ExpDtlAttr.Field);
  121. if (s == "")
  122. return this.RefField;
  123. return s;
  124. }
  125. set
  126. {
  127. SetValByKey(ExpDtlAttr.Field, value);
  128. }
  129. }
  130. public string FK_NodeT
  131. {
  132. get
  133. {
  134. return this.GetValRefTextByKey(ExpDtlAttr.FK_Node);
  135. }
  136. }
  137. #endregion
  138. #region ????
  139. /// <summary>
  140. /// ??????
  141. /// </summary>
  142. public ExpDtl() { }
  143. /// <summary>
  144. /// ??????
  145. /// </summary>
  146. /// <param name="_oid">??????ID</param>
  147. public ExpDtl(string _oid)
  148. {
  149. this.MyPK = _oid;
  150. this.Retrieve();
  151. }
  152. /// <summary>
  153. /// ??????
  154. /// </summary>
  155. public override Map EnMap
  156. {
  157. get
  158. {
  159. if (this._enMap != null)
  160. return this._enMap;
  161. Map map = new Map("WF_ExpDtl");
  162. map.EnDesc = "??????";
  163. map.DepositaryOfEntity = Depositary.None;
  164. map.DepositaryOfMap = Depositary.Application;
  165. map.AddMyPK(); /* FK_Node +"_"+ RefOID */
  166. //map.AddTBString(ExpDtlAttr.FK_Exp, null, "??", false, true, 0, 100, 10);
  167. //map.AddDDLEntities(ExpDtlAttr.FK_Node, null, "??", new NodeExts(), false);
  168. //map.AddTBInt(ExpDtlAttr.RefAttrOID, 0, "??ID", false, false);
  169. //map.AddTBString(ExpDtlAttr.RefTable, null, "???", true, false, 0, 20, 10);
  170. //map.AddTBString(ExpDtlAttr.RefField, null, "??", true, false, 0, 20, 10);
  171. //map.AddTBString(ExpDtlAttr.RefFieldName, null, "????", true, false, 0, 200, 10);
  172. //map.AddTBString(ExpDtlAttr.Field, null, "??(????)", true, false, 0, 20, 10);
  173. //map.AddTBString(ExpDtlAttr.FieldName, null, "????(????)", true, false, 0, 200, 10);
  174. map.AddTBInt(ExpDtlAttr.IDX, 0, "??", true, false);
  175. //map.AddTBInt(ExpDtlAttr.NodeID, 0, "NodeID", false, false);
  176. //map.AddDDLSysEnum(ExpDtlAttr.ShowTime, 0, "????", true, false, ExpDtlAttr.ShowTime, "@0=?(???????)@1=??????@2=????@3=????");
  177. //map.AddTBString(ExpDtlAttr.FK_Node, null, "????", false, true, 0, 100, 10);
  178. //map.AddTBString(ExpDtlAttr.DoWhat, null, "?????", false, true, 0, 100, 10);
  179. //map.AddTBInt(ExpDtlAttr.H, 0, "????", false, false);
  180. //map.AddTBInt(ExpDtlAttr.W, 0, "????", false, false);
  181. this._enMap = map;
  182. return this._enMap;
  183. }
  184. }
  185. #endregion
  186. protected override void afterDelete()
  187. {
  188. //BP.Sys.MapAttr attr = new BP.Sys.MapAttr();
  189. //attr.Delete(BP.Sys.MapAttrAttr.FK_MapData, this.FK_Exp,
  190. // BP.Sys.MapAttrAttr.KeyOfEn, this.Field);
  191. base.afterDelete();
  192. }
  193. #region ??
  194. /// <summary>
  195. /// ?????
  196. /// </summary>
  197. private void DoOrder()
  198. {
  199. ExpDtls attrs = new ExpDtls(this.FK_Exp);
  200. int i = 0;
  201. foreach (ExpDtl attr in attrs)
  202. {
  203. i++;
  204. attr.IDX = i;
  205. attr.Update(ExpDtlAttr.IDX, attr.IDX);
  206. }
  207. }
  208. public string DoUp()
  209. {
  210. this.DoOrder();
  211. this.RetrieveFromDBSources();
  212. if (this.IDX == 1)
  213. return null;
  214. ExpDtls attrs = new ExpDtls(this.FK_Exp);
  215. ExpDtl attrUp = (ExpDtl)attrs[this.IDX - 1 - 1];
  216. attrUp.Update(ExpDtlAttr.IDX, this.IDX);
  217. this.Update(ExpDtlAttr.IDX, this.IDX - 1);
  218. return null;
  219. }
  220. public string DoDown()
  221. {
  222. this.DoOrder();
  223. this.RetrieveFromDBSources();
  224. ExpDtls attrs = new ExpDtls(this.FK_Exp);
  225. if (this.IDX == attrs.Count)
  226. return null;
  227. ExpDtl attrDown = (ExpDtl)attrs[this.IDX];
  228. attrDown.Update(ExpDtlAttr.IDX, this.IDX);
  229. this.Update(ExpDtlAttr.IDX, this.IDX + 1);
  230. return null;
  231. }
  232. #endregion
  233. }
  234. /// <summary>
  235. /// ????????
  236. /// </summary>
  237. public class ExpDtls : EntitiesMyPK
  238. {
  239. #region ??
  240. /// <summary>
  241. /// ???? Entity
  242. /// </summary>
  243. public override Entity GetNewEntity
  244. {
  245. get
  246. {
  247. return new ExpDtl();
  248. }
  249. }
  250. #endregion
  251. #region ????
  252. /// <summary>
  253. /// ????????
  254. /// </summary>
  255. public ExpDtls()
  256. {
  257. }
  258. /// <summary>
  259. /// ????????.
  260. /// </summary>
  261. /// <param name="FlowNo"></param>
  262. public ExpDtls(string fk_rpt)
  263. {
  264. // int i = this.Retrieve(ExpDtlAttr.FK_Exp, fk_rpt, ExpDtlAttr.IDX);
  265. }
  266. public ExpDtls(int nodeid)
  267. {
  268. this.Retrieve(ExpDtlAttr.FK_Node, nodeid, ExpDtlAttr.IDX);
  269. }
  270. #endregion
  271. }
  272. }