| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Data;
- using System.Linq;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Qcm
- {
- public partial class FrmMaterialAdministrationSub : FrmBase
- {
- public FrmMaterialAdministrationSub()
- {
- InitializeComponent();
- }
- public FrmMaterialAdministrationSub(OpeBase _ob)
- {
- InitializeComponent();
- this.ob = _ob;
- }
- private string deptId;
- /// <summary>
- /// 部门ID集合
- /// </summary>
- public string DeptId
- {
- get { return deptId; }
- set { deptId = value; }
- }
- private string deptName;
- /// <summary>
- /// 部门名称集合
- /// </summary>
- public string DeptName
- {
- get { return deptName; }
- set { deptName = value; }
- }
- private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "Query":
- Init();
- break;
- case "Confirm":
- Confirm();
- break;
- case "Cancel":
- this.Close();
- break;
- }
- }
- private void Init()
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreMaterialAdministrationSub.query", null, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
- if (deptId != "")
- {
- string[] dept = deptId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
- foreach (UltraGridRow row in gdDept.Rows)
- {
- if (dept.Contains(row.Cells["PHY_DEPTID"].Value.ToString()))
- {
- row.Cells["CHK"].Value = true;
- }
- }
- gdDept.UpdateData();
- }
- }
- private void FrmMaterialAdministrationSub_Load(object sender, EventArgs e)
- {
- Init();
- }
- private void Confirm()
- {
- gdDept.UpdateData();
- UltraGridRow[] row = gdDept.Rows.AsQueryable().Where(a => a.Cells["CHK"].Value.ToString().ToUpper() == "TRUE").ToArray();
- if (row.Length <= 0)
- {
- MessageUtil.ShowWarning("请选择科室!");
- return;
- }
- string deptCode = "";
- string deptDesc = "";
- foreach (var uRow in row)
- {
- deptCode = deptCode + "," + uRow.Cells["PHY_DEPTID"].Value.ToString();
- deptDesc = deptDesc + "," + uRow.Cells["PHY_DEPTNAME"].Value.ToString();
- }
- deptCode = deptCode.Remove(0, 1);
- deptDesc = deptDesc.Remove(0, 1);
- this.DeptId = deptCode;
- this.DeptName = deptDesc;
- DialogResult = DialogResult.OK;
- }
- }
- }
|