| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- 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.Diagnostics;
- using System.Collections;
- using Infragistics.Win.UltraWinGrid;
- namespace Core.LZMes.Client.UIB
- {
- public partial class UIB010330 : FrmBase
- {
- public UIB010330()
- {
- 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("UIB010330_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.SPECSTLGRD_comboBox, ref dt);
-
- dt = new DataTable();
- al = new ArrayList();
- al.Add("UIB010330_02.INITSELECT");
- 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.SPECABBSYM_comboBox, ref dt);
- dt = new DataTable();
- al = new ArrayList();
- al.Add("UIB010330_04.INITSELECT");
- 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);
- dt = new DataTable();
- al = new ArrayList();
- al.Add("UIB010330_03.INITSELECT");
- 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.ultraComboEditor2, ref dt);
- }
- 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";
-
- }
- public void DoQuery()
- {
- try
- {
- this.dataSet1.Tables[0].Clear();
- ArrayList al = new ArrayList();
- al.Add("UIB010330_02.SELECT");
- if (this.SPECABBSYM_comboBox.Value == null)
- {
- al.Add("");
- al.Add("");
- }
- else
- {
- al.Add(this.SPECABBSYM_comboBox.Value.ToString());
- al.Add(this.SPECABBSYM_comboBox.Value.ToString());
- }
- if (this.SPECSTLGRD_comboBox.Value == null)
- {
- al.Add("");
- al.Add("");
- }
- else
- {
- al.Add(this.SPECSTLGRD_comboBox.Value.ToString());
- al.Add(this.SPECSTLGRD_comboBox.Value.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 DoSave()
- {
- try
- {
- if (MessageBox.Show("确定保存?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- return;
- if (this.ultraGrid1.ActiveRow == null) return;
- string p_cd = this.ultraGrid1.ActiveRow.Cells["PRDNM_CD"].Text.ToString();
- string sp_abbsym = this.ultraGrid1.ActiveRow.Cells["SPEC_ABBSYM"].Text.ToString();
- string sp_stlgrd = this.ultraGrid1.ActiveRow.Cells["SPEC_STL_GRD"].Text.ToString();
- CoreClientParam ccp = null;
- ArrayList al = new ArrayList();
- ArrayList list = null;
- foreach (UltraGridRow ugr in this.ultraGrid3.Rows)
- {
- list = new ArrayList();
- if (ugr.Cells["PROD_VAL"].Text.ToString() != "")
- {
- ccp = new CoreClientParam();
- ArrayList als = new ArrayList();
- //判断是否存在该项目值
- als.Add("UIB010330_11.SELECT");
- als.Add(p_cd);
- als.Add(sp_abbsym);
- als.Add(sp_stlgrd);
- als.Add(ugr.Cells["PROD_CD"].Text.ToString());
- ccp.ServerName = "UIB.COM.ComDBQuery";
- ccp.MethodName = "doSimpleQuery";
- ccp.ServerParams = new object[] { als };
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- int num = 0;
- if (null != ccp.SourceDataTable)
- num = ccp.SourceDataTable.Rows.Count;
- if (num <= 0) //不存在则为插入
- {
- list.Add("UIB010330_01.INSERT");
- list.Add(p_cd);
- list.Add(sp_abbsym);
- list.Add(sp_stlgrd);
- list.Add(ugr.Cells["PROD_CD"].Text.ToString());
- list.Add(ugr.Cells["PROD_TYPE"].Text.ToString());
- list.Add(ugr.Cells["DCS_SYM"].Text.ToString());
- list.Add(ugr.Cells["PROD_VAL"].Text.ToString());
- list.Add(ugr.Cells["MEMO"].Text.ToString());
- list.Add(this.UserInfo.GetUserName());
- }
- else //否则则为修改
- {
- list.Add("UIB010330_02.UPDATE");
- list.Add(ugr.Cells["PROD_VAL"].Text.ToString());
- list.Add(ugr.Cells["MEMO"].Text.ToString());
- list.Add(this.UserInfo.GetUserName());
- list.Add(p_cd);
- list.Add(sp_abbsym);
- list.Add(sp_stlgrd);
- list.Add(ugr.Cells["PROD_CD"].Text.ToString());
- }
- }
- else //若值为空则删除对应项目
- {
- list.Add("UIB010330_02.DELETE");
- list.Add(p_cd);
- list.Add(sp_abbsym);
- list.Add(sp_stlgrd);
- list.Add(ugr.Cells["PROD_CD"].Text.ToString());
- }
- al.Add(list);
-
- }
-
- if (al.Count == 0) return;
- 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;
-
- if (this.ultraGrid1.ActiveRow == null) return;
- ArrayList al = new ArrayList();
- al.Add("UIB010330_01.DELETE");
- al.Add(this.ultraGrid1.ActiveRow.Cells["PRDNM_CD"].Text.ToString());
- al.Add(this.ultraGrid1.ActiveRow.Cells["SPEC_ABBSYM"].Text.ToString());
- al.Add(this.ultraGrid1.ActiveRow.Cells["SPEC_STL_GRD"].Text.ToString());
-
- 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());
- }
- }
- private void UIB010330_Load(object sender, EventArgs e)
- {
- init();
- }
- //点击某行查询右边规范标准信息
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- if (this.ultraGrid1.ActiveRow == null) return;
- //if (this.ultraGrid1.ActiveRow.Selected == false) return;
- this.dataSet2.Tables[0].Clear();
- CoreClientParam ccp = new CoreClientParam();
- ArrayList al = new ArrayList();
- al.Add("UIB010330_12.SELECT");
- al.Add(this.ultraGrid1.ActiveRow.Cells["PRDNM_CD"].Text.ToString());
- al.Add(this.ultraGrid1.ActiveRow.Cells["SPEC_ABBSYM"].Text.ToString());
- al.Add(this.ultraGrid1.ActiveRow.Cells["SPEC_STL_GRD"].Text.ToString());
- ccp.ServerName = "UIB.COM.ComDBQuery";
- ccp.MethodName = "doSimpleQuery";
- ccp.ServerParams = new object[] { al };
- ccp.SourceDataTable = this.dataSet2.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- }
-
- //private void ultraGrid1_AfterRowUpdate(object sender, RowEventArgs e)
- //{
- //}
- //private void ultraGrid1_CellChange(object sender, CellEventArgs e)
- //{
- // if (MessageBox.Show("数据有改动需要保存吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- // return;
- //}
-
- }
- }
|