GradeSelect.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5. using Core.Mes.Client.Comm.Tool;
  6. using Core.StlMes.Client.LgResMgt.Mcms.entity;
  7. using CoreFS.CA06;
  8. namespace Core.StlMes.Client.LgResMgt.Mcms
  9. {
  10. public partial class GradeSelect : FrmBase
  11. {
  12. public GradeSelect(OpeBase _ob, List<ComBaseGradeEntity> list, string txt)
  13. {
  14. InitializeComponent();
  15. ob = _ob;
  16. lblShow.Text = txt;
  17. if (list==null || !list.Any())
  18. {
  19. list = EntityHelper.GetData<ComBaseGradeEntity>(
  20. "com.steering.Mcms.BlankPredictionServer.doQueryGrades",
  21. new object[] { },
  22. ob);
  23. }
  24. all = list;
  25. comBaseGradeEntityBindingSource.DataSource = list;
  26. }
  27. private ComBaseGradeEntity selectRow = null;
  28. private List<ComBaseGradeEntity> all;
  29. public ComBaseGradeEntity SelectRow
  30. {
  31. get { return selectRow; }
  32. set { selectRow = value; }
  33. }
  34. private void ugStation_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
  35. {
  36. selectRow = e.Row.ListObject as ComBaseGradeEntity;
  37. this.DialogResult = DialogResult.OK;
  38. }
  39. private void txtQuery_KeyUp(object sender, KeyEventArgs e)
  40. {
  41. if(all==null) return;
  42. comBaseGradeEntityBindingSource.DataSource = string.IsNullOrWhiteSpace(txtQuery.Text.Trim()) ? all :
  43. all.Where(p => p.Gradename.IndexOf(txtQuery.Text.Trim(), StringComparison.Ordinal) >= 0).ToList();
  44. ugStation.UpdateData();
  45. ugStation.Update();
  46. ugStation.Refresh();
  47. }
  48. }
  49. }