UIB100103.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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 Infragistics.Win.UltraWinGrid;
  11. using System.Collections;
  12. using System.Diagnostics;
  13. namespace Core.LZMes.Client.UIB
  14. {
  15. public partial class UIB100103 : FrmBase
  16. {
  17. public UIB100103()
  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 "Save":
  29. this.DoSave();
  30. break;
  31. case "Delete":
  32. this.DoDelete();
  33. break;
  34. }
  35. }
  36. public void DoQuery()
  37. {
  38. try
  39. {
  40. ArrayList al = new ArrayList();
  41. al.Add("UIB100103_01.SELECT");
  42. al.Add(this.textBox1.Text.Trim());
  43. this.dataSet1.Tables[0].Clear();
  44. CoreClientParam ccp = new CoreClientParam();
  45. ccp.ServerName = "UIB.JHY.JHYComQuery";
  46. ccp.MethodName = "doSimpleQuery";
  47. ccp.ServerParams = new object[] { al };
  48. ccp.SourceDataTable = this.dataSet1.Tables[0];
  49. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  50. }
  51. catch (Exception ex)
  52. {
  53. }
  54. }
  55. public void DoSave()
  56. {
  57. try
  58. {
  59. if (MessageBox.Show("确定保存?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  60. return;
  61. ArrayList al = null;
  62. ArrayList list = new ArrayList();
  63. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  64. {
  65. if (Convert.ToBoolean(ugr.Cells["CHK"].Text))
  66. {
  67. al = new ArrayList();
  68. if (ugr.Cells["LG_CD_1"].Text != "")//修改
  69. {
  70. al.Add("UIB100103_01.UPDATE");
  71. al.Add(ugr.Cells["LG_CD"].Text.ToString());
  72. al.Add(ugr.Cells["SM_CD"].Text.ToString());
  73. al.Add(ugr.Cells["LG_NM"].Text.ToString());
  74. al.Add(ugr.Cells["SM_CFNM"].Text.ToString());
  75. al.Add(ugr.Cells["CD_SEQ"].Text.ToString());
  76. al.Add(ugr.Cells["USED_YN"].Text.ToString());
  77. al.Add(ugr.Cells["CD_DESC"].Text.ToString());
  78. al.Add(ugr.Cells["EDIT_TP"].Text.ToString());
  79. al.Add(this.UserInfo.GetUserName());
  80. al.Add(ugr.Cells["LG_CD_1"].Text.ToString());
  81. al.Add(ugr.Cells["SM_CD_1"].Text.ToString());
  82. }
  83. else//增加
  84. {
  85. al.Add("UIB100103_01.INSERT");
  86. al.Add(ugr.Cells["LG_CD"].Text.ToString());
  87. al.Add(ugr.Cells["SM_CD"].Text.ToString());
  88. al.Add(ugr.Cells["LG_NM"].Text.ToString());
  89. al.Add(ugr.Cells["SM_CFNM"].Text.ToString());
  90. al.Add(ugr.Cells["CD_SEQ"].Text.ToString());
  91. al.Add(ugr.Cells["USED_YN"].Text.ToString());
  92. al.Add(ugr.Cells["CD_DESC"].Text.ToString());
  93. al.Add(ugr.Cells["EDIT_TP"].Text.ToString());
  94. al.Add(this.UserInfo.GetUserName());
  95. }//if end
  96. list.Add(al);
  97. }//if end
  98. }//for end
  99. if (list.Count == 0) return;
  100. CoreClientParam ccp = new CoreClientParam();
  101. ccp.ServerName = "UIB.JHY.JHYComSave";
  102. ccp.MethodName = "doSimpleSave";
  103. ccp.ServerParams = new object[] { list };
  104. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  105. this.DoQuery();
  106. }
  107. catch (Exception ex)
  108. {
  109. }
  110. }
  111. public void DoDelete()
  112. {
  113. try
  114. {
  115. if (MessageBox.Show("确定删除?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  116. return;
  117. ArrayList list = new ArrayList();
  118. ArrayList al = null;
  119. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  120. {
  121. if (Convert.ToBoolean(ugr.Cells["CHK"].Text))
  122. {
  123. al = new ArrayList();
  124. al.Add("UIB100103_01.DELETE");
  125. al.Add(ugr.Cells["LG_CD"].Text);
  126. al.Add(ugr.Cells["SM_CD"].Text);
  127. list.Add(al);
  128. }
  129. }
  130. if (list.Count == 0) return;
  131. CoreClientParam ccp = new CoreClientParam();
  132. ccp.ServerName = "UIB.JHY.JHYComSave";
  133. ccp.MethodName = "doSimpleSave";
  134. ccp.ServerParams = new object[] { list };
  135. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  136. this.DoQuery();
  137. }
  138. catch (Exception ex)
  139. {
  140. }
  141. }
  142. }
  143. }