SercherOnGXCZ.cs 1.8 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. 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. InitializeComponent();
  17. }
  18. protected override void OnLoad(EventArgs e)
  19. {
  20. if (!ComsStatic.HasField(ComsStatic.dvJSLK, "cz"))
  21. {
  22. Sunny.UI.UIMessageTip.ShowError("当前矢量数据集没有材质信息");
  23. return;
  24. }
  25. ComsStatic.BindDataTableOnCheckedListBox(ComsStatic.dvJSLK, clb, "cz");
  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 cz is null ");
  37. else
  38. sql += string.Format(" OR cz='{0}'", str);
  39. }
  40. }
  41. #endregion
  42. return ComsStatic.QueryDataTable(ComsStatic.dvJSLK, sql, new string[] { "cz", "gj", "cd", "dzms", "qsdw" });
  43. }
  44. private void InitializeComponent()
  45. {
  46. this.clb = new System.Windows.Forms.CheckedListBox();
  47. this.SuspendLayout();
  48. //
  49. // clb
  50. //
  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(211, 157);
  55. this.clb.TabIndex = 0;
  56. //
  57. // SercherOnGXCZ
  58. //
  59. this.Controls.Add(this.clb);
  60. this.Name = "SercherOnGXCZ";
  61. this.Size = new System.Drawing.Size(211, 157);
  62. this.ResumeLayout(false);
  63. }
  64. }
  65. }