| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- 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 UIB010320 : FrmBase
- {
- public UIB010320()
- {
- 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("UIB010320_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();
- ArrayList al = new ArrayList();
- al.Add("UIB010320_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)
- {
- 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;
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
- if (ugr.Cells["CHK"].Text == "True")
- {
- if (ugr.Cells["PROD_CD"].Text.ToString() == "")
- {
- MessageBox.Show("生产规范代码不允许为空!", "提示");
- return;
- }
- list = new ArrayList();
- if (ugr.Cells["EDIT_PROD"].Text == "")//插入
- {
- list.Add("UIB010320_01.INSERT");
- list.Add(ugr.Cells["PROD_CD"].Text.ToString());
- list.Add(ugr.Cells["DISPLAY_SEQ"].Text.ToString());
- list.Add(ugr.Cells["PROD_TYPE"].Text.ToString());
- list.Add(ugr.Cells["PROD_CD_CFNM"].Text.ToString());
- list.Add(ugr.Cells["DCS_SYM"].Text.ToString());
- list.Add(this.UserInfo.GetUserName());
- }
- else//更新
- {
- list.Add("UIB010320_01.UPDATE");
- list.Add(ugr.Cells["PROD_CD"].Text.ToString());
- list.Add(ugr.Cells["DISPLAY_SEQ"].Text.ToString());
- list.Add(ugr.Cells["PROD_TYPE"].Text.ToString());
- list.Add(ugr.Cells["PROD_CD_CFNM"].Text.ToString());
- list.Add(ugr.Cells["DCS_SYM"].Text.ToString());
- list.Add(this.UserInfo.GetUserName());
- list.Add(ugr.Cells["EDIT_PROD"].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();
- }
- 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 UIB010320_Load(object sender, EventArgs e)
- {
- init();
- }
- //自定义单元格数据错误提示框
- private void ultraGrid1_CellDataError(object sender, CellDataErrorEventArgs e)
- {
- e.RaiseErrorEvent = false;
- e.StayInEditMode = true;
- MessageBox.Show("输入数据的格式不正确,请校验");
- }
-
- }
- }
|