12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- using SuperMap.Data;
- using System;
- using System.Collections.Generic;
- using WeifenLuo.WinFormsUI.Docking;
- using WWPipeLine.MapBasic.Conditions;
- using WWPipeLine.MapBasic;
- namespace WWPipeLine.MapTools.Conditions
- {
- public class SercherOnGXDZMS : ConditionPanel
- {
- private DatasetVector _dv;
- private System.Windows.Forms.CheckedListBox clb;
- private DatasetVectorEx _dvEx;
- public SercherOnGXDZMS() : base()
- {
- this.ConditionPanelName = "按管线的地址描述查询";
- InitializeComponent();
- }
- protected override void OnLoad(EventArgs e)
- {
- _dv = this.DatasourceMapControl.Datasets["JSLK"] as DatasetVector;
- if (_dv == null)
- {
- Sunny.UI.UIMessageTip.ShowError("当前数据源中不包含相应的矢量数据集");
- return;
- }
- _dvEx = new DatasetVectorEx(_dv.Name) { DatasetVector = _dv };
- if (!_dvEx.HasField("dzms"))
- {
- Sunny.UI.UIMessageTip.ShowError("当前矢量数据集没有地址描述信息");
- return;
- }
- BindDataTableOnCheckedListBox(_dvEx, clb, "dzms");
- }
- public override object Do(DockPanel dockPanel = null)
- {
- string sql = " 1=1 ";
- #region 组合AND OR 多选项查询条件
- if (clb.SelectedItems.Count > 0)
- {
- sql += " AND (1=2 ";
- foreach (string str in clb.SelectedItems)
- {
- sql += string.Format(" OR dzms='{0}'", str);
- }
- sql += " ) ";
- }
- #endregion
- _dvEx = new DatasetVectorEx("管线") { DatasetVector = _dv };
- _dvEx.ResultFields.AddRange(new string[] { "cz", "gj", "cd", "dzms", "qsdw" });
- return _dvEx.Query(sql);
- }
- private void InitializeComponent()
- {
- this.clb = new System.Windows.Forms.CheckedListBox();
- this.SuspendLayout();
- //
- // clb
- //
- this.clb.Dock = System.Windows.Forms.DockStyle.Fill;
- this.clb.Location = new System.Drawing.Point(0, 0);
- this.clb.Name = "clb";
- this.clb.Size = new System.Drawing.Size(500, 300);
- this.clb.TabIndex = 0;
- //
- // SercherOnGXDZMS
- //
- this.Controls.Add(this.clb);
- this.Name = "SercherOnGXDZMS";
- this.Size = new System.Drawing.Size(500, 300);
- this.ResumeLayout(false);
- }
- }
- }
|