using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using CoreFS.CA06; using System.Collections; using System.Diagnostics; using Infragistics.Win.UltraWinGrid; namespace Core.LZMes.Client.UIB { public partial class UIB030171 : FrmBase { public UIB030171() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Export": this.DoExport(); break; } } public void DoQuery() { try { ArrayList al = new ArrayList(); al.Add("UIB030171_01.SELECT"); al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") + "000000"); al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") + "999999"); al.Add(this.textBox1.Text.ToString()); al.Add(this.textBox2.Text.ToString()); al.Add(this.textBox3.Text.ToString()); //查成信息条件 al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") + "000000"); al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") + "999999"); al.Add(this.textBox1.Text.ToString()); al.Add(this.textBox2.Text.ToString()); al.Add(this.textBox3.Text.ToString()); this.dataSet1.Tables[0].Clear(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); decimal m = 0, n = 0; //DataRowCollection drs = this.dataSet1.Tables[0].Rows; //for (int i = 0; i < drs.Count; i++) //{ // string check = drs[i]["CHECKNO"].ToString(); // if(check == "N") // { // ultraGrid1.Rows[i].Appearance.BackColor = Color.Red; // n=n+1; // } // m=m+1; //} foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["CHECKNO"].Text == "N") { //ugr.Appearance.BackColor = Color.Red; ugr.RowSelectorAppearance.BackColor = Color.Red; n = n + 1; } m = m + 1; } string baid = (n / m * 100).ToString().Substring(0, 4) + "%"; DataRow dr = this.dataSet1.Tables[0].NewRow(); dr.ItemArray = new object[] { "总卷数", m, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "不合格卷数", "不合格率", baid, "", "", "", "", n }; this.dataSet1.Tables[0].Rows.Add(dr); this.dataSet1.Tables[0].AcceptChanges(); this.ultraGrid1.Update(); } catch (Exception ex) { } } public void DoExport() { try { if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK) { string fName = this.saveFileDialog1.FileName; this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName); Process.Start(fName); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } } }