NameSelect.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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.Mcp.Mch.Mcms.entity;
  7. using CoreFS.CA06;
  8. namespace Core.StlMes.Client.Mcp.Mch.Mcms
  9. {
  10. public partial class NameSelect : FrmBase
  11. {
  12. public NameSelect(OpeBase _ob, string name,string text)
  13. {
  14. InitializeComponent();
  15. var dic = new Dictionary<string, object>();
  16. dic.Add("recordType", name == "OrderName"
  17. ? new List<string>() {"3"}
  18. : name == "ShippersName"
  19. ? new List<string>() {"4"}
  20. : name == "ReceiveName"
  21. ? new List<string>() {"5"}
  22. : name == "TransportName"
  23. ? new List<string>() {"6"}
  24. : new List<string>() {""});
  25. all = EntityHelper.GetData<CmmInputRecordEntity>(
  26. "com.steering.Mcms.InputRecordServer.doQuery", new object[] { dic },
  27. _ob);
  28. ugStation.DisplayLayout.Bands[0].Columns["RecordValue"].Header.Caption = text;
  29. cmmInputRecordEntityBindingSource.DataSource = all;
  30. }
  31. private CmmInputRecordEntity selectRow = null;
  32. private List<CmmInputRecordEntity> all;
  33. public CmmInputRecordEntity SelectRow
  34. {
  35. get { return selectRow; }
  36. set { selectRow = value; }
  37. }
  38. private void ugStation_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
  39. {
  40. selectRow = e.Row.ListObject as CmmInputRecordEntity;
  41. this.DialogResult = DialogResult.OK;
  42. }
  43. private void txtQuery_KeyUp(object sender, KeyEventArgs e)
  44. {
  45. if(all==null) return;
  46. cmmInputRecordEntityBindingSource.DataSource = string.IsNullOrWhiteSpace(txtQuery.Text.Trim()) ? all :
  47. all.Where(p => p.RecordValue.IndexOf(txtQuery.Text.Trim(), StringComparison.Ordinal) >= 0).ToList();
  48. ugStation.UpdateData();
  49. ugStation.Update();
  50. ugStation.Refresh();
  51. }
  52. }
  53. }