using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using Infragistics.Win.UltraWinGrid; using System.Collections; using System.Windows.Forms; using CoreFS.CA06; namespace Core.LZMes.Client.UIB { public partial class UIB010321 : FrmBase { public UIB010321() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "query": this.DoQuery(); break; case "save": this.DoSave(); break; case "delete": this.DoDelete(); break; } } //初始化下拉框数据 public void init() { DataTable dt = new DataTable(); ArrayList al = new ArrayList(); al.Add("UIB010321_01.INITSELECT"); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); Init_ComboControl(this.ultraComboEditor1, ref dt); //DoQuery(); //DataTable dt = new DataTable(); //CoreClientParam ccp = new CoreClientParam(); //dt = new DataTable(); //ccp = new CoreClientParam(); //ccp.ServerName = "UIB.COM.ComDBQuery"; //ccp.MethodName = "doSimpleQuery"; //paramArray = new ArrayList(); //paramArray.Add("UIECOMM00_SELECT.C_STL_GRD"); //ccp.ServerParams = new object[] { paramArray }; //ccp.SourceDataTable = dt; //this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); //Core.LZMes.Client.UIE.UIE041.UIEBase.Init_ComboControl(this.ComboColdStlGrd, ref dt, "C_STL_GRD"); //dt = new DataTable(); //ccp = new CoreClientParam(); //ccp.ServerName = "UIB.COM.ComDBQuery"; //ccp.MethodName = "doSimpleQuery"; //paramArray = new ArrayList(); //paramArray.Add("UIECOMM00_SELECT.H_STL_GRD"); //ccp.ServerParams = new object[] { paramArray }; //ccp.SourceDataTable = dt; //this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); //Core.LZMes.Client.UIE.UIE041.UIEBase.Init_ComboControl(this.ComboHotStlGrd, ref dt, "H_STL_GRD"); } public void DoQuery() { try { this.dataSet1.Tables[0].Clear(); string type = "", Vtype = ""; type = this.ultraComboEditor3.Text.Trim().ToString(); if (type == "平整模式") Vtype = "PZ"; else if (type == "拉矫模式") Vtype = "LJ"; else Vtype = "LJL"; ArrayList al = new ArrayList(); al.Add("UIB010321_01.SELECT"); al.Add(Vtype); 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); type = ""; }catch(Exception ex) { MessageBox.Show(ex.ToString()); } } //public void DoInsert() //{ // try // { // int num = this.ultraGrid1.Rows.Count; // this.ultraGrid1.Rows[num - 1].Cells["DISPLAY_SEQ"].Value.ToString(); // this.ultraGrid1.Rows[num - 1].Cells["PROD_TYPE"].Text.ToString(); // this.ultraGrid1.Rows[num - 1].Cells["PROD_CD_CFNM"].Text.ToString(); // this.ultraGrid1.Rows[num - 1].Cells["DCS_SYM"].Text.ToString(); // } // catch (Exception ex) // { // MessageBox.Show(ex.ToString()); // } //} public void DoSave() { try { if (MessageBox.Show("确定保存?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; ArrayList al = new ArrayList(); ArrayList list = null; string type = "",Vtype=""; type = this.ultraComboEditor3.Text.Trim().ToString(); if (type == "平整模式") Vtype = "PZ"; else if (type == "拉矫模式") Vtype = "LJ"; else Vtype = "LJL"; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["CHK"].Text == "True") { if (ugr.Cells["STL_GRD"].Text.ToString() == "") { MessageBox.Show("牌号不允许为空!", "提示"); return; } list = new ArrayList(); if (ugr.Cells["EDIT_TYPE"].Text == "")//插入 { list.Add("UIB010321_01.INSERT"); list.Add(ugr.Cells["STL_GRD"].Text.ToString()); list.Add(Vtype); //list.Add(ugr.Cells["DAT_TYPE"].Text.ToString()); list.Add(ugr.Cells["ROOM1"].Text.ToString()); list.Add(ugr.Cells["ROOM2"].Text.ToString()); list.Add(ugr.Cells["ROOM3"].Text.ToString()); list.Add(ugr.Cells["ROOM4"].Text.ToString()); list.Add(ugr.Cells["ROOM5"].Text.ToString()); list.Add(ugr.Cells["ROOM6"].Text.ToString()); list.Add(ugr.Cells["ROOM7"].Text.ToString()); list.Add(ugr.Cells["ROOM8"].Text.ToString()); list.Add(ugr.Cells["ROOM9"].Text.ToString()); list.Add(ugr.Cells["ROOM10"].Text.ToString()); list.Add(ugr.Cells["ROOM11"].Text.ToString()); list.Add(ugr.Cells["ROOM12"].Text.ToString()); list.Add(ugr.Cells["ROOM13"].Text.ToString()); list.Add(ugr.Cells["ROOM14"].Text.ToString()); list.Add(ugr.Cells["ROOM15"].Text.ToString()); list.Add(ugr.Cells["ROOM16"].Text.ToString()); list.Add(ugr.Cells["ROOM17"].Text.ToString()); list.Add(ugr.Cells["ROOM18"].Text.ToString()); //list.Add(this.UserInfo.GetUserName()); } else//更新 { list.Add("UIB010321_01.UPDATE"); list.Add(ugr.Cells["STL_GRD"].Text.ToString()); list.Add(ugr.Cells["DAT_TYPE"].Text.ToString()); list.Add(ugr.Cells["ROOM1"].Text.ToString()); list.Add(ugr.Cells["ROOM2"].Text.ToString()); list.Add(ugr.Cells["ROOM3"].Text.ToString()); } al.Add(list); } } if (al.Count == 0) { MessageBox.Show("请勾选数据再做保存操作!", "提示"); return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBSave"; ccp.MethodName = "doXmlSave"; ccp.ServerParams = new object[] { al }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.DoQuery(); type = ""; Vtype = ""; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } public void DoDelete() { try { if (MessageBox.Show("确定删除?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; ArrayList al = new ArrayList(); ArrayList list = null; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["CHK"].Text == "True") { list = new ArrayList(); list.Add("UIB010320_01.DELETE"); list.Add(ugr.Cells["PROD_CD"].Text.ToString()); al.Add(list); } } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBSave"; ccp.MethodName = "doXmlSave"; ccp.ServerParams = new object[] { al }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.DoQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } public static void Init_ComboControl(System.Windows.Forms.Control ComboControl, ref System.Data.DataTable dt) { System.Data.DataView dtview = new System.Data.DataView(dt); ((Infragistics.Win.UltraWinEditors.UltraComboEditor)ComboControl).DataSource = dtview; ((Infragistics.Win.UltraWinEditors.UltraComboEditor)ComboControl).DisplayMember = "SM_CFNM"; ((Infragistics.Win.UltraWinEditors.UltraComboEditor)ComboControl).ValueMember = "SM_CD"; //try //{ // switch (ComboControl.GetType().ToString()) // { // case "Infragistics.Win.UltraWinEditors.UltraComboEditor": // break; // } //} //catch (System.Exception ex) //{ // System.Diagnostics.Debug.WriteLine(ex.ToString()); //} } private void UIB010321_Load(object sender, EventArgs e) { init(); this.ultraComboEditor3.SelectedIndex = 0; } //自定义单元格数据错误提示框 private void ultraGrid1_CellDataError(object sender, CellDataErrorEventArgs e) { e.RaiseErrorEvent = false; e.StayInEditMode = true; MessageBox.Show("输入数据的格式不正确,请校验"); } } }