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 UIB030191 : FrmBase { public UIB030191() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Update": this.DoUpdate(); break; case "Insert": this.DoInsert(); break; case "Delete": this.DoDelete(); break; //case "Export": // this.DoExport(); // break; } } public void DoQuery() { try { ArrayList al = new ArrayList(); this.dataSet1.Tables[0].Clear(); al.Add("UIB030191_01.SELECT"); 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) { } } public void DoUpdate() { try { if (MessageBox.Show("确定修改?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["CHK"].Text == "True") { if (ugr.Cells["STOP_DTIME"].Text.ToString() == "" || ugr.Cells["START_DTIME"].Text.ToString() == "") { continue; } int sumNum = Convert.ToInt32(ugr.Cells["START_DTIME"].Text.ToString().Substring(0, 2)) - Convert.ToInt32(ugr.Cells["STOP_DTIME"].Text.ToString().Substring(0, 2)); int sumNum_1 = Convert.ToInt32(ugr.Cells["START_DTIME"].Text.ToString().Substring(3, 2)) - Convert.ToInt32(ugr.Cells["STOP_DTIME"].Text.ToString().Substring(3, 2)); ArrayList al = new ArrayList(); CoreClientParam ccp = new CoreClientParam(); al.Add("UIB030191_01.UPDATE"); al.Add(ugr.Cells["PROD_LINE"].Value.ToString()); al.Add(this.UserInfo.GetUserGroup().ToString()); al.Add(this.UserInfo.GetUserGroup().ToString()); al.Add(ugr.Cells["STOP_DTIME"].Text.ToString()); al.Add(ugr.Cells["START_DTIME"].Text.ToString()); al.Add(sumNum * 60 + sumNum_1); al.Add(ugr.Cells["EVNET_NM"].Text.ToString()); al.Add(ugr.Cells["EDT_NM"].Text.ToString()); al.Add(ugr.Cells["DEPART_NM"].Text.ToString()); al.Add(this.UserInfo.GetUserName().ToString()); al.Add(ugr.Cells["PROD_SEQ"].Text.ToString()); ccp.ServerName = "UIB.COM.ComDBSave"; ccp.MethodName = "doXmlSave"; ccp.ServerParams = new object[] { al }; this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); } } this.DoQuery(); } catch (Exception ex) { } } public void DoInsert() { try { if (MessageBox.Show("确定增加?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; int num = this.ultraGrid1.Rows.Count; if (this.ultraGrid1.Rows[num - 1].Cells["STOP_DTIME"].Text.ToString() == "" || this.ultraGrid1.Rows[num - 1].Cells["START_DTIME"].Text.ToString() == "") { MessageBox.Show("时间不允许为空!", "提示"); return; } Decimal sumNum = Convert.ToDecimal(this.ultraGrid1.Rows[num - 1].Cells["START_DTIME"].Text.ToString().Substring(0, 2)) - Convert.ToDecimal(this.ultraGrid1.Rows[num - 1].Cells["STOP_DTIME"].Text.ToString().Substring(0, 2)); Decimal sumNum_1 = Convert.ToDecimal(this.ultraGrid1.Rows[num - 1].Cells["START_DTIME"].Text.ToString().Substring(3, 2)) - Convert.ToDecimal(this.ultraGrid1.Rows[num - 1].Cells["STOP_DTIME"].Text.ToString().Substring(3, 2)); ArrayList al = new ArrayList(); al.Add("UIB030191_01.INSERT"); al.Add(this.ultraGrid1.Rows[num-1].Cells["PROD_LINE"].Value.ToString()); al.Add(this.UserInfo.GetUserGroup().ToString()); al.Add(this.UserInfo.GetUserGroup().ToString()); al.Add(this.ultraGrid1.Rows[num - 1].Cells["STOP_DTIME"].Text.ToString()); al.Add(this.ultraGrid1.Rows[num - 1].Cells["START_DTIME"].Text.ToString()); al.Add((sumNum * 60 + sumNum_1).ToString()); al.Add(this.ultraGrid1.Rows[num - 1].Cells["EVNET_NM"].Text.ToString()); al.Add(this.ultraGrid1.Rows[num - 1].Cells["EDT_NM"].Text.ToString()); al.Add(this.ultraGrid1.Rows[num - 1].Cells["DEPART_NM"].Text.ToString()); al.Add(this.UserInfo.GetUserName().ToString()); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBSave"; ccp.MethodName = "doXmlSave"; ccp.ServerParams = new object[] { al }; this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); //foreach (UltraGridRow ugr in this.ultraGrid1.Rows) //{ // if (ugr.Cells["CHK"].Text == "Y") // { // } //} this.DoQuery(); } catch (Exception ex) { } } public void DoDelete() { try { if (MessageBox.Show("确定删除?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["CHK"].Text == "True") { ArrayList al = new ArrayList(); al.Add("UIB030191_01.DELETE"); al.Add(ugr.Cells["PROD_SEQ"].Text.ToString()); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBSave"; ccp.MethodName = "doXmlSave"; ccp.ServerParams = new object[] { al }; this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); } } this.DoQuery(); } catch (Exception ex) { } } } }