| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- 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 FrmTpopi24 : FrmBase
- {
- public FrmTpopi24()
- {
- InitializeComponent();
- EntityHelper.ShowGridCaption<Tpopi24Entity>(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":
- doAdd();
- break;
- case "Update":
- doUpdate();
- 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<Tpopi24Entity> listSource = EntityHelper.GetData<Tpopi24Entity>(
- "com.steering.lims.data.pipe.Tpopi24.doQuery", new object[] { text_code.Text, text_name.Text }, this.ob);
- Tpopi24bindingSource.DataSource = listSource;
- //for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- //{
- // UltraGridRow row = ultraGrid1.Rows[i];
- //}
- }
- private void doAdd()
- {
- 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)
- {
- Tpopi24Entity entity = row.ListObject as Tpopi24Entity;
- if (String.IsNullOrEmpty(entity.ElmCode))
- {
- MessageUtil.ShowTips("请输入试验号");
- return;
- }
- if (String.IsNullOrEmpty(entity.ElmName))
- {
- MessageUtil.ShowTips("请输入试验名称");
- return;
- }
- //if (!String.IsNullOrEmpty(entity.Id))
- // continue;
- entity.RecCreator = UserInfo.GetUserName();
- //entity.PhyDept = UserInfo.GetDeptid();
- // entity. = UserInfo.GetDepartment();
- string baseEntity = JSONFormat.Format(entity);
- parmList.Add(baseEntity);
- }
- if (parmList.Count > 0)
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.lims.data.pipe.Tpopi24";
- ccp.MethodName = "doAdd";
- ccp.ServerParams = new object[] { parmList };
- 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)
- {
- Tpopi24Entity entity = row.ListObject as Tpopi24Entity;
- if (String.IsNullOrEmpty(entity.ObjId))
- 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.Tpopi24";
- 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)
- {
- Tpopi24Entity entity = row.ListObject as Tpopi24Entity;
- if (String.IsNullOrEmpty(entity.ObjId))
- 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.Tpopi24";
- ccp.MethodName = "doDelete";
- ccp.ServerParams = new object[] { parmList };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- doQuery();
- MessageUtil.ShowTips("删除成功!");
- }
- }
- }
- private void FrmTpopi24_Load(object sender, EventArgs e)
- {
- doQuery();
- }
- }
- }
|