c1b1d7aaf4a35d0c220f0df05ab943027711d3b2.svn-base 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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 QCM0105 : FrmBase
  15. {
  16. public QCM0105()
  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. }
  37. }
  38. private void DoQuery()
  39. {
  40. //查询
  41. try
  42. {
  43. this.dataSet1.Tables[0].Clear();
  44. string deftDesc = this.textBox1.Text.Trim(); //缺陷描述
  45. CoreClientParam ccp = new CoreClientParam();
  46. ccp.ServerName = "QCM.QCM01.QCM0105.QueryDefect";
  47. ccp.MethodName = "Query";
  48. ccp.ServerParams = new object[] { deftDesc };
  49. ccp.SourceDataTable = this.dataSet1.Tables[0];
  50. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  51. }
  52. catch (Exception ex)
  53. {
  54. System.Diagnostics.Debug.WriteLine(ex.ToString());
  55. MessageBox.Show("系统发生异常,请与管理员联系", "提示");
  56. }
  57. }
  58. private void DoAdd()
  59. {
  60. try
  61. {
  62. if (this.UserInfo.GetUserGroup() == 0 + "")
  63. {
  64. MessageBox.Show("常白班人员禁止对数据进行操作", "警告");
  65. return;
  66. }
  67. if ("" == this.textBox2.Text || null == this.textBox2.Text)
  68. {
  69. MessageBox.Show("缺陷项目代码不能为空!", "警告");
  70. this.textBox2.Focus();
  71. return;
  72. }
  73. if (MessageBox.Show("确认保存?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  74. return;
  75. ArrayList al = new ArrayList();
  76. al.Add(this.textBox2.Text.Trim()); //缺陷项目代码
  77. al.Add(this.textBox3.Text.Trim()); //缺陷项目描述
  78. al.Add(this.textBox4.Text.Trim()); //缺陷分类描述
  79. al.Add(this.textBox5.Text.Trim()); //备注
  80. al.Add(this.UserInfo.GetUserID()); //创建人ID
  81. al.Add(this.UserInfo.GetUserName()); //创建人
  82. CoreClientParam ccp = new CoreClientParam();
  83. ccp.ServerName = "QCM.QCM01.QCM0105.addDefect";
  84. ccp.MethodName = "add";
  85. ccp.ServerParams = new object[] { al };
  86. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  87. // if (0 != ccp.ReturnCode) return;
  88. if ("1" != ccp.ReturnObject.ToString())
  89. {
  90. MessageBox.Show(ccp.ReturnObject.ToString(), "警告");
  91. return;
  92. }
  93. this.textBox1.Text = al[1].ToString();
  94. DoQuery();
  95. MessageBox.Show("创建成功!");
  96. }
  97. catch (Exception ex)
  98. {
  99. System.Diagnostics.Debug.WriteLine(ex.ToString());
  100. MessageBox.Show("系统发生异常,请与管理员联系", "提示");
  101. }
  102. }
  103. private void DoUpdate()
  104. {
  105. try
  106. {
  107. if (this.UserInfo.GetUserGroup() == 0 + "")
  108. {
  109. MessageBox.Show("常白班人员禁止对数据进行操作", "警告");
  110. return;
  111. }
  112. if (this.ultraGrid1.Selected.Rows.Count == 0)
  113. {
  114. MessageBox.Show("请选择要修改的数据!");
  115. return;
  116. }
  117. //选择一行数据
  118. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  119. string defeCode = ugr.Cells["DEFECT_CODE"].Value.ToString();
  120. if (MessageBox.Show("确认修改?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  121. return;
  122. ArrayList al = new ArrayList();
  123. al.Add(this.textBox3.Text.Trim()); //缺陷项目描述
  124. al.Add(this.textBox4.Text.Trim()); //缺陷分类描述
  125. al.Add(this.textBox5.Text.Trim()); //备注
  126. al.Add(this.UserInfo.GetUserID()); //修改人ID
  127. al.Add(this.UserInfo.GetUserName()); //修改人
  128. al.Add(defeCode); //缺陷项目代码
  129. CoreClientParam ccp = new CoreClientParam();
  130. ccp.ServerName = "QCM.QCM01.QCM0105.SaveDefect";
  131. ccp.MethodName = "Save";
  132. ccp.ServerParams = new object[] { al };
  133. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  134. //if (0 != ccp.ReturnCode) return;
  135. if ("1" != ccp.ReturnObject.ToString())
  136. {
  137. MessageBox.Show(ccp.ReturnObject.ToString(), "警告");
  138. return;
  139. }
  140. this.textBox1.Text = al[0].ToString();
  141. DoQuery();
  142. MessageBox.Show("修改成功!");
  143. }
  144. catch (Exception ex)
  145. {
  146. System.Diagnostics.Debug.WriteLine(ex.ToString());
  147. MessageBox.Show("系统发生异常,请与管理员联系", "提示");
  148. }
  149. }
  150. private void DoDelete()
  151. {
  152. try
  153. {
  154. if (this.UserInfo.GetUserGroup() == 0 + "")
  155. {
  156. MessageBox.Show("常白班人员禁止对数据进行操作", "警告");
  157. return;
  158. }
  159. if (this.ultraGrid1.ActiveRow.Cells.Count == 0)
  160. {
  161. MessageBox.Show("请选择要修改的数据!");
  162. return;
  163. }
  164. //选择一行数据
  165. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  166. string defeCode = ugr.Cells["DEFECT_CODE"].Value.ToString();
  167. if (MessageBox.Show(this, "是否确认删除?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
  168. {
  169. return;
  170. }
  171. ArrayList al = new ArrayList();
  172. al.Add(defeCode); //缺陷项目代码
  173. al.Add(this.UserInfo.GetUserID()); //删除人ID
  174. al.Add(this.UserInfo.GetUserName());//删除人
  175. CoreClientParam ccp = new CoreClientParam();
  176. ccp.ServerName = "QCM.QCM01.QCM0105.removeDefect";
  177. ccp.MethodName = "remove";
  178. ccp.ServerParams = new object[] { al };
  179. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  180. if ("1" != ccp.ReturnObject.ToString())
  181. {
  182. MessageBox.Show(ccp.ReturnObject.ToString(), "警告");
  183. return;
  184. }
  185. DoQuery();
  186. MessageBox.Show("删除成功!");
  187. }
  188. catch (Exception ex)
  189. {
  190. System.Diagnostics.Debug.WriteLine(ex.ToString());
  191. MessageBox.Show("系统发生异常,请与管理员联系", "提示");
  192. }
  193. }
  194. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  195. {
  196. this.textBox2.Text = this.ultraGrid1.ActiveRow.Cells["DEFECT_CODE"].Value.ToString();
  197. this.textBox3.Text = this.ultraGrid1.ActiveRow.Cells["DEFECT_DESC"].Value.ToString();
  198. this.textBox4.Text = this.ultraGrid1.ActiveRow.Cells["DEFECT_TYPE_DESC"].Value.ToString();
  199. this.textBox5.Text = this.ultraGrid1.ActiveRow.Cells["MEMO"].Value.ToString();
  200. }
  201. }
  202. }