EGLS.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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 Infragistics.Win.UltraWinGrid;
  12. using System.Reflection;
  13. namespace Core.LZMes.Client.QCM
  14. {
  15. public partial class EGLS : FrmBase
  16. {
  17. public EGLS()
  18. {
  19. InitializeComponent();
  20. }
  21. public override void ToolBar_Click(object sender, string ToolbarKey)
  22. {
  23. switch (ToolbarKey)
  24. {
  25. case "Query":
  26. this.DoQuery();
  27. break;
  28. case "Add":
  29. this.DoAdd();
  30. break;
  31. case "Update":
  32. this.DoUpdate();
  33. break;
  34. case "Delete":
  35. this.DoDelete();
  36. break;
  37. }
  38. }
  39. //查询
  40. private void DoQuery()
  41. {
  42. try
  43. {
  44. this.dataSet1.Clear();
  45. string forName = this.textBox1.Text.Trim();
  46. string proLine = this.textBox2.Text.Trim();
  47. CoreClientParam ccp = new CoreClientParam();
  48. ccp.MethodName = "QueryRealize";
  49. ccp.ServerName = "QCM.EGIS.Query";
  50. ccp.ServerParams = new object[]{ forName , proLine };
  51. ccp.SourceDataTable = this.dataSet1.Tables[0];
  52. this.ExecuteQueryToDataTable(ccp,CoreInvokeType.Internal);
  53. }
  54. catch (Exception ex)
  55. {
  56. System.Diagnostics.Debug.WriteLine(ex.ToString());
  57. MessageBox.Show("系统出错,请联系管理人员", "警告");
  58. }
  59. }
  60. //新增
  61. private void DoAdd()
  62. {
  63. try
  64. {
  65. ArrayList list = new ArrayList();
  66. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  67. {
  68. if (ugr.Cells["CHK"].Text.ToString() == "True")
  69. {
  70. list = new ArrayList();
  71. list.Add(ugr.Cells["FOR_NAME"].Text.ToString());
  72. list.Add(ugr.Cells["PRODUCTION_LINE"].Text.ToString());
  73. list.Add(ugr.Cells["NORM"].Text.ToString());
  74. list.Add(ugr.Cells["UNIT_PRICE"].Text.ToString());
  75. }// if end
  76. }//foreach end
  77. if (list.Count == 0) return;
  78. CoreClientParam ccp = new CoreClientParam();
  79. ccp.MethodName = "addEglsRealize";
  80. ccp.ServerName = "QCM.EGIS.addEgls";
  81. ccp.ServerParams = new object[] { list };
  82. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  83. this.DoQuery();
  84. }
  85. catch (Exception ex)
  86. {
  87. System.Diagnostics.Debug.WriteLine(ex.ToString());
  88. MessageBox.Show("系统出错,请联系管理人员", "警告");
  89. }
  90. }
  91. //更新
  92. private void DoUpdate()
  93. {
  94. try
  95. {
  96. ArrayList al = new ArrayList();
  97. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  98. {
  99. if (ugr.Cells["CHK"].Text.ToString() == "True")
  100. {
  101. if (ugr.Cells["EGIS_ID"].Text != "")//更新
  102. {
  103. al.Add(ugr.Cells["FOR_NAME"].Text.ToString());
  104. al.Add(ugr.Cells["PRODUCTION_LINE"].Text.ToString());
  105. al.Add(ugr.Cells["NORM"].Text.ToString());
  106. al.Add(ugr.Cells["UNIT_PRICE"].Text.ToString());
  107. al.Add(ugr.Cells["EGIS_ID"].Text.ToString());
  108. }
  109. }// if end
  110. }//foreach end
  111. if (al.Count == 0) return;
  112. CoreClientParam ccp = new CoreClientParam();
  113. ccp.ServerName = "QCM.EGIS.Savel";
  114. ccp.MethodName = "SaveRealize";
  115. ccp.ServerParams = new object[] { al };
  116. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  117. this.DoQuery();
  118. }
  119. catch (Exception ex)
  120. {
  121. System.Diagnostics.Debug.WriteLine(ex.ToString());
  122. MessageBox.Show("系统出错,请联系管理人员", "警告");
  123. }
  124. }
  125. //删除
  126. public void DoDelete()
  127. {
  128. try
  129. {
  130. if (MessageBox.Show("确定删除?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  131. return;
  132. ArrayList al = new ArrayList();
  133. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  134. {
  135. if (ugr.Cells["CHK"].Text.ToString() == "True")
  136. {
  137. al.Add(ugr.Cells["EGIS_ID"].Text.ToString());
  138. }//if end
  139. }//for end
  140. CoreClientParam ccp = new CoreClientParam();
  141. ccp.ServerName = "QCM.EGIS.removeEgls";
  142. ccp.MethodName = "removeEglsRealize";
  143. ccp.ServerParams = new object[] { al[0] };
  144. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  145. this.DoQuery();
  146. }
  147. catch (Exception ex)
  148. {
  149. }
  150. }
  151. }
  152. }