| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Qcm.model;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using Newtonsoft.Json;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Qcm
- {
- public partial class ComBaseWbsFrm : FrmBase
- {
- ComBaseWbsEntity wbsEntity;
- public ComBaseWbsEntity WbsEntity
- {
- get { return wbsEntity; }
- set { wbsEntity = value; }
- }
- public ComBaseWbsFrm()
- {
- InitializeComponent();
- EntityHelper.ShowGridCaption<ComBaseWbsEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- }
- public ComBaseWbsFrm(OpeBase ob)
- {
- this.ob = ob;
- InitializeComponent();
- EntityHelper.ShowGridCaption<ComBaseWbsEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- ultraToolbarsManager1.Visible = true;
- GridHelper.HidenColumns(ultraGrid1.DisplayLayout.Bands[0], "CHK");
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- base.ToolBar_Click(sender, ToolbarKey);
- switch (ToolbarKey)
- {
- case "Query":
- Query();
- break;
- case "Add":
- Add();
- break;
- case "Modify":
- Modify();
- break;
- case "Delete":
- Delete();
- break;
- case "Resume":
- Resume();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void Resume()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
- ArrayList parms = new ArrayList();
- foreach (UltraGridRow row in checkRows)
- {
- ComBaseWbsEntity parm = row.ListObject as ComBaseWbsEntity;
- parm.UpdateName = this.UserInfo.GetUserName();
- parms.Add(JSONFormat.Format(parm));
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认恢复记录?") == DialogResult.No)
- {
- return;
- }
- List<string> jsons = new List<string>();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.qcm.DAL.ComBaseWbsDAL";
- ccp.MethodName = "UpdateValidflag";
- ccp.ServerParams = new object[] { parms, "1" };
- ccp.IfShowErrMsg = false;
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("作废成功!");
- Query();
- }
- }
- private void Delete()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
- ArrayList parms = new ArrayList();
- foreach (UltraGridRow row in checkRows)
- {
- ComBaseWbsEntity parm = row.ListObject as ComBaseWbsEntity;
- parm.DeleteName = this.UserInfo.GetUserName();
- parms.Add(JSONFormat.Format(parm));
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认作废记录?") == DialogResult.No)
- {
- return;
- }
- List<string> jsons = new List<string>();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.qcm.DAL.ComBaseWbsDAL";
- ccp.MethodName = "UpdateValidflag";
- ccp.ServerParams = new object[] { parms,"0" };
- ccp.IfShowErrMsg = false;
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("作废成功!");
- Query();
- }
- }
- private void Modify()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
- ArrayList parms = new ArrayList();
- foreach (UltraGridRow row in checkRows)
- {
- ComBaseWbsEntity parm = row.ListObject as ComBaseWbsEntity;
- List<ComBaseWbsEntity> list = EntityHelper.GetData<ComBaseWbsEntity>(
- "com.steering.pss.qcm.DAL.ComBaseWbsDAL.QueryByPk", new object[] { parm.WbsCode }, this.ob);
- if (list == null || list.Count <= 0)
- {
- MessageUtil.ShowWarning(parm.WbsCode + ",wbs号不存在,无法修改!");
- return;
- }
- parm.UpdateName = this.UserInfo.GetUserName();
- parms.Add(JSONFormat.Format(parm));
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认修改记录?") == DialogResult.No)
- {
- return;
- }
- List<string> jsons = new List<string>();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.qcm.DAL.ComBaseWbsDAL";
- ccp.MethodName = "Update";
- ccp.ServerParams = new object[] { parms };
- ccp.IfShowErrMsg = false;
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("修改成功!");
- Query();
- }
- }
- private void Add()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
- ArrayList parms = new ArrayList();
- foreach (UltraGridRow row in checkRows)
- {
- ComBaseWbsEntity parm = row.ListObject as ComBaseWbsEntity;
- List<ComBaseWbsEntity> list = EntityHelper.GetData<ComBaseWbsEntity>(
- "com.steering.pss.qcm.DAL.ComBaseWbsDAL.QueryByPk", new object[] { parm.WbsCode }, this.ob);
- if (list != null && list.Count > 0)
- {
- MessageUtil.ShowWarning(parm.WbsCode + ",wbs号已存在,无法新增!");
- return;
- }
- parm.CreateName = this.UserInfo.GetUserName();
- parms.Add(JSONFormat.Format(parm));
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认新增记录?") == DialogResult.No)
- {
- return;
- }
- List<string> jsons = new List<string>();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.qcm.DAL.ComBaseWbsDAL";
- ccp.MethodName = "Insert";
- ccp.ServerParams = new object[] { parms };
- ccp.IfShowErrMsg = false;
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("新增成功!");
- Query();
- }
- }
- private void Query()
- {
- string wbsName = labelTextBox1.Text.Trim();
- string flag = ultraCheckEditor1.Checked ? "0" : "1";
- List<ComBaseWbsEntity> listSource = EntityHelper.GetData<ComBaseWbsEntity>(
- "com.steering.pss.qcm.DAL.ComBaseWbsDAL.Query", new object[] { wbsName, flag }, this.ob);
- comBaseWbsEntityBindingSource.DataSource = listSource;
- }
- private void ComBaseWbsFrm_Load(object sender, EventArgs e)
- {
- Query();
- }
- private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "查询":
- Query();
- break;
- case "确认":
- Submit();
- break;
- case "关闭":
- this.Close();
- break;
- }
- }
- private void Submit()
- {
- WbsEntity = this.ultraGrid1.ActiveRow.ListObject as ComBaseWbsEntity;
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- }
- }
|