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.UIB { public partial class UIB100102 : FrmBase { public UIB100102() { 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 DoQuery() { try { this.dataSet1.Tables[0].Clear(); ArrayList al = new ArrayList(); al.Add("UIB100102_01.SELECT"); al.Add(this.textBox1.Text.Trim()); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHYComQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } catch (Exception ex) { } } public void DoSave() { try { //if (this.UserInfo.GetUserID() != "1" // && this.UserInfo.GetUserID() != "zw" // && this.UserInfo.GetUserID() != "lyb" // && this.UserInfo.GetUserID() != "jc190") { MessageBox.Show("无修改权限!禁止修改!", "提示"); return; } if (MessageBox.Show("确定保存?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; ArrayList list = null; ArrayList al = new ArrayList(); foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Value)) { list = new ArrayList(); if(ugr.Cells["QLTY_CD_XP"].Text != "")//若存在编码,则说明是更新 { list.Add("UIB100102_01.UPDATE"); list.Add(ugr.Cells["QLTY_CD_1"].Text); list.Add(ugr.Cells["QLTY_CD_2"].Text); list.Add(ugr.Cells["QLTY_CD_2_NM"].Text); list.Add(ugr.Cells["QLTY_CD_3"].Text); list.Add(ugr.Cells["QLTY_CD_3_NM"].Text); list.Add(ugr.Cells["QLTY_CD"].Text); list.Add(ugr.Cells["QLTY_CD_CFNM"].Text); list.Add(ugr.Cells["QLTY_UNIT"].Text); list.Add(ugr.Cells["QLTY_TYPE"].Text); list.Add(ugr.Cells["DISPLAY_SEQ"].Text); list.Add(ugr.Cells["QLTY_OPE_CD"].Text); list.Add(ugr.Cells["QLTY_DIR"].Text); list.Add(ugr.Cells["QLTY_SIZ"].Text); list.Add(ugr.Cells["QLTY_TEM"].Text); list.Add(ugr.Cells["QLTY_RP"].Text); list.Add(ugr.Cells["QLTY_CD_XP"].Text); } else//插入 { list.Add("UIB100102_01.INSERT"); list.Add(ugr.Cells["QLTY_CD_1"].Text); list.Add(ugr.Cells["QLTY_CD_2"].Text); list.Add(ugr.Cells["QLTY_CD_2_NM"].Text); list.Add(ugr.Cells["QLTY_CD_3"].Text); list.Add(ugr.Cells["QLTY_CD_3_NM"].Text); list.Add(ugr.Cells["QLTY_CD"].Text); list.Add(ugr.Cells["QLTY_CD_CFNM"].Text); list.Add(ugr.Cells["QLTY_UNIT"].Text); list.Add(ugr.Cells["QLTY_TYPE"].Text); list.Add(ugr.Cells["DISPLAY_SEQ"].Text); list.Add(ugr.Cells["QLTY_OPE_CD"].Text); list.Add(ugr.Cells["QLTY_DIR"].Text); list.Add(ugr.Cells["QLTY_SIZ"].Text); list.Add(ugr.Cells["QLTY_TEM"].Text); list.Add(ugr.Cells["QLTY_RP"].Text); }//更新或插入判断结束 al.Add(list); }//CHK判断结束 }//grid循环判断结束 if (al.Count == 0) return; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHYComSave"; ccp.MethodName = "doSimpleSave"; ccp.ServerParams = new object[] { al }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.DoQuery(); } catch (Exception ex) { } } public void DoDelete() { try { //if (this.UserInfo.GetUserID() != "1" // && this.UserInfo.GetUserID() != "zw" // && this.UserInfo.GetUserID() != "lyb" // && this.UserInfo.GetUserID() != "jc190") { MessageBox.Show("无修改权限!禁止修改!", "提示"); return; } if (MessageBox.Show("确定删除?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; ArrayList al = new ArrayList(); foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Text)) { ArrayList list = new ArrayList(); list.Add("UIB100102_01.DELETE"); list.Add(ugr.Cells["QLTY_CD"].Text.Trim()); al.Add(list); } } if (al.Count == 0) return; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHYComSave"; ccp.MethodName = "doSimpleSave"; ccp.ServerParams = new object[] { al }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.DoQuery(); } catch (Exception ex) { } } } }