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.Collections.Generic; using System.Data; using System.Linq; namespace Core.StlMes.Client.Qcm { public partial class ChoiceProcessPopup : FrmBase { private OpeBase _ob; private string _processCodes = ""; private bool _isQuerying = false; public string ProcessCodes { get { return _processCodes; } set { _processCodes = value; } } private string _processDescs = ""; public string ProcessDescs { get { return _processDescs; } set { _processDescs = value; } } public ChoiceProcessPopup(string processCodes, OpeBase ob) { InitializeComponent(); _ob = ob; _processCodes = processCodes; } private void ChoiceProcessPopup_Load(object sender, EventArgs e) { GetAllProcess(); } private void GetAllProcess() { _isQuerying = true; DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreProcessBasics.getAllProcess", null, _ob); GridHelper.CopyDataToDatatable(dt, dataTable1, true); string[] processsCodes = _processCodes.Split(','); for (int i = 0; i < processsCodes.Length; i++) { processsCodes[i] = processsCodes[i].Trim(); } foreach (UltraGridRow row in ultraGrid1.Rows) { if (processsCodes.Contains(row.GetValue("PROCESS_CODE"))) { row.Cells["CHK"].Value = true; } } ultraGrid1.UpdateData(); _isQuerying = false; } private void button1_Click(object sender, EventArgs e) { List rows = ultraGrid1.Rows.AsQueryable().Where("CHK = 'True'").ToList(); if (rows.Count() == 0) { MessageUtil.ShowWarning("请选择一条记录!"); return; } for (int i = 0; i < rows.Count(); i++) { if (i == 0) { _processCodes = rows[i].GetValue("PROCESS_CODE"); _processDescs = rows[i].GetValue("PROCESS_DESC"); } else { _processCodes += "," + rows[i].GetValue("PROCESS_CODE"); _processDescs += "," + rows[i].GetValue("PROCESS_DESC"); } } this.DialogResult = System.Windows.Forms.DialogResult.OK; } private void button2_Click(object sender, EventArgs e) { this.DialogResult = System.Windows.Forms.DialogResult.Cancel; } private void ultraGrid1_CellChange(object sender, CellEventArgs e) { ultraGrid1.UpdateData(); } private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e) { } } }