UIB010321.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using Infragistics.Win.UltraWinGrid;
  9. using System.Collections;
  10. using System.Windows.Forms;
  11. using CoreFS.CA06;
  12. namespace Core.LZMes.Client.UIB
  13. {
  14. public partial class UIB010321 : FrmBase
  15. {
  16. public UIB010321()
  17. {
  18. InitializeComponent();
  19. }
  20. public override void ToolBar_Click(object sender, string ToolbarKey)
  21. {
  22. switch (ToolbarKey)
  23. {
  24. case "query":
  25. this.DoQuery();
  26. break;
  27. case "save":
  28. this.DoSave();
  29. break;
  30. case "delete":
  31. this.DoDelete();
  32. break;
  33. }
  34. }
  35. //初始化下拉框数据
  36. public void init()
  37. {
  38. DataTable dt = new DataTable();
  39. ArrayList al = new ArrayList();
  40. al.Add("UIB010321_01.INITSELECT");
  41. CoreClientParam ccp = new CoreClientParam();
  42. ccp.ServerName = "UIB.COM.ComDBQuery";
  43. ccp.MethodName = "doSimpleQuery";
  44. ccp.ServerParams = new object[] { al };
  45. ccp.SourceDataTable = dt;
  46. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  47. Init_ComboControl(this.ultraComboEditor1, ref dt);
  48. //DoQuery();
  49. //DataTable dt = new DataTable();
  50. //CoreClientParam ccp = new CoreClientParam();
  51. //dt = new DataTable();
  52. //ccp = new CoreClientParam();
  53. //ccp.ServerName = "UIB.COM.ComDBQuery";
  54. //ccp.MethodName = "doSimpleQuery";
  55. //paramArray = new ArrayList();
  56. //paramArray.Add("UIECOMM00_SELECT.C_STL_GRD");
  57. //ccp.ServerParams = new object[] { paramArray };
  58. //ccp.SourceDataTable = dt;
  59. //this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  60. //Core.LZMes.Client.UIE.UIE041.UIEBase.Init_ComboControl(this.ComboColdStlGrd, ref dt, "C_STL_GRD");
  61. //dt = new DataTable();
  62. //ccp = new CoreClientParam();
  63. //ccp.ServerName = "UIB.COM.ComDBQuery";
  64. //ccp.MethodName = "doSimpleQuery";
  65. //paramArray = new ArrayList();
  66. //paramArray.Add("UIECOMM00_SELECT.H_STL_GRD");
  67. //ccp.ServerParams = new object[] { paramArray };
  68. //ccp.SourceDataTable = dt;
  69. //this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  70. //Core.LZMes.Client.UIE.UIE041.UIEBase.Init_ComboControl(this.ComboHotStlGrd, ref dt, "H_STL_GRD");
  71. }
  72. public void DoQuery()
  73. {
  74. try
  75. {
  76. this.dataSet1.Tables[0].Clear();
  77. string type = "", Vtype = "";
  78. type = this.ultraComboEditor3.Text.Trim().ToString();
  79. if (type == "平整模式") Vtype = "PZ"; else if (type == "拉矫模式") Vtype = "LJ"; else Vtype = "LJL";
  80. ArrayList al = new ArrayList();
  81. al.Add("UIB010321_01.SELECT");
  82. al.Add(Vtype);
  83. CoreClientParam ccp = new CoreClientParam();
  84. ccp.ServerName = "UIB.COM.ComDBQuery";
  85. ccp.MethodName = "doSimpleQuery";
  86. ccp.ServerParams = new object[] { al };
  87. ccp.SourceDataTable = this.dataSet1.Tables[0];
  88. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  89. type = "";
  90. }catch(Exception ex)
  91. {
  92. MessageBox.Show(ex.ToString());
  93. }
  94. }
  95. //public void DoInsert()
  96. //{
  97. // try
  98. // {
  99. // int num = this.ultraGrid1.Rows.Count;
  100. // this.ultraGrid1.Rows[num - 1].Cells["DISPLAY_SEQ"].Value.ToString();
  101. // this.ultraGrid1.Rows[num - 1].Cells["PROD_TYPE"].Text.ToString();
  102. // this.ultraGrid1.Rows[num - 1].Cells["PROD_CD_CFNM"].Text.ToString();
  103. // this.ultraGrid1.Rows[num - 1].Cells["DCS_SYM"].Text.ToString();
  104. // }
  105. // catch (Exception ex)
  106. // {
  107. // MessageBox.Show(ex.ToString());
  108. // }
  109. //}
  110. public void DoSave()
  111. {
  112. try
  113. {
  114. if (MessageBox.Show("确定保存?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  115. return;
  116. ArrayList al = new ArrayList();
  117. ArrayList list = null;
  118. string type = "",Vtype="";
  119. type = this.ultraComboEditor3.Text.Trim().ToString();
  120. if (type == "平整模式") Vtype = "PZ"; else if (type == "拉矫模式") Vtype = "LJ"; else Vtype = "LJL";
  121. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  122. {
  123. if (ugr.Cells["CHK"].Text == "True")
  124. {
  125. if (ugr.Cells["STL_GRD"].Text.ToString() == "")
  126. {
  127. MessageBox.Show("牌号不允许为空!", "提示");
  128. return;
  129. }
  130. list = new ArrayList();
  131. if (ugr.Cells["EDIT_TYPE"].Text == "")//插入
  132. {
  133. list.Add("UIB010321_01.INSERT");
  134. list.Add(ugr.Cells["STL_GRD"].Text.ToString());
  135. list.Add(Vtype);
  136. //list.Add(ugr.Cells["DAT_TYPE"].Text.ToString());
  137. list.Add(ugr.Cells["ROOM1"].Text.ToString());
  138. list.Add(ugr.Cells["ROOM2"].Text.ToString());
  139. list.Add(ugr.Cells["ROOM3"].Text.ToString());
  140. list.Add(ugr.Cells["ROOM4"].Text.ToString());
  141. list.Add(ugr.Cells["ROOM5"].Text.ToString());
  142. list.Add(ugr.Cells["ROOM6"].Text.ToString());
  143. list.Add(ugr.Cells["ROOM7"].Text.ToString());
  144. list.Add(ugr.Cells["ROOM8"].Text.ToString());
  145. list.Add(ugr.Cells["ROOM9"].Text.ToString());
  146. list.Add(ugr.Cells["ROOM10"].Text.ToString());
  147. list.Add(ugr.Cells["ROOM11"].Text.ToString());
  148. list.Add(ugr.Cells["ROOM12"].Text.ToString());
  149. list.Add(ugr.Cells["ROOM13"].Text.ToString());
  150. list.Add(ugr.Cells["ROOM14"].Text.ToString());
  151. list.Add(ugr.Cells["ROOM15"].Text.ToString());
  152. list.Add(ugr.Cells["ROOM16"].Text.ToString());
  153. list.Add(ugr.Cells["ROOM17"].Text.ToString());
  154. list.Add(ugr.Cells["ROOM18"].Text.ToString());
  155. //list.Add(this.UserInfo.GetUserName());
  156. }
  157. else//更新
  158. {
  159. list.Add("UIB010321_01.UPDATE");
  160. list.Add(ugr.Cells["STL_GRD"].Text.ToString());
  161. list.Add(ugr.Cells["DAT_TYPE"].Text.ToString());
  162. list.Add(ugr.Cells["ROOM1"].Text.ToString());
  163. list.Add(ugr.Cells["ROOM2"].Text.ToString());
  164. list.Add(ugr.Cells["ROOM3"].Text.ToString());
  165. }
  166. al.Add(list);
  167. }
  168. }
  169. if (al.Count == 0)
  170. {
  171. MessageBox.Show("请勾选数据再做保存操作!", "提示");
  172. return;
  173. }
  174. CoreClientParam ccp = new CoreClientParam();
  175. ccp.ServerName = "UIB.COM.ComDBSave";
  176. ccp.MethodName = "doXmlSave";
  177. ccp.ServerParams = new object[] { al };
  178. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  179. this.DoQuery();
  180. type = "";
  181. Vtype = "";
  182. }
  183. catch (Exception ex)
  184. {
  185. MessageBox.Show(ex.ToString());
  186. }
  187. }
  188. public void DoDelete()
  189. {
  190. try
  191. {
  192. if (MessageBox.Show("确定删除?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  193. return;
  194. ArrayList al = new ArrayList();
  195. ArrayList list = null;
  196. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  197. {
  198. if (ugr.Cells["CHK"].Text == "True")
  199. {
  200. list = new ArrayList();
  201. list.Add("UIB010320_01.DELETE");
  202. list.Add(ugr.Cells["PROD_CD"].Text.ToString());
  203. al.Add(list);
  204. }
  205. }
  206. CoreClientParam ccp = new CoreClientParam();
  207. ccp.ServerName = "UIB.COM.ComDBSave";
  208. ccp.MethodName = "doXmlSave";
  209. ccp.ServerParams = new object[] { al };
  210. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  211. this.DoQuery();
  212. }
  213. catch (Exception ex)
  214. {
  215. MessageBox.Show(ex.ToString());
  216. }
  217. }
  218. public static void Init_ComboControl(System.Windows.Forms.Control ComboControl, ref System.Data.DataTable dt)
  219. {
  220. System.Data.DataView dtview = new System.Data.DataView(dt);
  221. ((Infragistics.Win.UltraWinEditors.UltraComboEditor)ComboControl).DataSource = dtview;
  222. ((Infragistics.Win.UltraWinEditors.UltraComboEditor)ComboControl).DisplayMember = "SM_CFNM";
  223. ((Infragistics.Win.UltraWinEditors.UltraComboEditor)ComboControl).ValueMember = "SM_CD";
  224. //try
  225. //{
  226. // switch (ComboControl.GetType().ToString())
  227. // {
  228. // case "Infragistics.Win.UltraWinEditors.UltraComboEditor":
  229. // break;
  230. // }
  231. //}
  232. //catch (System.Exception ex)
  233. //{
  234. // System.Diagnostics.Debug.WriteLine(ex.ToString());
  235. //}
  236. }
  237. private void UIB010321_Load(object sender, EventArgs e)
  238. {
  239. init();
  240. this.ultraComboEditor3.SelectedIndex = 0;
  241. }
  242. //自定义单元格数据错误提示框
  243. private void ultraGrid1_CellDataError(object sender, CellDataErrorEventArgs e)
  244. {
  245. e.RaiseErrorEvent = false;
  246. e.StayInEditMode = true;
  247. MessageBox.Show("输入数据的格式不正确,请校验");
  248. }
  249. }
  250. }