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