ComBaseStationPopup.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using CoreFS.CA06;
  2. using Infragistics.Win.UltraWinGrid;
  3. using System;
  4. using System.Data;
  5. using System.Linq;
  6. namespace Core.StlMes.Client.Qcm
  7. {
  8. public partial class ComBaseStationPopup : FrmBase
  9. {
  10. private FrmControlPointBasics _frm = new FrmControlPointBasics();
  11. private string _stationCodes = "";
  12. private string _stationNames = "";
  13. public string StationNames
  14. {
  15. get { return _stationNames; }
  16. set { _stationNames = value; }
  17. }
  18. public string StationCodes
  19. {
  20. get { return _stationCodes; }
  21. set { _stationCodes = value; }
  22. }
  23. public ComBaseStationPopup(string stationType, string stationCodes, string stationNames, OpeBase ob)
  24. {
  25. InitializeComponent();
  26. _stationCodes = stationCodes;
  27. _stationNames = stationNames;
  28. this.ob = ob;
  29. _frm.PopupLoad(ob);
  30. _frm.StationType = stationType;
  31. this.panel1.Controls.Add(_frm.UltraGrid2);
  32. _frm.UltraGrid2.DisplayLayout.Bands[0].Columns["CHK2"].Hidden = false;
  33. _frm.ToolBar_Click(null, "doQuery");
  34. SetChk();
  35. _frm.UltraGrid2.UpdateData();
  36. }
  37. private void SetChk()
  38. {
  39. string[] stationCodes = _stationCodes.Split(';');
  40. foreach (UltraGridRow row in _frm.UltraGrid2.Rows)
  41. {
  42. if (stationCodes.Contains(row.GetValue("STATION_CODE")))
  43. {
  44. row.SetValue("CHK2", "True");
  45. }
  46. }
  47. }
  48. private void ultraButton1_Click(object sender, EventArgs e)
  49. {
  50. _frm.UltraGrid2.UpdateData();
  51. IQueryable<UltraGridRow> rows = _frm.UltraGrid2.Rows.AsQueryable().Where("CHK2 = 'True'");
  52. _stationCodes = "";
  53. _stationNames = "";
  54. foreach (UltraGridRow row in rows)
  55. {
  56. _stationCodes += row.GetValue("STATION_CODE") + ";";
  57. _stationNames += row.GetValue("STATION_DESC") + ";";
  58. }
  59. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  60. }
  61. private void ultraButton2_Click(object sender, EventArgs e)
  62. {
  63. this.Close();
  64. }
  65. }
  66. }