FrmStressRingManage.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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.Lims.Data.PipeAndOutdec.封装类.实体类;
  6. using CoreFS.CA06;
  7. using Infragistics.Win.UltraWinGrid;
  8. using System;
  9. using System.Collections;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Windows.Forms;
  17. namespace Core.StlMes.Client.Lims.Data.PipeAndOutdec.数据管理.钢管实验管理
  18. {
  19. public partial class FrmStressRingManage : FrmBase
  20. {
  21. public FrmStressRingManage()
  22. {
  23. InitializeComponent();
  24. }
  25. /// <summary>
  26. /// 重写基类方法
  27. /// </summary>
  28. /// <param name="sender"></param>
  29. /// <param name="ToolbarKey"></param>
  30. public override void ToolBar_Click(object sender, string ToolbarKey)
  31. {
  32. switch (ToolbarKey)
  33. {
  34. case "Query":
  35. DoQuery();
  36. break;
  37. case "Add":
  38. DoAdd();
  39. break;
  40. case "Delete":
  41. DoDelete();
  42. break;
  43. case "Update":
  44. DoUpdare();
  45. break;
  46. case "Close":
  47. this.Close();
  48. break;
  49. }
  50. }
  51. /// <summary>
  52. /// 修改
  53. /// </summary>
  54. private void DoUpdare()
  55. {
  56. ultraGrid1.UpdateData();
  57. ArrayList list1 = new ArrayList();
  58. IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  59. if (uGrid.Count() == 0)
  60. {
  61. MessageUtil.ShowTips("请选择要修改的数据!");
  62. return;
  63. }
  64. foreach (UltraGridRow ugr in uGrid)
  65. {
  66. PipeStressringParmEntity pipeStressringParmEntity = (PipeStressringParmEntity)ugr.ListObject;
  67. string pipeStressringParmEntityStr = JSONFormat.Format(pipeStressringParmEntity);
  68. list1.Add(pipeStressringParmEntityStr);
  69. }
  70. CoreClientParam ccp = new CoreClientParam();
  71. ccp.ServerName = "com.steering.lims.data.pipe.FrmPipeStressringParm";
  72. ccp.MethodName = "updateStressringParm";
  73. ccp.ServerParams = new object[] { list1 };
  74. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  75. if (ccp.ReturnCode != -1)
  76. {
  77. MessageUtil.ShowTips(ccp.ReturnInfo);
  78. if (ccp.ReturnInfo.Equals("修改成功!"))
  79. {
  80. DoQuery();
  81. }
  82. }
  83. }
  84. /// <summary>
  85. /// 删除
  86. /// </summary>
  87. private void DoDelete()
  88. {
  89. ultraGrid1.UpdateData();
  90. ArrayList list1 = new ArrayList();
  91. IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  92. if (uGrid.Count() == 0)
  93. {
  94. MessageUtil.ShowTips("请选择要删除的数据!");
  95. return;
  96. }
  97. foreach (UltraGridRow ugr in uGrid)
  98. {
  99. PipeStressringParmEntity pipeStressringParmEntity = (PipeStressringParmEntity)ugr.ListObject;
  100. string pipeStressringParmEntityStr = JSONFormat.Format(pipeStressringParmEntity);
  101. list1.Add(pipeStressringParmEntityStr);
  102. }
  103. CoreClientParam ccp = new CoreClientParam();
  104. ccp.ServerName = "com.steering.lims.data.pipe.FrmPipeStressringParm";
  105. ccp.MethodName = "deleteStressringParm";
  106. ccp.ServerParams = new object[] { list1 };
  107. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  108. if (ccp.ReturnCode != -1)
  109. {
  110. MessageUtil.ShowTips(ccp.ReturnInfo);
  111. if (ccp.ReturnInfo.Equals("删除成功!"))
  112. {
  113. DoQuery();
  114. }
  115. }
  116. }
  117. private void DoAdd()
  118. {
  119. ultraGrid1.UpdateData();
  120. ArrayList list1 = new ArrayList();
  121. IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
  122. if (uGrid.Count() == 0)
  123. {
  124. MessageUtil.ShowTips("请选择要新增的数据!");
  125. return;
  126. }
  127. foreach (UltraGridRow ugr in uGrid)
  128. {
  129. PipeStressringParmEntity pipeStressringParmEntity = (PipeStressringParmEntity)ugr.ListObject;
  130. string pipeStressringParmEntityStr = JSONFormat.Format(pipeStressringParmEntity);
  131. list1.Add(pipeStressringParmEntityStr);
  132. }
  133. CoreClientParam ccp = new CoreClientParam();
  134. ccp.ServerName = "com.steering.lims.data.pipe.FrmPipeStressringParm";
  135. ccp.MethodName = "addStressringParm";
  136. ccp.ServerParams = new object[] { list1 };
  137. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  138. if (ccp.ReturnCode != -1)
  139. {
  140. MessageUtil.ShowTips(ccp.ReturnInfo);
  141. if (ccp.ReturnInfo.Equals("新增成功!"))
  142. {
  143. DoQuery();
  144. }
  145. }
  146. }
  147. private void DoQuery()
  148. {
  149. List<PipeStressringParmEntity> listSource = EntityHelper.GetData<PipeStressringParmEntity>(
  150. "com.steering.lims.data.pipe.FrmPipeStressringParm.doQueryData", new object[] { }, this.ob);
  151. bindingSource1.DataSource = listSource;
  152. GridHelper.RefreshAndAutoSize(this.ultraGrid1);
  153. }
  154. private void FrmStressRingManage_Load(object sender, EventArgs e)
  155. {
  156. EntityHelper.ShowGridCaption<PipeStressringParmEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  157. }
  158. private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  159. {
  160. try
  161. {
  162. ultraGrid1.UpdateData();
  163. foreach (UltraGridRow r in ultraGrid1.Rows)
  164. {
  165. r.Cells["CHK"].Value = r.Selected;
  166. }
  167. }
  168. catch { }
  169. }
  170. }
  171. }