SercherOnGXDZMS.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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
  8. {
  9. public class SercherOnGXDZMS : ConditionPanel
  10. {
  11. private DatasetVector _dv;
  12. private System.Windows.Forms.CheckedListBox clb;
  13. private DatasetVectorEx _dvEx;
  14. public SercherOnGXDZMS() : base()
  15. {
  16. this.ConditionPanelName = "按管线的地址描述查询";
  17. InitializeComponent();
  18. }
  19. protected override void OnLoad(EventArgs e)
  20. {
  21. _dv = this.DatasourceMapControl.Datasets["JSLK"] as DatasetVector;
  22. if (_dv == null)
  23. {
  24. Sunny.UI.UIMessageTip.ShowError("当前数据源中不包含相应的矢量数据集");
  25. return;
  26. }
  27. _dvEx = new DatasetVectorEx(_dv.Name) { DatasetVector = _dv };
  28. if (!_dvEx.HasField("dzms"))
  29. {
  30. Sunny.UI.UIMessageTip.ShowError("当前矢量数据集没有地址描述信息");
  31. return;
  32. }
  33. BindDataTableOnCheckedListBox(_dvEx, clb, "dzms");
  34. }
  35. public override object Do(DockPanel dockPanel = null)
  36. {
  37. string sql = " 1=1 ";
  38. #region 组合AND OR 多选项查询条件
  39. if (clb.SelectedItems.Count > 0)
  40. {
  41. sql += " AND (1=2 ";
  42. foreach (string str in clb.SelectedItems)
  43. {
  44. sql += string.Format(" OR dzms='{0}'", str);
  45. }
  46. sql += " ) ";
  47. }
  48. #endregion
  49. _dvEx = new DatasetVectorEx("管线") { DatasetVector = _dv };
  50. _dvEx.ResultFields.AddRange(new string[] { "cz", "gj", "cd", "dzms", "qsdw" });
  51. return _dvEx.Query(sql);
  52. }
  53. private void InitializeComponent()
  54. {
  55. this.clb = new System.Windows.Forms.CheckedListBox();
  56. this.SuspendLayout();
  57. //
  58. // clb
  59. //
  60. this.clb.Dock = System.Windows.Forms.DockStyle.Fill;
  61. this.clb.Location = new System.Drawing.Point(0, 0);
  62. this.clb.Name = "clb";
  63. this.clb.Size = new System.Drawing.Size(500, 300);
  64. this.clb.TabIndex = 0;
  65. //
  66. // SercherOnGXDZMS
  67. //
  68. this.Controls.Add(this.clb);
  69. this.Name = "SercherOnGXDZMS";
  70. this.Size = new System.Drawing.Size(500, 300);
  71. this.ResumeLayout(false);
  72. }
  73. }
  74. }