UIB030171.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 System.Diagnostics;
  12. using Infragistics.Win.UltraWinGrid;
  13. namespace Core.LZMes.Client.UIB
  14. {
  15. public partial class UIB030171 : FrmBase
  16. {
  17. public UIB030171()
  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 "Export":
  29. this.DoExport();
  30. break;
  31. }
  32. }
  33. public void DoQuery()
  34. {
  35. try
  36. {
  37. ArrayList al = new ArrayList();
  38. al.Add("UIB030171_01.SELECT");
  39. al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") + "000000");
  40. al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") + "999999");
  41. al.Add(this.textBox1.Text.ToString());
  42. al.Add(this.textBox2.Text.ToString());
  43. al.Add(this.textBox3.Text.ToString());
  44. //查成信息条件
  45. al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") + "000000");
  46. al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") + "999999");
  47. al.Add(this.textBox1.Text.ToString());
  48. al.Add(this.textBox2.Text.ToString());
  49. al.Add(this.textBox3.Text.ToString());
  50. this.dataSet1.Tables[0].Clear();
  51. CoreClientParam ccp = new CoreClientParam();
  52. ccp.ServerName = "UIB.COM.ComDBQuery";
  53. ccp.MethodName = "doSimpleQuery";
  54. ccp.ServerParams = new object[] { al };
  55. ccp.SourceDataTable = this.dataSet1.Tables[0];
  56. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  57. decimal m = 0, n = 0;
  58. //DataRowCollection drs = this.dataSet1.Tables[0].Rows;
  59. //for (int i = 0; i < drs.Count; i++)
  60. //{
  61. // string check = drs[i]["CHECKNO"].ToString();
  62. // if(check == "N")
  63. // {
  64. // ultraGrid1.Rows[i].Appearance.BackColor = Color.Red;
  65. // n=n+1;
  66. // }
  67. // m=m+1;
  68. //}
  69. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  70. {
  71. if (ugr.Cells["CHECKNO"].Text == "N")
  72. {
  73. //ugr.Appearance.BackColor = Color.Red;
  74. ugr.RowSelectorAppearance.BackColor = Color.Red;
  75. n = n + 1;
  76. }
  77. m = m + 1;
  78. }
  79. string baid = (n / m * 100).ToString().Substring(0, 4) + "%";
  80. DataRow dr = this.dataSet1.Tables[0].NewRow();
  81. dr.ItemArray = new object[] { "总卷数", m, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "不合格卷数", "不合格率", baid, "", "", "", "", n };
  82. this.dataSet1.Tables[0].Rows.Add(dr);
  83. this.dataSet1.Tables[0].AcceptChanges();
  84. this.ultraGrid1.Update();
  85. }
  86. catch (Exception ex)
  87. {
  88. }
  89. }
  90. public void DoExport()
  91. {
  92. try
  93. {
  94. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  95. {
  96. string fName = this.saveFileDialog1.FileName;
  97. this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName);
  98. Process.Start(fName);
  99. }
  100. }
  101. catch (Exception ex)
  102. {
  103. System.Diagnostics.Debug.WriteLine(ex.ToString());
  104. }
  105. }
  106. }
  107. }