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