| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Lims.Data.PipeAndOutdec.封装类.实体类;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win.UltraWinGrid;
- 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.Lims.Data.PipeAndOutdec
- {
- public partial class FrmTpopi26 : FrmBase
- {
- public FrmTpopi26()
- {
- InitializeComponent();
- EntityHelper.ShowGridCaption<Tpopi26Entity>(ultraGrid1.DisplayLayout.Bands[0]);
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- doQuery();
- break;
- case "Add":
- doSave("ADD");
- break;
- case "Update":
- doSave("Update");
- break;
- case "Delete":
- doDelete();
- break;
- //case "Recover":
- // doNullifyOrRecover("0");
- // break;
- //case "StdCopy":
- // StdCopy();
- // break;
- case "Close":
- if (MessageUtil.ShowYesNoAndQuestion("是否确认关闭页面?") == DialogResult.Yes)
- {
- this.Close();
- }
- break;
- }
- }
- private void doQuery()
- {
- List<Tpopi26Entity> listSource = EntityHelper.GetData<Tpopi26Entity>(
- "com.steering.lims.data.pipe.Tpopi26.doQuery", new object[] { text_code.Text, text_name.Text,"" ,""}, this.ob);
- Tpopi26bindingSource.DataSource = listSource;
- //for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- //{
- // UltraGridRow row = ultraGrid1.Rows[i];
- //}
- }
- private void doSave(string ToolbarKey)
- {
- if (text_inspectStandType.Text == null || text_inspectStandType.Text.Equals(""))
- {
- MessageUtil.ShowTips("质检标准类型不能为空!");
- return;
- }
- if (text_inspectStandName.Text == null || text_inspectStandName.Text.Equals(""))
- {
- MessageUtil.ShowTips("质检标准名称不能为空!");
- return;
- }
- if (text_standStartDate.Text == null || text_standStartDate.Text.Equals(""))
- {
- MessageUtil.ShowTips("标准开始日期不能为空!");
- return;
- }
- if (text_standEndDate.Text == null || text_standEndDate.Text.Equals(""))
- {
- MessageUtil.ShowTips("标准结束日期不能为空!");
- return;
- }
- if (text_elmCode.Text == null || text_elmCode.Text.Equals(""))
- {
- MessageUtil.ShowTips("元素代码不能为空!");
- return;
- }
- if (text_elmName.Text == null || text_elmName.Text.Equals(""))
- {
- MessageUtil.ShowTips("元素名称不能为空!");
- return;
- }
- Tpopi26Entity entity = new Tpopi26Entity();
- entity.InspectStandType = text_inspectStandType.Text;
- entity.InspectStandName = text_inspectStandName.Text;
- entity.StandStartDate = text_standStartDate.DateTime.ToString("yyyymmddHHmmss");
- entity.StandEndDate = text_standEndDate.DateTime.ToString("yyyymmddHHmmss");
- entity.ElmCode = text_elmCode.Text;
- entity.ElmName = text_elmName.Text;
- entity.InspectStandShort = text_inspectStandShort.Text;
- entity.InspectOperatType = text_InspectOperatType.Text;
- entity.JdeLevel = text_jdeLevel.Text;
- entity.InspectStandDesc = text_InspectStandDesc.Text;
- entity.RecCreator = UserInfo.GetUserName();
- entity.RecRevisor = UserInfo.GetUserName();
- entity.InspectStandCode = text_InspectStandCode.Text;
- string baseEntity = JSONFormat.Format(entity);
- if (ToolbarKey.Equals("ADD"))
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.lims.data.pipe.Tpopi26";
- ccp.MethodName = "doAdd";
- ccp.ServerParams = new object[] { new ArrayList { baseEntity } };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- doQuery();
- MessageUtil.ShowTips("新增成功!");
- }
- }
- if (ToolbarKey.Equals("Update"))
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.lims.data.pipe.Tpopi26";
- ccp.MethodName = "doUpdate";
- ccp.ServerParams = new object[] { new ArrayList { baseEntity } };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- doQuery();
- MessageUtil.ShowTips("保存成功!");
- }
- }
-
- }
- private void doUpdate()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要修改的信息!");
- return;
- }
- ArrayList parmList = new ArrayList();
- foreach (UltraGridRow row in checkMagRows)
- {
- Tpopi26Entity entity = row.ListObject as Tpopi26Entity;
- if (String.IsNullOrEmpty(entity.InspectStandCode) || String.IsNullOrEmpty(entity.JdeLevel) || String.IsNullOrEmpty(entity.ElmCode))
- continue;
- //entity.RecRevisor = UserInfo.GetUserName();
- string baseEntity = JSONFormat.Format(entity);
- parmList.Add(baseEntity);
- }
- if (parmList.Count > 0)
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.lims.data.pipe.Tpopi26";
- ccp.MethodName = "doUpdate";
- ccp.ServerParams = new object[] { parmList };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- doQuery();
- MessageUtil.ShowTips("修改成功!");
- }
- }
- }
- private void doDelete()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要删除的信息!");
- return;
- }
- ArrayList parmList = new ArrayList();
- foreach (UltraGridRow row in checkMagRows)
- {
- Tpopi26Entity entity = row.ListObject as Tpopi26Entity;
- if (String.IsNullOrEmpty(entity.InspectStandCode) || String.IsNullOrEmpty(entity.JdeLevel) || String.IsNullOrEmpty(entity.ElmCode))
- continue;
- string baseEntity = JSONFormat.Format(entity);
- parmList.Add(baseEntity);
- }
- if (parmList.Count > 0)
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.lims.data.pipe.Tpopi26";
- ccp.MethodName = "doDelete";
- ccp.ServerParams = new object[] { parmList };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- doQuery();
- MessageUtil.ShowTips("删除成功!");
- }
- }
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- if (ultraGrid1.ActiveRow == null)
- return;
- Infragistics.Win.UltraWinGrid.UltraGridRow ulRow = ultraGrid1.ActiveRow;
- text_inspectStandType.Text = Convert.ToString(ulRow.Cells["InspectStandType"].Value);
- text_inspectStandName.Text = Convert.ToString(ulRow.Cells["InspectStandName"].Value);
- text_inspectStandShort.Text = Convert.ToString(ulRow.Cells["InspectStandShort"].Value);
- text_InspectStandCode.Text = Convert.ToString(ulRow.Cells["InspectStandCode"].Value);
- text_InspectOperatType.Text = Convert.ToString(ulRow.Cells["InspectOperatType"].Value);
- text_jdeLevel.Text = Convert.ToString(ulRow.Cells["JdeLevel"].Value);
- text_standStartDate.Text = Convert.ToString(ulRow.Cells["StandStartDate"].Value);
- text_standEndDate.Text = Convert.ToString(ulRow.Cells["StandEndDate"].Value);
- text_InspectStandDesc.Text = Convert.ToString(ulRow.Cells["InspectStandDesc"].Value);
- text_elmCode.Text = Convert.ToString(ulRow.Cells["ElmCode"].Value);
- text_elmName.Text = Convert.ToString(ulRow.Cells["ElmName"].Value);
- // text_inspectStandCode.Text = Convert.ToString(ulRow.Cells["InspectStandCode"].Value);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "提示");
- }
- }
- }
- }
|