SercherOnGXDZMS.cs 1.9 KB

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