ComMscCtrl.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using Core.Mes.Client.Comm.Tool;
  2. using Core.StlMes.Client.Qcm.BLL;
  3. using Core.StlMes.Client.Qcm.model;
  4. using CoreFS.CA06;
  5. using Infragistics.Win.UltraWinGrid;
  6. using System;
  7. using System.Data;
  8. using System.Linq;
  9. using System.Windows.Forms;
  10. namespace Core.StlMes.Client.Qcm.Control
  11. {
  12. public partial class ComMscCtrl : UserControl
  13. {
  14. private ComMscBLL _mscBll;
  15. public ComMscCtrl(System.Windows.Forms.Control container, OpeBase ob)
  16. {
  17. InitializeComponent();
  18. _mscBll = new ComMscBLL(ob);
  19. container.Controls.Add(this);
  20. this.Dock = DockStyle.Fill;
  21. EntityHelper.ShowGridCaption<ComMscEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  22. }
  23. public void Query(ComMscEntity comMscEntity)
  24. {
  25. this.comMscEntityBindingSource.DataSource = _mscBll.query(comMscEntity);
  26. }
  27. public void QueryByPsc(string psc)
  28. {
  29. this.comMscEntityBindingSource.DataSource = _mscBll.queryByPsc(psc);
  30. }
  31. private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  32. {
  33. ultraGrid1.UpdateData();
  34. if (e.Cell.Column.Key == "CHK")
  35. {
  36. if (e.Cell.Value.ToString() == "True")
  37. {
  38. IQueryable<UltraGridRow> rows = ultraGrid1.Rows.AsQueryable().Where(
  39. a => a.GetValue("CHK") == "True" && a != e.Cell.Row);
  40. if (rows.Count() > 0)
  41. {
  42. rows.First().Cells["CHK"].Value = false;
  43. }
  44. }
  45. }
  46. ultraGrid1.UpdateData();
  47. }
  48. }
  49. }