| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- 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.QCM
- {
- public partial class QCM0105 : FrmBase
- {
- public QCM0105()
- {
- 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.Tables[0].Clear();
- string deftDesc = this.textBox1.Text.Trim(); //缺陷描述
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM01.QCM0105.QueryDefect";
- ccp.MethodName = "Query";
- ccp.ServerParams = new object[] { deftDesc };
- 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
- {
- if (this.UserInfo.GetUserGroup() == 0 + "")
- {
- MessageBox.Show("常白班人员禁止对数据进行操作", "警告");
- return;
- }
- if ("" == this.textBox2.Text || null == this.textBox2.Text)
- {
- MessageBox.Show("缺陷项目代码不能为空!", "警告");
- this.textBox2.Focus();
- return;
- }
- if (MessageBox.Show("确认保存?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- return;
- ArrayList al = new ArrayList();
- al.Add(this.textBox2.Text.Trim()); //缺陷项目代码
- al.Add(this.textBox3.Text.Trim()); //缺陷项目描述
- al.Add(this.textBox4.Text.Trim()); //缺陷分类描述
- al.Add(this.textBox5.Text.Trim()); //备注
- al.Add(this.UserInfo.GetUserID()); //创建人ID
- al.Add(this.UserInfo.GetUserName()); //创建人
-
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM01.QCM0105.addDefect";
- ccp.MethodName = "add";
- ccp.ServerParams = new object[] { al };
- this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- // if (0 != ccp.ReturnCode) return;
- if ("1" != ccp.ReturnObject.ToString())
- {
- MessageBox.Show(ccp.ReturnObject.ToString(), "警告");
- return;
- }
- this.textBox1.Text = al[1].ToString();
- DoQuery();
- MessageBox.Show("创建成功!");
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统发生异常,请与管理员联系", "提示");
- }
- }
- private void DoUpdate()
- {
- try
- {
- if (this.UserInfo.GetUserGroup() == 0 + "")
- {
- MessageBox.Show("常白班人员禁止对数据进行操作", "警告");
- return;
- }
- if (this.ultraGrid1.Selected.Rows.Count == 0)
- {
- MessageBox.Show("请选择要修改的数据!");
- return;
- }
- //选择一行数据
- UltraGridRow ugr = this.ultraGrid1.ActiveRow;
- string defeCode = ugr.Cells["DEFECT_CODE"].Value.ToString();
- if (MessageBox.Show("确认修改?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- return;
- ArrayList al = new ArrayList();
-
- al.Add(this.textBox3.Text.Trim()); //缺陷项目描述
- al.Add(this.textBox4.Text.Trim()); //缺陷分类描述
- al.Add(this.textBox5.Text.Trim()); //备注
- al.Add(this.UserInfo.GetUserID()); //修改人ID
- al.Add(this.UserInfo.GetUserName()); //修改人
- al.Add(defeCode); //缺陷项目代码
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM01.QCM0105.SaveDefect";
- ccp.MethodName = "Save";
- ccp.ServerParams = new object[] { al };
- this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- //if (0 != ccp.ReturnCode) return;
- if ("1" != ccp.ReturnObject.ToString())
- {
- MessageBox.Show(ccp.ReturnObject.ToString(), "警告");
- return;
- }
- this.textBox1.Text = al[0].ToString();
- DoQuery();
- MessageBox.Show("修改成功!");
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统发生异常,请与管理员联系", "提示");
- }
- }
- private void DoDelete()
- {
- try
- {
- if (this.UserInfo.GetUserGroup() == 0 + "")
- {
- MessageBox.Show("常白班人员禁止对数据进行操作", "警告");
- return;
- }
- if (this.ultraGrid1.ActiveRow.Cells.Count == 0)
- {
- MessageBox.Show("请选择要修改的数据!");
- return;
- }
- //选择一行数据
- UltraGridRow ugr = this.ultraGrid1.ActiveRow;
- string defeCode = ugr.Cells["DEFECT_CODE"].Value.ToString();
- if (MessageBox.Show(this, "是否确认删除?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
- {
- return;
- }
- ArrayList al = new ArrayList();
- al.Add(defeCode); //缺陷项目代码
- al.Add(this.UserInfo.GetUserID()); //删除人ID
- al.Add(this.UserInfo.GetUserName());//删除人
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.QCM01.QCM0105.removeDefect";
- ccp.MethodName = "remove";
- ccp.ServerParams = new object[] { al };
- this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if ("1" != ccp.ReturnObject.ToString())
- {
- MessageBox.Show(ccp.ReturnObject.ToString(), "警告");
- return;
- }
- DoQuery();
- MessageBox.Show("删除成功!");
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统发生异常,请与管理员联系", "提示");
- }
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- this.textBox2.Text = this.ultraGrid1.ActiveRow.Cells["DEFECT_CODE"].Value.ToString();
- this.textBox3.Text = this.ultraGrid1.ActiveRow.Cells["DEFECT_DESC"].Value.ToString();
- this.textBox4.Text = this.ultraGrid1.ActiveRow.Cells["DEFECT_TYPE_DESC"].Value.ToString();
- this.textBox5.Text = this.ultraGrid1.ActiveRow.Cells["MEMO"].Value.ToString();
- }
- }
- }
|