| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- 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;
- using System.Reflection;
- namespace Core.LZMes.Client.QCM
- {
- public partial class EGLS : FrmBase
- {
- public EGLS()
- {
- InitializeComponent();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- this.DoQuery();
- break;
- case "Add":
- this.DoAdd();
- break;
- case "Update":
- this.DoUpdate();
- break;
- case "Delete":
- this.DoDelete();
- break;
- }
- }
- //查询
- private void DoQuery()
- {
- try
- {
- this.dataSet1.Clear();
- string forName = this.textBox1.Text.Trim();
- string proLine = this.textBox2.Text.Trim();
- CoreClientParam ccp = new CoreClientParam();
- ccp.MethodName = "QueryRealize";
- ccp.ServerName = "QCM.EGIS.Query";
- ccp.ServerParams = new object[]{ forName , proLine };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp,CoreInvokeType.Internal);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- //新增
- private void DoAdd()
- {
- try
- {
- ArrayList list = new ArrayList();
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
-
- if (ugr.Cells["CHK"].Text.ToString() == "True")
-
- {
- list = new ArrayList();
- list.Add(ugr.Cells["FOR_NAME"].Text.ToString());
- list.Add(ugr.Cells["PRODUCTION_LINE"].Text.ToString());
- list.Add(ugr.Cells["NORM"].Text.ToString());
- list.Add(ugr.Cells["UNIT_PRICE"].Text.ToString());
- }// if end
- }//foreach end
- if (list.Count == 0) return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.MethodName = "addEglsRealize";
- ccp.ServerName = "QCM.EGIS.addEgls";
- ccp.ServerParams = new object[] { list };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- this.DoQuery();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- //更新
- private void DoUpdate()
- {
- try
- {
- ArrayList al = new ArrayList();
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
- if (ugr.Cells["CHK"].Text.ToString() == "True")
- {
-
- if (ugr.Cells["EGIS_ID"].Text != "")//更新
- {
-
- al.Add(ugr.Cells["FOR_NAME"].Text.ToString());
- al.Add(ugr.Cells["PRODUCTION_LINE"].Text.ToString());
- al.Add(ugr.Cells["NORM"].Text.ToString());
- al.Add(ugr.Cells["UNIT_PRICE"].Text.ToString());
- al.Add(ugr.Cells["EGIS_ID"].Text.ToString());
- }
- }// if end
- }//foreach end
- if (al.Count == 0) return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.EGIS.Savel";
- ccp.MethodName = "SaveRealize";
- ccp.ServerParams = new object[] { al };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- this.DoQuery();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- //删除
- public void DoDelete()
- {
- try
- {
- if (MessageBox.Show("确定删除?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- return;
- ArrayList al = new ArrayList();
-
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
- if (ugr.Cells["CHK"].Text.ToString() == "True")
- {
- al.Add(ugr.Cells["EGIS_ID"].Text.ToString());
- }//if end
- }//for end
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.EGIS.removeEgls";
- ccp.MethodName = "removeEglsRealize";
- ccp.ServerParams = new object[] { al[0] };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- this.DoQuery();
- }
- catch (Exception ex)
- {
- }
- }
- }
- }
|