using System; using System.Collections; 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; namespace Core.LZMes.Client.UIK.UIK01 { public partial class UIK010070 : FrmBase { public UIK010070() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query"://查询 this.DoQuery(); break; case "Insert"://添加连退平整液检验实绩 this.DoInsert(); break; case "Update"://修改 this.DoUpdate(); break; } } private void DoQuery() { try { string starttiem = (this.ultraCalendarSTRATTIME.Value == System.DBNull.Value || ultraCalendarSTRATTIME.Value.ToString() == "") ? "" : ((DateTime)ultraCalendarSTRATTIME.Value).ToString("yyyyMMdd"); string endtime = (this.ultraCalendarENDTIME.Value == System.DBNull.Value || ultraCalendarENDTIME.Value.ToString() == "") ? "" : ((DateTime)ultraCalendarENDTIME.Value).ToString("yyyyMMdd"); bool flag = false; CoreClientParam ccp = new CoreClientParam(); if (!this.ultraCheckEditor1.Checked && !this.ultraCheckAll.Checked) { MessageBox.Show("请选择查询条件!"); } else { if (this.ultraCheckAll.Checked) { this.dataSet1.Tables[0].Clear(); ccp.ServerName = "UIK.UIK01.UIK010070"; ccp.MethodName = "DoQuery"; ccp.ServerParams = new object[] { starttiem, endtime, flag }; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); DataRowCollection drc = this.dataSet1.Tables[0].Rows; if (drc.Count <= 0) { MessageBox.Show("暂无连退平整液记录!"); } return; } if (this.ultraCheckEditor1.Checked) { flag = true; this.dataSet1.Tables[0].Clear(); ccp.ServerName = "UIK.UIK01.UIK010070"; ccp.MethodName = "DoQuery"; ccp.ServerParams = new object[] { starttiem, endtime, flag }; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); DataRowCollection drc = this.dataSet1.Tables[0].Rows; if (drc.Count <= 0) { MessageBox.Show("暂无连退平整液记录!"); } } } } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } } private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e) { if (ultraCheckEditor1.Checked) { this.ultraCalendarENDTIME.Enabled = true; this.ultraCalendarSTRATTIME.Enabled = true; this.ultraCheckAll.Checked = false; } else { this.ultraCalendarENDTIME.Enabled = false; this.ultraCalendarSTRATTIME.Enabled = false; } } private void ultraCheckAll_CheckedChanged(object sender, EventArgs e) { if (this.ultraCheckAll.Checked) { this.ultraCheckEditor1.Checked = false; this.ultraCalendarSTRATTIME.Enabled = false; this.ultraCalendarENDTIME.Enabled = false; } } private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { ultraGrid1.UpdateData(); if (e.Cell.Column.Key == "CHK") { if (Convert.ToBoolean(e.Cell.Value)) { string recordId = e.Cell.Row.Cells["RECORD_ID"].Text.Trim(); /*for循环控制单选*/ int i = ultraGrid1.Rows.Count; for (int j = 0; j < i; j++) { if (ultraGrid1.Rows[j].Cells["RECORD_ID"].Text.Trim() != recordId) { ultraGrid1.Rows[j].Cells["CHK"].Value = false; } } textBox1.Text = e.Cell.Row.Cells["RECORD_ID"].Text.Trim(); textBox2.Text = e.Cell.Row.Cells["SPA_CCT"].Text.Trim(); textBox3.Text = e.Cell.Row.Cells["SPA_CDT"].Text.Trim(); textBox4.Text = e.Cell.Row.Cells["NAOH_CON_1"].Text.Trim(); textBox5.Text = e.Cell.Row.Cells["FE_CON_1"].Text.Trim(); textBox6.Text = e.Cell.Row.Cells["OIL_CON_1"].Text.Trim(); textBox7.Text = e.Cell.Row.Cells["CDT_1"].Text.Trim(); textBox8.Text = e.Cell.Row.Cells["AKL_CCT_1"].Text.Trim(); textBox9.Text = e.Cell.Row.Cells["NAOH_CON_2"].Text.Trim(); textBox10.Text = e.Cell.Row.Cells["FE_CON_2"].Text.Trim(); textBox11.Text = e.Cell.Row.Cells["OIL_CON_2"].Text.Trim(); textBox12.Text = e.Cell.Row.Cells["CDT_2"].Text.Trim(); textBox13.Text = e.Cell.Row.Cells["AKL_CCT_2"].Text.Trim(); textBox14.Text = e.Cell.Row.Cells["SAM_ADDRESS"].Text.Trim(); textBox15.Text = e.Cell.Row.Cells["SAM_TIME"].Text.Trim(); textBox16.Text = e.Cell.Row.Cells["PH_CON_3"].Text.Trim(); textBox17.Text = e.Cell.Row.Cells["CL_CON_3"].Text.Trim(); textBox18.Text = e.Cell.Row.Cells["PH_CON4"].Text.Trim(); textBox19.Text = e.Cell.Row.Cells["IR_CON4"].Text.Trim(); samdate.Value = DateTime.ParseExact(e.Cell.Row.Cells["SAM_DATE"].Text.Trim(),"yyyyMMdd",System.Globalization.CultureInfo.CurrentCulture); } else { ResetEditControl(); } } } private void UIK010070_Load(object sender, EventArgs e) { this.ultraCheckEditor1.Checked = true; } private void DoUpdate() { if (MessageBox.Show("您确认要修改?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { try { Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow; if (Convert.ToBoolean(ugr.Cells["CHK"].Value)) { ArrayList args = new ArrayList(); args.Add(textBox2.Text.Trim()); args.Add(textBox3.Text.Trim()); args.Add(textBox4.Text.Trim()); args.Add(textBox5.Text.Trim()); args.Add(textBox6.Text.Trim()); args.Add(textBox7.Text.Trim()); args.Add(textBox8.Text.Trim()); args.Add(textBox9.Text.Trim()); args.Add(textBox10.Text.Trim()); args.Add(textBox11.Text.Trim()); args.Add(textBox12.Text.Trim()); args.Add(textBox13.Text.Trim()); args.Add(((DateTime)samdate.Value).ToString("yyyyMMdd")); args.Add(textBox14.Text.Trim());//取样地点 args.Add(textBox15.Text.Trim());//取样时间 args.Add(textBox16.Text.Trim()); args.Add(textBox17.Text.Trim()); args.Add(textBox18.Text.Trim()); args.Add(textBox19.Text.Trim()); args.Add(textBox1.Text.Trim()); CoreClientParam ccp2 = new CoreClientParam(); ccp2.ServerName = "UIK.UIK01.UIK010070"; ccp2.MethodName = "DoUpdate"; ccp2.ServerParams = new object[] {args }; ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal); if (0 != ccp2.ReturnCode) { MessageBox.Show("修改失败!"); } else { MessageBox.Show("修改成功!"); ResetEditControl(); this.DoQuery(); } } else { MessageBox.Show("请选择修改行!"); } } catch (Exception Ex) { MessageBox.Show(Ex.ToString()); } } } private void DoInsert() { if (MessageBox.Show("您确认要添加信息吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { ArrayList args = new ArrayList(); args.Add(textBox2.Text.Trim()); args.Add(textBox3.Text.Trim()); args.Add(textBox4.Text.Trim()); args.Add(textBox5.Text.Trim()); args.Add(textBox6.Text.Trim()); args.Add(textBox7.Text.Trim()); args.Add(textBox8.Text.Trim()); args.Add(textBox9.Text.Trim()); args.Add(textBox10.Text.Trim()); args.Add(textBox11.Text.Trim()); args.Add(textBox12.Text.Trim()); args.Add(textBox13.Text.Trim()); args.Add(textBox14.Text.Trim()); args.Add(((DateTime)samdate.Value).ToString("yyyyMMdd")); args.Add(textBox15.Text.Trim()); args.Add(textBox16.Text.Trim()); args.Add(textBox17.Text.Trim()); args.Add(textBox18.Text.Trim()); args.Add(textBox19.Text.Trim()); args.Add(UserInfo.GetUserName()); CoreClientParam ccp2 = new CoreClientParam(); ccp2.ServerName = "UIK.UIK01.UIK010070"; ccp2.MethodName = "DoInsert"; ccp2.ServerParams = new object[] { args }; ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal); if (0 != ccp2.ReturnCode) { MessageBox.Show("添加失败!"); } else { MessageBox.Show("添加成功!"); ResetEditControl(); this.DoQuery(); } } } private void ResetEditControl() { textBox1.Clear(); this.textBox2.Clear(); this.textBox4.Clear(); this.textBox3.Clear(); this.textBox5.Clear(); this.textBox6.Clear(); this.textBox7.Clear(); this.textBox8.Clear(); this.textBox9.Clear(); this.textBox10.Clear(); this.textBox11.Clear(); this.textBox12.Clear(); this.textBox13.Clear(); this.textBox14.Clear(); this.textBox15.Clear(); this.textBox16.Clear(); this.textBox17.Clear(); samdate.Value = DateTime.Today; } } }