| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- 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.UIJ
- {
- public partial class UIJ070010 : FrmBase
- {
- public UIJ070010()
- {
- 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.ServerName = "UIJ.UIJ05.UIJ070010";
- ccp.MethodName = "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")
-
- {
- if (ugr.Cells["EGIS_ID"].Text == "") //没有id才加
- {
- 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;
- if (list.Contains(""))
- {
- MessageBox.Show("请输入完整信息!", "警告");
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIJ.UIJ05.UIJ070010";
- ccp.MethodName = "add";
- 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 list = null;
- ArrayList al = new ArrayList();
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
- if (ugr.Cells["CHK"].Text.ToString() == "True")
- {
- list = new ArrayList();
- if (ugr.Cells["EGIS_ID"].Text != "")//有id 即数据库有数据 才更新
- {
-
- 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());
- list.Add(ugr.Cells["EGIS_ID"].Text.ToString());
- al.Add(list);
- }
- }// if end
- }//foreach end
- if (al.Count == 0) return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIJ.UIJ05.UIJ070010";
- ccp.MethodName = "Save";
- 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")
- {
- if (ugr.Cells["EGIS_ID"].Text != "") //有id才能删
- {
- al.Add(ugr.Cells["EGIS_ID"].Text.ToString());
- }
-
- }//if end
- }//for end
- if (al.Count == 0) return; //没有选择数据 返回
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIJ.UIJ05.UIJ070010";
- ccp.MethodName = "remove";
- ccp.ServerParams = new object[] { al[0] };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- this.DoQuery();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- }
- }
|