805d29ad4d2459c0cd331da8a31d151bf13f154c.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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 System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using System.Collections;
  11. using System.Diagnostics;
  12. namespace Core.LZMes.Client.UIK
  13. {
  14. public partial class UIK010080 : FrmBase
  15. {
  16. public UIK010080()
  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 "Insert"://添加反射率检验记录
  28. this.DoInsert();
  29. break;
  30. case "Update"://修改反射率检验记录
  31. this.DoUpdate();
  32. break;
  33. case "Export":
  34. this.DoExport();
  35. break;
  36. case "Delete"://删除反射率检验记录
  37. this.DoDelete();
  38. break;
  39. }
  40. }
  41. private void UIK010080_Load(object sender, EventArgs e)
  42. {
  43. this.ultraDateTimeEditor1.Enabled = this.checkBox1.Checked;
  44. this.ultraDateTimeEditor2.Enabled = this.checkBox1.Checked;
  45. }
  46. private void DoQuery()
  47. {
  48. try
  49. {
  50. ArrayList al = new ArrayList();
  51. al.Add("UIK010080_01.SELECT");
  52. //al.Add(this.textBox9_coilNo.Text.Trim());//钢卷号
  53. //al.Add(this.textBox3_stl_grd.Text.Trim());//牌号
  54. if (this.checkBox1.Checked)
  55. {
  56. al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd"));//日期
  57. al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd"));//日期
  58. }
  59. else
  60. {
  61. al.Add("");
  62. al.Add("");
  63. }
  64. this.dataSet2.Tables[0].Clear();
  65. CoreClientParam ccp = new CoreClientParam();
  66. ccp.ServerName = "UIB.COM.ComDBQuery";
  67. ccp.MethodName = "doSimpleQuery";
  68. ccp.ServerParams = new object[] { al };
  69. ccp.SourceDataTable = this.dataSet2.Tables[0];
  70. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  71. DataRowCollection drc1 = this.dataSet2.Tables[0].Rows;
  72. if (drc1.Count <= 0)
  73. {
  74. MessageBox.Show("暂无记录!");
  75. }
  76. this.clearTextBoxData();
  77. }
  78. catch (Exception ex)
  79. {
  80. MessageBox.Show(ex.ToString());
  81. }
  82. }
  83. private void DoUpdate()
  84. {
  85. if (MessageBox.Show("您确认要修改?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
  86. {
  87. try
  88. {
  89. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid2.ActiveRow;
  90. if (ugr.Cells["SELECT_ITEM"].Text.ToString() == "True")
  91. {
  92. if (this.ultraTextEditor_no.Text == "")
  93. {
  94. MessageBox.Show("该记录不存在,不能修改!", "提示");
  95. return;
  96. }
  97. ArrayList list = new ArrayList();
  98. list.Add("UIK010080_01.UPDATE");
  99. list.Add(this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd"));
  100. list.Add(this.ultraTextsmptime.Text.ToString());//取样时间
  101. list.Add(this.smplocat.Text.ToString());//取样地点
  102. list.Add(this.ultraTextsmpcunt.Text.ToString());//取样百分比
  103. list.Add(this.ultraTextEditor1.Text.ToString());//取样人
  104. list.Add(ugr.Cells["dateno"].Text);
  105. CoreClientParam ccp = new CoreClientParam();
  106. ccp.ServerName = "UIB.COM.ComDBSave";
  107. ccp.MethodName = "doXmlSave";
  108. ccp.ServerParams = new object[] { list };
  109. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  110. this.DoQuery();
  111. this.clearTextBoxData();
  112. }
  113. else
  114. {
  115. MessageBox.Show("请选择修改行!");
  116. }
  117. }
  118. catch (Exception Ex)
  119. {
  120. MessageBox.Show(Ex.ToString());
  121. }
  122. }
  123. }
  124. private void DoInsert()
  125. {
  126. if (MessageBox.Show("您确认要添加数据吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
  127. {
  128. try
  129. {
  130. if (this.ultraTextEditor_no.Text.ToString() != "")
  131. {
  132. MessageBox.Show("请不要勾选行记录!", "提示");
  133. return;
  134. }
  135. ArrayList list = new ArrayList();
  136. list.Add("UIK010080_01.INSERT");
  137. list.Add(this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd"));
  138. list.Add(this.smplocat.Text.ToString());
  139. list.Add(this.ultraTextsmptime.Text.ToString());
  140. list.Add(this.ultraTextsmpcunt.Text.ToString());
  141. list.Add(this.ultraTextEditor1.Text.ToString());
  142. CoreClientParam ccp = new CoreClientParam();
  143. ccp.ServerName = "UIB.COM.ComDBSave";
  144. ccp.MethodName = "doXmlSave";
  145. ccp.ServerParams = new object[] { list };
  146. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  147. this.DoQuery();
  148. this.clearTextBoxData();
  149. }
  150. catch (Exception Ex)
  151. {
  152. MessageBox.Show(Ex.ToString());
  153. }
  154. }
  155. }
  156. public void DoDelete()
  157. {
  158. try
  159. {
  160. if (MessageBox.Show("确定删除选中的记录?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  161. return;
  162. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid2.ActiveRow;
  163. if (ugr.Cells["SELECT_ITEM"].Text.ToString() == "True")
  164. {
  165. if (ugr.Cells["DATENO"].Text.ToString() == "")
  166. {
  167. MessageBox.Show("该记录不存在!", "提示");
  168. return;
  169. }
  170. ArrayList list = new ArrayList();
  171. list.Add("UIK010080_01.delete");
  172. list.Add(ugr.Cells["DATENO"].Text.ToString());
  173. //list.Add(ugr.Cells["REG_DTIME"].Text.ToString());
  174. CoreClientParam ccp = new CoreClientParam();
  175. ccp.ServerName = "UIB.COM.ComDBSave";
  176. ccp.MethodName = "doXmlSave";
  177. ccp.ServerParams = new object[] { list };
  178. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  179. this.DoQuery();
  180. this.clearTextBoxData();
  181. }
  182. else
  183. {
  184. MessageBox.Show("请选择需要删除的记录!");
  185. }
  186. }
  187. catch (Exception ex)
  188. {
  189. MessageBox.Show(ex.ToString());
  190. }
  191. }
  192. public void DoExport()
  193. {
  194. try
  195. {
  196. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  197. {
  198. string fName = this.saveFileDialog1.FileName;
  199. this.ultraGridExcelExporter1.Export(this.ultraGrid2, fName);
  200. Process.Start(fName);
  201. }
  202. }
  203. catch (Exception ex)
  204. {
  205. System.Diagnostics.Debug.WriteLine(ex.ToString());
  206. }
  207. }
  208. //清空编辑区域的数据
  209. private void clearTextBoxData()
  210. {
  211. this.ultraTextEditor_no.Clear();
  212. this.smplocat.Clear();
  213. this.ultraTextsmptime.Clear();
  214. this.ultraTextsmpcunt.Clear();
  215. this.ultraTextEditor1.Clear();
  216. //this.ultraTextEditor_no.Text = edit_no;
  217. //this.smplocat.Text = e.Cell.Row.Cells["smp_locat"].Text;
  218. //this.ultraTextsmptime.Text = e.Cell.Row.Cells["smp_dtime"].Text;
  219. //this.ultraTextsmpcunt.Text = e.Cell.Row.Cells["smp_cont"].Text;
  220. //this.ultraTextEditor1.Text = e.Cell.Row.Cells["regman"].Text;
  221. }
  222. //时间查询参数选择事件
  223. private void checkBox1_Click(object sender, EventArgs e)
  224. {
  225. this.ultraDateTimeEditor1.Enabled = this.checkBox1.Checked;
  226. this.ultraDateTimeEditor2.Enabled = this.checkBox1.Checked;
  227. }
  228. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  229. {
  230. }
  231. private void ultraGrid2_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  232. {
  233. if (e.Cell.Column.Key == "SELECT_ITEM")
  234. {
  235. if (e.Cell.Text == "True")
  236. {
  237. string edit_no = e.Cell.Row.Cells["DATENO"].Text;
  238. //string edit_REG_DTIME = e.Cell.Row.Cells["REG_DTIME"].Text;
  239. /*for循环控制单选*/
  240. int i = this.ultraGrid2.Rows.Count;
  241. for (int j = 0; j < i; j++)
  242. {
  243. if (this.ultraGrid2.Rows[j].Cells["DATENO"].Value.ToString() != edit_no
  244. )
  245. {
  246. this.ultraGrid2.Rows[j].Cells["SELECT_ITEM"].Value = false;
  247. }
  248. }
  249. this.ultraTextEditor_no.Text = edit_no;
  250. this.smplocat.Text = e.Cell.Row.Cells["smp_locat"].Text;
  251. this.ultraTextsmptime.Text = e.Cell.Row.Cells["smp_dtime"].Text;
  252. this.ultraTextsmpcunt.Text = e.Cell.Row.Cells["smp_cont"].Text;
  253. this.ultraTextEditor1.Text = e.Cell.Row.Cells["regman"].Text;
  254. DateTime dt = DateTime.ParseExact(e.Cell.Row.Cells["smp_date"].Text, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
  255. this.ultraDateTimeEditor3.Value = dt;
  256. }
  257. else
  258. {
  259. this.clearTextBoxData();
  260. }
  261. }
  262. }
  263. }
  264. }