using SuperMap.Data; using SuperMap.Mapping; using SuperMap.UI; using System; using System.Collections.Generic; using System.Data; using System.Drawing; using WeifenLuo.WinFormsUI.Docking; using WWPipeLine.MapBasic.Conditions; using WWPipeLine.MapBasic; using System.Windows.Forms; namespace WWPipeLine.MapTools.Conditions.Locations { public class SearchOnJDPT : ConditionPanel { public SearchOnJDPT() : base() { this.ConditionPanelName = "按照供水节点组合查询"; this.SetSize(800, 400); InitializeComponent(); } private DatasetVector _dv = ComsStatic.dvJSJDPT; private GroupBox groupBox1; private CheckedListBox clbDZMS; private GroupBox groupBox2; private CheckedListBox clbCZ; private GroupBox groupBox3; private CheckedListBox clbXH; private GroupBox groupBox4; private CheckedListBox clbGG; protected override void OnLoad(EventArgs e) { if (_dv == null) { Sunny.UI.UIMessageTip.ShowError("当前数据源中不包含相应的矢量数据集", 5000); this.ParentForm.Close(); return; } if (!ComsStatic.HasField(_dv, "xh") || !ComsStatic.HasField(_dv, "cz") || !ComsStatic.HasField(_dv, "gg") || !ComsStatic.HasField(_dv, "dzms")) { Sunny.UI.UIMessageTip.ShowError("当前矢量数据集没有相应的信息", 5000); this.ParentForm.Close(); return; } ComsStatic.BindDataTableOnCheckedListBox(_dv, clbXH, "xh"); ComsStatic.BindDataTableOnCheckedListBox(_dv, clbCZ, "cz"); ComsStatic.BindDataTableOnCheckedListBox(_dv, clbGG, "gg"); ComsStatic.BindDataTableOnCheckedListBox(_dv, clbDZMS, "dzms"); } public override object Do(DockPanel dockPanel = null) { string sql = " 1=1 "; #region 组合AND OR 多选项查询条件 if (clbXH.CheckedItems.Count > 0) { sql += " AND (1=2 "; foreach (string str in clbXH.CheckedItems) { sql += string.Format(" OR XH='{0}'", str); } sql += " ) "; } if (clbCZ.CheckedItems.Count > 0) { sql += " AND (1=2 "; foreach (string str in clbCZ.CheckedItems) { sql += string.Format(" OR CZ='{0}'", str); } sql += " ) "; } if (clbGG.CheckedItems.Count > 0) { sql += " AND (1=2 "; foreach (string str in clbGG.CheckedItems) { sql += string.Format(" OR GG='{0}'", str); } sql += " ) "; } if (clbDZMS.CheckedItems.Count > 0) { sql += " AND (1=2 "; foreach (string str in clbDZMS.CheckedItems) { sql += string.Format(" OR DZMS='{0}'", str); } sql += " ) "; } #endregion return ComsStatic.QueryDataTable(_dv, sql, new string[] { "xh", "cz", "gg", "dzms", "fldm", "sblx", "yl", "ms" }); } #region 界面布局 private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); this.clbDZMS = new System.Windows.Forms.CheckedListBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.clbCZ = new System.Windows.Forms.CheckedListBox(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.clbXH = new System.Windows.Forms.CheckedListBox(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.clbGG = new System.Windows.Forms.CheckedListBox(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); this.groupBox4.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Controls.Add(this.clbDZMS); this.groupBox1.Location = new System.Drawing.Point(601, 5); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(194, 350); this.groupBox1.TabIndex = 14; this.groupBox1.TabStop = false; this.groupBox1.Text = "地址描述"; // // clbDZMS // this.clbDZMS.Dock = System.Windows.Forms.DockStyle.Fill; this.clbDZMS.Location = new System.Drawing.Point(3, 25); this.clbDZMS.Name = "clbDZMS"; this.clbDZMS.Size = new System.Drawing.Size(188, 322); this.clbDZMS.TabIndex = 0; // // groupBox2 // this.groupBox2.Controls.Add(this.clbCZ); this.groupBox2.Location = new System.Drawing.Point(205, 5); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(194, 350); this.groupBox2.TabIndex = 15; this.groupBox2.TabStop = false; this.groupBox2.Text = "材质"; // // clbCZ // this.clbCZ.Dock = System.Windows.Forms.DockStyle.Fill; this.clbCZ.Location = new System.Drawing.Point(3, 25); this.clbCZ.Name = "clbCZ"; this.clbCZ.Size = new System.Drawing.Size(188, 322); this.clbCZ.TabIndex = 0; // // groupBox3 // this.groupBox3.Controls.Add(this.clbXH); this.groupBox3.Location = new System.Drawing.Point(7, 5); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(194, 350); this.groupBox3.TabIndex = 15; this.groupBox3.TabStop = false; this.groupBox3.Text = "型号"; // // clbXH // this.clbXH.Dock = System.Windows.Forms.DockStyle.Fill; this.clbXH.Location = new System.Drawing.Point(3, 25); this.clbXH.Name = "clbXH"; this.clbXH.Size = new System.Drawing.Size(188, 322); this.clbXH.TabIndex = 0; // // groupBox4 // this.groupBox4.Controls.Add(this.clbGG); this.groupBox4.Location = new System.Drawing.Point(403, 5); this.groupBox4.Name = "groupBox4"; this.groupBox4.Size = new System.Drawing.Size(194, 350); this.groupBox4.TabIndex = 15; this.groupBox4.TabStop = false; this.groupBox4.Text = "规格"; // // clbGG // this.clbGG.Dock = System.Windows.Forms.DockStyle.Fill; this.clbGG.Location = new System.Drawing.Point(3, 25); this.clbGG.Name = "clbGG"; this.clbGG.Size = new System.Drawing.Size(188, 322); this.clbGG.TabIndex = 0; // // SearchOnJDPT // this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox1); this.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(244))))); this.Name = "SearchOnJDPT"; this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(140)))), ((int)(((byte)(140)))), ((int)(((byte)(140))))); this.Size = new System.Drawing.Size(800, 379); this.Style = Sunny.UI.UIStyle.Gray; this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.groupBox3.ResumeLayout(false); this.groupBox4.ResumeLayout(false); this.ResumeLayout(false); } #endregion } }