5c0617799e6de7cc98074eb670b3c7296695d7e7.svn-base 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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. namespace Core.LZMes.Client.QCM
  13. {
  14. public partial class QCM0102 : FrmBase
  15. {
  16. public QCM0102()
  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 "Add":
  28. this.DoAdd();
  29. break;
  30. case "Update":
  31. this.DoUpdate();
  32. break;
  33. case "Delete":
  34. this.DoDelete();
  35. break;
  36. case "Close":
  37. this.Close();
  38. break;
  39. }
  40. }
  41. private void DoQuery()
  42. {
  43. //查询
  44. try
  45. {
  46. this.dataSet1.Tables[0].Clear();
  47. string grpName = this.textBox1.Text.Trim();// 材质项目名称
  48. CoreClientParam ccp = new CoreClientParam();
  49. ccp.ServerName = "QCM.QCM01.QCM0102.QueryPhy";
  50. ccp.MethodName = "Query";
  51. ccp.ServerParams = new object[] { grpName };
  52. ccp.SourceDataTable = this.dataSet1.Tables[0];
  53. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  54. }
  55. catch (Exception ex)
  56. {
  57. System.Diagnostics.Debug.WriteLine(ex.ToString());
  58. }
  59. }
  60. private void DoAdd()
  61. {
  62. try
  63. {
  64. if (this.UserInfo.GetUserGroup() == 0 + "")
  65. {
  66. MessageBox.Show("常白班人员禁止对数据进行操作", "警告");
  67. return;
  68. }
  69. if ("" == this.textBox2.Text )
  70. {
  71. MessageBox.Show("组合项目代码不能为空!", "警告");
  72. this.textBox2.Focus();
  73. return;
  74. }
  75. if ("" == this.textBox3.Text)
  76. {
  77. MessageBox.Show("组合项目名称不能为空!", "警告");
  78. this.textBox3.Focus();
  79. return;
  80. }
  81. if ("" == this.textBox4.Text)
  82. {
  83. MessageBox.Show("材质大类描述不能为空!", "警告");
  84. this.textBox4.Focus();
  85. return;
  86. }
  87. if ("" == this.textBox5.Text)
  88. {
  89. MessageBox.Show("缺陷类型不能为空!", "警告");
  90. this.textBox5.Focus();
  91. return;
  92. }
  93. if (MessageBox.Show("确认保存?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  94. return;
  95. ArrayList al = new ArrayList();
  96. al.Add(this.textBox2.Text.Trim()); //组合项目代码
  97. al.Add(this.textBox3.Text.Trim()); //组合项目名称
  98. al.Add(this.textBox4.Text.Trim()); //材质大类描述
  99. al.Add("A"); //测试材质检验项代码
  100. al.Add(this.textBox5.Text.Trim()); //缺陷分类描述
  101. al.Add(this.textBox6.Text.Trim()); //备注
  102. al.Add(this.UserInfo.GetUserID()); //创建人ID
  103. al.Add(this.UserInfo.GetUserName()); //创建人
  104. CoreClientParam ccp = new CoreClientParam();
  105. ccp.ServerName = "QCM.QCM01.QCM0102.addPhy";
  106. ccp.MethodName = "add";
  107. ccp.ServerParams = new object[] { al };
  108. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  109. if (0 != ccp.ReturnCode) return;
  110. if (!"1".Equals(ccp.ReturnObject.ToString()))
  111. {
  112. MessageBox.Show(ccp.ReturnObject.ToString());
  113. return;
  114. }
  115. DoQuery();
  116. MessageBox.Show("创建成功!");
  117. }
  118. catch (Exception ex)
  119. {
  120. System.Diagnostics.Debug.WriteLine(ex.ToString());
  121. MessageBox.Show("系统发生异常,请与管理员联系", "提示");
  122. }
  123. }
  124. private void DoUpdate()
  125. {
  126. //更新
  127. try
  128. {
  129. if (this.UserInfo.GetUserGroup() == 0 + "")
  130. {
  131. MessageBox.Show("常白班人员禁止对数据进行操作", "警告");
  132. return;
  133. }
  134. if (this.ultraGrid1.Selected.Rows.Count == 0)
  135. {
  136. MessageBox.Show("请选择要修改的数据!");
  137. return;
  138. }
  139. //选择一行数据
  140. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  141. string grpCode = ugr.Cells["PHY_GRP_CODE"].Value.ToString();
  142. if (MessageBox.Show("确认修改?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  143. return;
  144. ArrayList al = new ArrayList();
  145. al.Add(this.textBox3.Text.Trim()); //组合项目名称
  146. al.Add(this.textBox4.Text.Trim()); //材质大类描述
  147. al.Add(this.textBox5.Text.Trim()); //缺陷分类描述
  148. al.Add(this.textBox6.Text.Trim()); //备注
  149. al.Add(this.UserInfo.GetUserID()); //修改ID
  150. al.Add(this.UserInfo.GetUserName()); //修改人
  151. al.Add(grpCode); //组合项目代码
  152. CoreClientParam ccp = new CoreClientParam();
  153. ccp.ServerName = "QCM.QCM01.QCM0102.SavePhy";
  154. ccp.MethodName = "Save";
  155. ccp.ServerParams = new object[] { al };
  156. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  157. //if (0 != ccp.ReturnCode) return;
  158. if ("1" != ccp.ReturnObject.ToString())
  159. {
  160. MessageBox.Show(ccp.ReturnObject.ToString(), "警告");
  161. return;
  162. }
  163. this.textBox1.Text = al[0].ToString();
  164. DoQuery();
  165. MessageBox.Show("修改成功!");
  166. }
  167. catch (Exception ex)
  168. {
  169. System.Diagnostics.Debug.WriteLine(ex.ToString());
  170. MessageBox.Show("系统发生异常,请与管理员联系", "提示");
  171. }
  172. }
  173. private void DoDelete()
  174. {
  175. //删除
  176. try
  177. {
  178. if (this.UserInfo.GetUserGroup() == 0 + "")
  179. {
  180. MessageBox.Show("常白班人员禁止对数据进行操作", "警告");
  181. return;
  182. }
  183. if (this.ultraGrid1.ActiveRow.Cells.Count == 0)
  184. {
  185. MessageBox.Show("请选择要修改的数据!");
  186. return;
  187. }
  188. //选择一行数据
  189. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  190. string grpCode = ugr.Cells["PHY_GRP_CODE"].Value.ToString();
  191. if (MessageBox.Show(this, "是否确认删除?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
  192. {
  193. return;
  194. }
  195. ArrayList al = new ArrayList();
  196. al.Add(grpCode);//组合项目代码
  197. al.Add(this.UserInfo.GetUserID());
  198. al.Add(this.UserInfo.GetUserName());
  199. CoreClientParam ccp = new CoreClientParam();
  200. ccp.ServerName = "QCM.QCM01.QCM0102.removePhy";
  201. ccp.MethodName = "remove";
  202. ccp.ServerParams = new object[] {al };
  203. this.ExecuteNonQuery(ccp,CoreInvokeType.Internal);
  204. if ("1" != ccp.ReturnObject.ToString())
  205. {
  206. MessageBox.Show(ccp.ReturnObject.ToString(), "警告");
  207. return;
  208. }
  209. this.textBox1.Text = "";
  210. DoQuery();
  211. MessageBox.Show("删除成功!");
  212. }
  213. catch (Exception ex)
  214. {
  215. System.Diagnostics.Debug.WriteLine(ex.ToString());
  216. MessageBox.Show("系统发生异常,请与管理员联系", "提示");
  217. }
  218. }
  219. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  220. {
  221. this.textBox2.Text = this.ultraGrid1.ActiveRow.Cells["PHY_GRP_CODE"].Value.ToString();
  222. this.textBox3.Text = this.ultraGrid1.ActiveRow.Cells["PHY_GRP_DESC"].Value.ToString();
  223. this.textBox4.Text = this.ultraGrid1.ActiveRow.Cells["PHY_DESC_L"].Value.ToString();
  224. this.textBox5.Text = this.ultraGrid1.ActiveRow.Cells["DEFECT_TYPE_DESC"].Value.ToString();
  225. this.textBox6.Text = this.ultraGrid1.ActiveRow.Cells["MEMO"].Value.ToString();
  226. }
  227. }
  228. }