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; /// /// 部门ID集合 /// public string DeptId { get { return deptId; } set { deptId = value; } } private string deptName; /// /// 部门名称集合 /// 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; } } }