SercherOnGXGJ.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using SuperMap.Data;
  2. using System;
  3. using System.Collections.Generic;
  4. using WeifenLuo.WinFormsUI.Docking;
  5. using WWPipeLine.MapBasic.Conditions;
  6. using WWPipeLine.MapBasic;
  7. using System.Windows.Forms;
  8. namespace WWPipeLine.MapTools.Conditions.Sercher
  9. {
  10. public class SercherOnGXGJ : ConditionPanel
  11. {
  12. private CheckedListBox clb;
  13. public SercherOnGXGJ() : base()
  14. {
  15. this.ConditionPanelName = "按管线的管径查询";
  16. this.SetSize(200, 400);
  17. InitializeComponent();
  18. }
  19. protected override void OnLoad(EventArgs e)
  20. {
  21. if (!ComsStatic.HasField(ComsStatic.gsGuanXian, "gj"))
  22. {
  23. Sunny.UI.UIMessageTip.ShowError("当前矢量数据集没有管径信息"); return;
  24. }
  25. ComsStatic.BindDataTableOnCheckedListBox(ComsStatic.gsGuanXian, clb, "gj");
  26. }
  27. public override object Do(DockPanel dockPanel = null)
  28. {
  29. string sql = " 1=2 ";
  30. #region 组合AND OR 多选项查询条件
  31. if (clb.CheckedItems.Count > 0)
  32. {
  33. foreach (string str in clb.CheckedItems)
  34. {
  35. if (str == "未知")
  36. sql += string.Format(" OR gj is null ", str);
  37. else
  38. sql += string.Format(" OR gj='{0}' ", str);
  39. }
  40. }
  41. #endregion
  42. return ComsStatic.QueryDataTable(ComsStatic.gsGuanXian, sql, ComsStatic.resultFieldsGX);
  43. }
  44. private void InitializeComponent()
  45. {
  46. this.clb = new System.Windows.Forms.CheckedListBox();
  47. this.SuspendLayout();
  48. //
  49. // clb
  50. //
  51. this.clb.CheckOnClick = true;
  52. this.clb.Dock = System.Windows.Forms.DockStyle.Fill;
  53. this.clb.Location = new System.Drawing.Point(0, 0);
  54. this.clb.Name = "clb";
  55. this.clb.Size = new System.Drawing.Size(314, 155);
  56. this.clb.TabIndex = 0;
  57. //
  58. // SercherOnGXGJ
  59. //
  60. this.Controls.Add(this.clb);
  61. this.Name = "SercherOnGXGJ";
  62. this.Size = new System.Drawing.Size(314, 155);
  63. this.ResumeLayout(false);
  64. }
  65. }
  66. }