QcmJyEquipment.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Format;
  3. using Core.Mes.Client.Comm.Server;
  4. using Core.Mes.Client.Comm.Tool;
  5. using Core.StlMes.Client.Judge.Commons;
  6. using Core.StlMes.Client.Judge.Models;
  7. using Core.StlMes.Client.Judge.ViewModels;
  8. using CoreFS.CA06;
  9. using Infragistics.Win;
  10. using Infragistics.Win.UltraWinEditors;
  11. using Infragistics.Win.UltraWinGrid;
  12. using System;
  13. using System.Collections;
  14. using System.Collections.Generic;
  15. using System.Data;
  16. using System.Diagnostics;
  17. using System.Drawing;
  18. using System.Drawing.Printing;
  19. using System.IO;
  20. using System.Linq;
  21. using System.Net;
  22. using System.Windows.Forms;
  23. namespace Core.StlMes.Client.Judge.Forms
  24. {
  25. public partial class QcmJyEquipment : FrmBase
  26. {
  27. /// <summary>
  28. /// 登入的用户
  29. /// </summary>
  30. String username ="";
  31. public QcmJyEquipment()
  32. {
  33. InitializeComponent();
  34. this.IsLoadUserView = true;
  35. }
  36. public override void ToolBar_Click(object sender, string ToolbarKey)
  37. {
  38. switch (ToolbarKey)
  39. {
  40. case "Query":
  41. DoQuery();
  42. break;
  43. case "Update":
  44. DoUpdate();
  45. break;
  46. case "Delete":
  47. Delete();
  48. break;
  49. case "Add":
  50. DoAdd();
  51. break;
  52. case "Close":
  53. this.Close();
  54. break;
  55. }
  56. }
  57. private void DoQuery()
  58. {
  59. ultraGrid1.UpdateData();
  60. ArrayList param = new ArrayList();
  61. DataTable table = ServerHelper.GetData("com.steering.pss.judge.DAL.QcmJyEquipment.FindEquipmentInfo", new Object[] { param }, ob);
  62. GridHelper.CopyDataToDatatable(table,this.dataTable1,true);
  63. //ultraGrid1.DataSource = table;
  64. }
  65. private void DoUpdate()
  66. {
  67. ultraGrid1.UpdateData();
  68. ArrayList list1 = new ArrayList();
  69. String items = "";
  70. String result = "";
  71. String eid = "";
  72. ArrayList pram1 = new ArrayList();
  73. IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  74. if (uGrid.Count() == 0)
  75. {
  76. MessageUtil.ShowTips("请选择修改的数据!");
  77. return;
  78. }
  79. foreach (UltraGridRow ugr in uGrid)
  80. {
  81. items = ugr.Cells["ITEMS"].Value.ToString().Trim();
  82. result = ugr.Cells["RESULT"].Value.ToString().Trim();
  83. eid = ugr.Cells["EID"].Value.ToString();
  84. if (items == "") { MessageUtil.ShowTips("设备名称不能为空!"); return; }
  85. if (result == "") { MessageUtil.ShowTips("设备型号不能为空!"); return; }
  86. ArrayList list = new ArrayList();
  87. list.Add(items);
  88. list.Add(result);
  89. list.Add(UserInfo.GetUserName());
  90. list.Add(eid);
  91. pram1.Add(list);
  92. }
  93. CoreClientParam ccp = new CoreClientParam();
  94. ccp.ServerName = "com.steering.pss.judge.DAL.QcmJyEquipment";
  95. ccp.MethodName = "UpdateEquipment";
  96. ccp.ServerParams = new object[] { pram1 };
  97. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  98. if (ccp.ReturnCode != -1)
  99. {
  100. MessageUtil.ShowTips(ccp.ReturnInfo);
  101. if (ccp.ReturnInfo.Equals("修改成功!"))
  102. {
  103. DoQuery();
  104. }
  105. }
  106. }
  107. private void Delete()
  108. {
  109. ultraGrid1.UpdateData();
  110. ArrayList pram1 = new ArrayList();
  111. IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  112. if (uGrid.Count() == 0)
  113. {
  114. MessageUtil.ShowTips("请选择要删除的数据!");
  115. return;
  116. }
  117. if (MessageUtil.ShowYesNoAndQuestion("是否确认删除信息?") == System.Windows.Forms.DialogResult.No)
  118. {
  119. return;
  120. }
  121. foreach (UltraGridRow ugr in uGrid)
  122. {
  123. ArrayList pram = new ArrayList();
  124. pram.Add(ugr.Cells["EID"].Value.ToString());
  125. pram1.Add(pram);
  126. }
  127. int countinsert = ServerHelper.SetData("com.steering.pss.judge.DAL.QcmJyEquipment.deleteEquipment", new Object[] { pram1 }, this.ob);
  128. if (countinsert > 0)
  129. {
  130. MessageUtil.ShowTips("删除成功!");
  131. }
  132. else
  133. {
  134. MessageUtil.ShowTips("删除失败!"); return;
  135. }
  136. DoQuery();
  137. }
  138. private void DoAdd()
  139. {
  140. ultraGrid1.UpdateData();
  141. ArrayList list1 = new ArrayList();
  142. String items = "";
  143. String result = "";
  144. String createname = "";
  145. IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  146. if (uGrid.Count() == 0)
  147. {
  148. MessageUtil.ShowTips("请选择要新增的数据!");
  149. return;
  150. }
  151. foreach (UltraGridRow ugr in uGrid)
  152. {
  153. ArrayList list = new ArrayList();
  154. items = ugr.Cells["ITEMS"].Value.ToString().Trim();
  155. result = ugr.Cells["RESULT"].Value.ToString().Trim();
  156. if (items == "") { MessageUtil.ShowTips("设备名称不能为空!"); return; }
  157. if (result == "") { MessageUtil.ShowTips("设备型号不能为空!"); return; }
  158. list.Add(items);
  159. list.Add(result);
  160. createname = username;
  161. list.Add(createname);
  162. list1.Add(list);
  163. }
  164. CoreClientParam ccp = new CoreClientParam();
  165. ccp.ServerName = "com.steering.pss.judge.DAL.QcmJyEquipment";
  166. ccp.MethodName = "AddEquipment";
  167. ccp.ServerParams = new object[] { list1 };
  168. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  169. if (ccp.ReturnCode != -1)
  170. {
  171. MessageUtil.ShowTips(ccp.ReturnInfo);
  172. if (ccp.ReturnInfo.Equals("新增成功!"))
  173. {
  174. DoQuery();
  175. }
  176. }
  177. }
  178. private void QcmJyEquipment_Load(object sender, EventArgs e)
  179. {
  180. username = UserInfo.GetUserName();//获取登录的用户名
  181. DoQuery();
  182. }
  183. private void ultraExpandableGroupBox1_ExpandedStateChanged(object sender, EventArgs e)
  184. {
  185. }
  186. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  187. {
  188. }
  189. }
  190. }