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 Infragistics.Win.UltraWinGrid; namespace Core.LZMes.Client.UIK { public partial class UIK040030 : FrmBase { public UIK040030() { InitializeComponent(); } #region "ToolBar Event" public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Save": this.Save(); this.DoQuery(); break; case "Delete": this.doDelete(); this.DoQuery(); break; case "Export": this.DoExport(); break; } } string strDtime = null; private void DoQuery() { try { //if (this.checkBox1.Checked) //{ strDtime = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd"); //} //else //{ // //strDtime = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMM");//默认为当月 // strDtime = ""; //} this.dataSet1.Tables[0].Clear(); ArrayList al = new ArrayList(); al.Add("UIK040030_01.SELECT"); al.Add(strDtime); al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd")); //al.Add(this.textArea.Text.ToString().Trim()); //al.Add(this.textMainMc.Text.ToString().Trim()); //al.Add(this.ComboGZYY.Text.ToString()); //al.Add(strDtime); //al.Add(this.textBox1.Text.ToString()); //al.Add(this.textBox1.Text.ToString()); //al.Add(this.textBox1.Text.ToString()); //al.Add(this.textBox1.Text.ToString()); //al.Add(this.textBox1.Text.ToString()); //al.Add(this.textBox1.Text.ToString()); //if (this.ComboZRBM.Text.ToString()== "机械") //{ // al.Add("True"); //} //else //{ // al.Add(""); //} // if(this.ComboZRBM.Text.ToString() == "液压") //{ // al.Add("True"); //} // else // { // al.Add(""); //} // if(this.ComboZRBM.Text.ToString() == "电气") // { // al.Add("True"); // } // else // { // al.Add(""); //} // if(this.ComboZRBM.Text.ToString() == "自动化") // { // al.Add("True"); // } // else // { // al.Add(""); //} // if(this.ComboZRBM.Text.ToString() == "操作") // { // al.Add("True"); // } // else // { // al.Add(""); //} // if (this.ComboZRBM.Text.ToString() == "外因") // { // al.Add("True"); // } // else // { // al.Add(""); //} // al.Add(this.comboBox1.SelectedValue.ToString()); 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); } catch (Exception EX) { MessageBox.Show(EX.ToString()); } } public void Save() { try { ArrayList list = null; int i = 0; string GZ_TIME_FR_Time = null; string GZ_TIME_TO_Time = null; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["CHK"].Text.ToString() == "True") { if (ugr.Cells["SEQ_NO"].Text == "")//insert { i++; list = new ArrayList(); //list.Add("UIK040030_01.INSERT"); //list.Add(ugr.Cells["AREA"].Text.ToString()); //list.Add(ugr.Cells["MC_ID"].Text.ToString()); //list.Add(ugr.Cells["MC_NAME"].Text.ToString()); //GZ_TIME_FR_Time = Convert.ToDateTime(ugr.Cells["GZ_TIME_FR"].Text.ToString()).ToString("yyyyMMdd");// string.Format("{0:yyyyMMdd}" , ); //list.Add(GZ_TIME_FR_Time); //list.Add(ugr.Cells["GZ_TIME_FR"].Text.ToString()); //GZ_TIME_TO_Time = Convert.ToDateTime(ugr.Cells["GZ_TIME_TO"].Text.ToString()).ToString("yyyyMMdd");//this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd");//string.Format("{0:yyyyMMdd}", ); //list.Add(GZ_TIME_TO_Time); // list.Add(ugr.Cells["GZ_TIME_TO"].Text.ToString()); // list.Add(ugr.Cells["GZ_LRR"].Text.ToString()); //list.Add(this.UserInfo.GetUserName().ToString());//录入人 //list.Add(ugr.Cells["GZ_LR_SJ"].Text.ToString()); //list.Add(ugr.Cells["GZ_YY"].Text.ToString()); //list.Add(ugr.Cells["GZ_BM_JX"].Text.ToString()); //list.Add(ugr.Cells["GZ_BM_YY"].Text.ToString()); //list.Add(ugr.Cells["GZ_BM_DQ"].Text.ToString()); //list.Add(ugr.Cells["GZ_BM_ZDH"].Text.ToString()); //list.Add(ugr.Cells["GZ_BM_CZ"].Text.ToString()); //list.Add(ugr.Cells["GZ_BM_WY"].Text.ToString()); //list.Add(ugr.Cells["JX_ZRR"].Text.ToString()); //list.Add(ugr.Cells["YY_ZRR"].Text.ToString()); //list.Add(ugr.Cells["DQ_ZRR"].Text.ToString()); //list.Add(ugr.Cells["ZDH_ZRR"].Text.ToString()); //list.Add(ugr.Cells["CZ_ZRR"].Text.ToString()); //list.Add(ugr.Cells["WY_ZRR"].Text.ToString()); //list.Add(ugr.Cells["BZ"].Text.ToString()); //list.Add(Convert.ToString(i)); //list.Add(ugr.Cells["GZ_BM_ESY"].Text.ToString()); //list.Add(ugr.Cells["GZ_BM_BY"].Text.ToString()); //list.Add(ugr.Cells["ESY_ZRR"].Text.ToString()); //list.Add(ugr.Cells["BY_ZRR"].Text.ToString()); //list.Add(ugr.Cells["seq_no"].Text.ToString()); list.Add("UIK040030_01.INSERT"); list.Add(Convert.ToString(i)); list.Add(ugr.Cells["GZ_TIME_FR"].Text.ToString()); list.Add(ugr.Cells["BC"].Text.ToString()); list.Add(ugr.Cells["GZ_TIME_TO"].Text.ToString()); list.Add(ugr.Cells["YCSJ"].Text.ToString()); list.Add(ugr.Cells["BZ"].Text.ToString()); list.Add(ugr.Cells["GZYY_CJ1"].Text.ToString()); list.Add(ugr.Cells["GZYY_CJ2"].Text.ToString()); list.Add(ugr.Cells["GZYY_CJ3"].Text.ToString()); list.Add(ugr.Cells["GZYY_CJ4"].Text.ToString()); list.Add(ugr.Cells["GZYY_CJ5"].Text.ToString()); list.Add(ugr.Cells["GZYY_CJ6"].Text.ToString()); list.Add(ugr.Cells["GZYY_CJ7"].Text.ToString()); list.Add(ugr.Cells["GZYY_CJ8"].Text.ToString()); list.Add(ugr.Cells["GZYY_CJ9"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_YY1"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_YY2"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_JX1"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_JX2"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_JX3"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_JX4"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_JX5"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_JX6"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_CD1"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_CD2"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_CD3"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_ZDH1"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_ZDH2"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_ZDH3"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_ZDH4"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_ZDH5"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_ESY1"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_ESY2"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_EJ1"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_CJ1"].Text.ToString()); list.Add(this.UserInfo.GetUserName().ToString());//录入人 //list.Add(ugr.Cells["GZ_LR_SJ"].Text.ToString()); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBSave"; ccp.ServerParams = new object[] { list }; ccp.MethodName = "doXmlSave"; this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); } else//update { list = new ArrayList(); list.Add("UIK040030_01.UPDATE"); //list.Add(ugr.Cells["GZ_TIME_FR"].Text.ToString()); //GZ_TIME_FR_Time = Convert.ToDateTime(ugr.Cells["GZ_TIME_FR"].Text.ToString()).ToString("yyyyMMdd"); list.Add(ugr.Cells["GZ_TIME_FR"].Text.ToString()); list.Add(ugr.Cells["BC"].Text.ToString()); list.Add(ugr.Cells["GZ_TIME_TO"].Text.ToString()); list.Add(ugr.Cells["YCSJ"].Text.ToString()); //GZ_TIME_TO_Time = Convert.ToDateTime(ugr.Cells["GZ_TIME_TO"].Text.ToString()).ToString("yyyyMMdd");//this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd");//string.Format("{0:yyyyMMdd}", ); //list.Add(GZ_TIME_TO_Time); list.Add(ugr.Cells["BZ"].Text.ToString()); //list.Add(ugr.Cells["GZ_TIME_FR"].Text.ToString()); //list.Add(ugr.Cells["GZ_TIME_TO"].Text.ToString()); //list.Add(ugr.Cells["GZ_LRR"].Text.ToString()); //list.Add(ugr.Cells["GZ_LR_SJ"].Text.ToString()); list.Add(ugr.Cells["GZYY_CJ1"].Text.ToString()); list.Add(ugr.Cells["GZYY_CJ2"].Text.ToString()); list.Add(ugr.Cells["GZYY_CJ3"].Text.ToString()); list.Add(ugr.Cells["GZYY_CJ4"].Text.ToString()); list.Add(ugr.Cells["GZYY_CJ5"].Text.ToString()); list.Add(ugr.Cells["GZYY_CJ6"].Text.ToString()); list.Add(ugr.Cells["GZYY_CJ7"].Text.ToString()); list.Add(ugr.Cells["GZYY_CJ8"].Text.ToString()); list.Add(ugr.Cells["GZYY_CJ9"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_YY1"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_YY2"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_JX1"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_JX2"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_JX3"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_JX4"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_JX5"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_JX6"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_CD1"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_CD2"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_CD3"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_ZDH1"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_ZDH2"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_ZDH3"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_ZDH4"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_ZDH5"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_ESY1"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_ESY2"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_EJ1"].Text.ToString()); list.Add(ugr.Cells["GZ_BM_CJ1"].Text.ToString()); list.Add(this.UserInfo.GetUserName().ToString());//录入人 list.Add(ugr.Cells["SEQ_NO"].Text.ToString()); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBSave"; ccp.ServerParams = new object[] { list }; ccp.MethodName = "doXmlSave"; this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); } } } } catch (Exception ex) { } } public void doDelete() { try { if (MessageBox.Show("确定删除?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; ArrayList list = null; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["CHK"].Text.ToString() == "True") { list = new ArrayList(); list.Add("UIK040030_01.DELETE"); list.Add(ugr.Cells["SEQ_NO"].Text.ToString()); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBSave"; ccp.ServerParams = new object[] { list }; ccp.MethodName = "doXmlSave"; this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); } } } catch (Exception ex) { } } private void DoExport() { try { if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK) { string fileName = this.saveFileDialog1.FileName; ultraGridExcelExporter1.Export(ultraGrid1, fileName); //System.Diagnostics.Process.Start(fileName); } } catch (Exception EX) { MessageBox.Show(EX.ToString()); } } #endregion #region "Init" public void init() { string commCodeCd = "K04003,K04004"; DataTable dt = new DataTable(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBQuery"; ccp.MethodName = "doSimpleQuery"; ArrayList paramArray = new ArrayList(); paramArray.Add("UIECOMM00_SELECT.COMM_CODE"); paramArray.Add(commCodeCd); ccp.ServerParams = new object[] { paramArray }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); //Core.LZMes.Client.UIE.UIE041.UIEBase.Init_ComboControl(this.ComboGZYY, ref dt, "K04003"); //Core.LZMes.Client.UIE.UIE041.UIEBase.Init_ComboControl(this.ComboZRBM, ref dt, "K04004"); } private void UIK040030_Load(object sender, EventArgs e) { init(); //this.checkBox1.Checked = false; //this.ultraDateTimeEditor1.Enabled = false; } #endregion private void checkBox1_CheckedChanged(object sender, EventArgs e) { try { //if (this.checkBox1.Checked) //{ // this.ultraDateTimeEditor1.Enabled = true; //} //else //{ // this.ultraDateTimeEditor1.Enabled = false; //} } catch (Exception ex) { } } } }