using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Qcm.BLL; using Core.StlMes.Client.Qcm.model; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; using System; using System.Data; using System.Linq; using System.Windows.Forms; namespace Core.StlMes.Client.Qcm.Control { public partial class ComMscCtrl : UserControl { private ComMscBLL _mscBll; public ComMscCtrl(System.Windows.Forms.Control container, OpeBase ob) { InitializeComponent(); _mscBll = new ComMscBLL(ob); container.Controls.Add(this); this.Dock = DockStyle.Fill; EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); } public void Query(ComMscEntity comMscEntity) { this.comMscEntityBindingSource.DataSource = _mscBll.query(comMscEntity); } public void QueryByPsc(string psc) { this.comMscEntityBindingSource.DataSource = _mscBll.queryByPsc(psc); } private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { ultraGrid1.UpdateData(); if (e.Cell.Column.Key == "CHK") { if (e.Cell.Value.ToString() == "True") { IQueryable rows = ultraGrid1.Rows.AsQueryable().Where( a => a.GetValue("CHK") == "True" && a != e.Cell.Row); if (rows.Count() > 0) { rows.First().Cells["CHK"].Value = false; } } } ultraGrid1.UpdateData(); } } }