using SuperMap.Data; using System; using System.Collections.Generic; using WeifenLuo.WinFormsUI.Docking; using WWPipeLine.MapBasic.Conditions; using WWPipeLine.MapBasic; using Sunny.UI; using System.Windows.Forms; using System.Data; namespace WWPipeLine.MapTools.Conditions.XiTongGuanLi { public class PeiZhiFuTu : ConditionPanel { private Sunny.UI.UIDataGridView uiDGVjslkpz; private Sunny.UI.UIPanel uiPanel1; private Sunny.UI.UIButton uiButton3; private Sunny.UI.UIButton uiButton2; private Sunny.UI.UIButton uiButton1; private Sunny.UI.UILabel uiLabel1; private Sunny.UI.UILabel uiLabel2; private Sunny.UI.UITextBox uiTBms; private Sunny.UI.UIPanel uiPanel2; private Sunny.UI.UIComboBox uiCBcz; private Recordset _rd; private Sunny.UI.UILabel uiLBsmid; private int _rdsmid = 0; private DataTable m_dt; public PeiZhiFuTu() : base() { this.ConditionPanelName = "管线覆土预警配置"; InitializeComponent(); IsShowPanelFooter = false; } protected override void OnLoad(EventArgs e) { QueryParameter queryParameter = new QueryParameter { AttributeFilter = " pzlx='覆土配置' ", ResultFields = new string[] { "smid", "gxlx", "pzlx", "gxcz", "gxms" }, OrderBy = new string[] { "smid" }, CursorType = CursorType.Dynamic, HasGeometry = true }; _rd = ComsStatic.dvJSLK_PZ.Query(queryParameter); m_dt = ComsStatic.RecordsetToDataTable(_rd); ComsStatic.setUIDataGridView(uiDGVjslkpz, m_dt); ComsStatic.BindDataTableOnComboBox(ComsStatic.dvJSLK, uiCBcz, "cz"); } private void uiButton3_Click(object sender, EventArgs e) { if (_rdsmid == 0) { UIMessageTip.ShowError("请先选择需要删除的信息!"); return; } if (_rd.SeekID(_rdsmid)) { ComsStatic.ShowUIMessageTipOKorError(_rd.Delete(), "管线覆土配置删除"); OnLoad(e); } else { Sunny.UI.UIMessageTip.ShowError("信息在删除选择时失败!"); } } private void uiButton2_Click(object sender, EventArgs e) { string strCZ = uiCBcz.SelectedItem?.ToString(); if (string.IsNullOrEmpty(uiTBms.Text) || uiTBms.Text == "0" || string.IsNullOrEmpty(strCZ)) { UIMessageTip.ShowError("请输入正确的覆土数据!"); return; } if (_rd.SeekID(_rdsmid)) { _rd.Edit(); _rd.SetFieldValue("gxcz", uiCBcz.SelectedItem); _rd.SetFieldValue("gxms", ComsStatic.StringToDouble(uiTBms.Text)); ComsStatic.ShowUIMessageTipOKorError(_rd.Update(), "管线覆土配置编辑"); OnLoad(e); } else { Sunny.UI.UIMessageTip.ShowError("信息在编辑选择时失败!"); } } public override void AfterClose() { ComsStatic.RecordsetDispose(_rd); base.AfterClose(); } private void uiButton1_Click(object sender, EventArgs e) { string strCZ = uiCBcz.SelectedItem?.ToString(); if (string.IsNullOrEmpty(uiTBms.Text) || uiTBms.Text == "0" || string.IsNullOrEmpty(strCZ)) { UIMessageTip.ShowError("请输入正确的覆土数据!"); return; } if (m_dt.Select(string.Format(" gxcz='{0}'", strCZ)).Length > 0) { UIMessageTip.ShowError("已经存在管线的覆土信息!"); return; } _rd.AddNew(new GeoPoint(0, 0)); _rd.SetFieldValue("gxlx", "供水管线"); _rd.SetFieldValue("pzlx", "覆土配置"); _rd.SetFieldValue("gxcz", strCZ); _rd.SetFieldValue("gxms", ComsStatic.StringToDouble(uiTBms.Text)); ComsStatic.ShowUIMessageTipOKorError(_rd.Update(), "管线覆土配置新增"); OnLoad(e); } private void uiTextBox2_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if ((e.KeyChar < 48 || e.KeyChar > 57) &&(e.KeyChar != 8)) e.Handled = true; } private void uiDGVjslkpz_SelectIndexChange(object sender, int index) { var selectRows = (sender as UIDataGridView).SelectedRows; if (selectRows == null || selectRows.Count != 1) return; _rdsmid = ComsStatic.StringToInt(selectRows[0].Cells["SmID"].Value.ToString()); if (_rdsmid != 0 && _rd.SeekID(_rdsmid)) { uiLBsmid.Text = _rd.GetFieldValue("smid")?.ToString(); uiCBcz.SelectedItem = _rd.GetFieldValue("gxcz")?.ToString(); uiTBms.Text = _rd.GetFieldValue("gxms")?.ToString(); } else { Sunny.UI.UIMessageTip.ShowError("信息错误!"); } } private void InitializeComponent() { System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); this.uiDGVjslkpz = new Sunny.UI.UIDataGridView(); this.uiPanel1 = new Sunny.UI.UIPanel(); this.uiPanel2 = new Sunny.UI.UIPanel(); this.uiLBsmid = new Sunny.UI.UILabel(); this.uiCBcz = new Sunny.UI.UIComboBox(); this.uiTBms = new Sunny.UI.UITextBox(); this.uiLabel2 = new Sunny.UI.UILabel(); this.uiLabel1 = new Sunny.UI.UILabel(); this.uiButton3 = new Sunny.UI.UIButton(); this.uiButton2 = new Sunny.UI.UIButton(); this.uiButton1 = new Sunny.UI.UIButton(); ((System.ComponentModel.ISupportInitialize)(this.uiDGVjslkpz)).BeginInit(); this.uiPanel1.SuspendLayout(); this.uiPanel2.SuspendLayout(); this.SuspendLayout(); // // uiDGVjslkpz // dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255))))); this.uiDGVjslkpz.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6; this.uiDGVjslkpz.BackgroundColor = System.Drawing.Color.White; this.uiDGVjslkpz.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); dataGridViewCellStyle7.Font = new System.Drawing.Font("微软雅黑", 12F); dataGridViewCellStyle7.ForeColor = System.Drawing.Color.White; dataGridViewCellStyle7.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.uiDGVjslkpz.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7; this.uiDGVjslkpz.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Window; dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 12F); dataGridViewCellStyle8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(200)))), ((int)(((byte)(255))))); dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False; this.uiDGVjslkpz.DefaultCellStyle = dataGridViewCellStyle8; this.uiDGVjslkpz.Dock = System.Windows.Forms.DockStyle.Fill; this.uiDGVjslkpz.EnableHeadersVisualStyles = false; this.uiDGVjslkpz.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiDGVjslkpz.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); this.uiDGVjslkpz.Location = new System.Drawing.Point(0, 0); this.uiDGVjslkpz.Name = "uiDGVjslkpz"; dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255))))); dataGridViewCellStyle9.Font = new System.Drawing.Font("微软雅黑", 12F); dataGridViewCellStyle9.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255))))); dataGridViewCellStyle9.SelectionForeColor = System.Drawing.Color.White; dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.uiDGVjslkpz.RowHeadersDefaultCellStyle = dataGridViewCellStyle9; dataGridViewCellStyle10.BackColor = System.Drawing.Color.White; this.uiDGVjslkpz.RowsDefaultCellStyle = dataGridViewCellStyle10; this.uiDGVjslkpz.RowTemplate.Height = 23; this.uiDGVjslkpz.SelectedIndex = -1; this.uiDGVjslkpz.ShowGridLine = true; this.uiDGVjslkpz.Size = new System.Drawing.Size(500, 350); this.uiDGVjslkpz.TabIndex = 0; this.uiDGVjslkpz.SelectIndexChange += new Sunny.UI.UIDataGridView.OnSelectIndexChange(this.uiDGVjslkpz_SelectIndexChange); // // uiPanel1 // this.uiPanel1.Controls.Add(this.uiDGVjslkpz); this.uiPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.uiPanel1.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiPanel1.Location = new System.Drawing.Point(0, 0); this.uiPanel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.uiPanel1.MinimumSize = new System.Drawing.Size(1, 1); this.uiPanel1.Name = "uiPanel1"; this.uiPanel1.Size = new System.Drawing.Size(500, 350); this.uiPanel1.TabIndex = 1; this.uiPanel1.Text = "uiPanel1"; this.uiPanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; // // uiPanel2 // this.uiPanel2.Controls.Add(this.uiLBsmid); this.uiPanel2.Controls.Add(this.uiCBcz); this.uiPanel2.Controls.Add(this.uiTBms); this.uiPanel2.Controls.Add(this.uiLabel2); this.uiPanel2.Controls.Add(this.uiLabel1); this.uiPanel2.Controls.Add(this.uiButton3); this.uiPanel2.Controls.Add(this.uiButton2); this.uiPanel2.Controls.Add(this.uiButton1); this.uiPanel2.Dock = System.Windows.Forms.DockStyle.Bottom; this.uiPanel2.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiPanel2.Location = new System.Drawing.Point(0, 254); this.uiPanel2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.uiPanel2.MinimumSize = new System.Drawing.Size(1, 1); this.uiPanel2.Name = "uiPanel2"; this.uiPanel2.Size = new System.Drawing.Size(500, 96); this.uiPanel2.TabIndex = 2; this.uiPanel2.Text = null; this.uiPanel2.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; // // uiLBsmid // this.uiLBsmid.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiLBsmid.Location = new System.Drawing.Point(3, 62); this.uiLBsmid.Name = "uiLBsmid"; this.uiLBsmid.Size = new System.Drawing.Size(59, 23); this.uiLBsmid.TabIndex = 11; this.uiLBsmid.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.uiLBsmid.Visible = false; // // uiCBcz // this.uiCBcz.DataSource = null; this.uiCBcz.FillColor = System.Drawing.Color.White; this.uiCBcz.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiCBcz.Location = new System.Drawing.Point(97, 7); this.uiCBcz.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.uiCBcz.MinimumSize = new System.Drawing.Size(63, 0); this.uiCBcz.Name = "uiCBcz"; this.uiCBcz.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2); this.uiCBcz.Size = new System.Drawing.Size(85, 29); this.uiCBcz.TabIndex = 9; this.uiCBcz.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; // // uiTBms // this.uiTBms.Cursor = System.Windows.Forms.Cursors.IBeam; this.uiTBms.FillColor = System.Drawing.Color.White; this.uiTBms.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiTBms.Location = new System.Drawing.Point(301, 7); this.uiTBms.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.uiTBms.Maximum = 2147483647D; this.uiTBms.MaxLength = 4; this.uiTBms.Minimum = -2147483648D; this.uiTBms.MinimumSize = new System.Drawing.Size(1, 1); this.uiTBms.Name = "uiTBms"; this.uiTBms.Size = new System.Drawing.Size(85, 29); this.uiTBms.TabIndex = 7; this.uiTBms.Text = "0"; this.uiTBms.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; this.uiTBms.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.uiTextBox2_KeyPress); // // uiLabel2 // this.uiLabel2.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiLabel2.Location = new System.Drawing.Point(207, 7); this.uiLabel2.Name = "uiLabel2"; this.uiLabel2.Size = new System.Drawing.Size(85, 29); this.uiLabel2.TabIndex = 4; this.uiLabel2.Text = "标准埋深"; this.uiLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // uiLabel1 // this.uiLabel1.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiLabel1.Location = new System.Drawing.Point(3, 7); this.uiLabel1.Name = "uiLabel1"; this.uiLabel1.Size = new System.Drawing.Size(85, 29); this.uiLabel1.TabIndex = 3; this.uiLabel1.Text = "管线材质"; this.uiLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // uiButton3 // this.uiButton3.Cursor = System.Windows.Forms.Cursors.Hand; this.uiButton3.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiButton3.Location = new System.Drawing.Point(375, 50); this.uiButton3.MinimumSize = new System.Drawing.Size(1, 1); this.uiButton3.Name = "uiButton3"; this.uiButton3.Size = new System.Drawing.Size(100, 35); this.uiButton3.TabIndex = 2; this.uiButton3.Text = "删除"; this.uiButton3.Click += new System.EventHandler(this.uiButton3_Click); // // uiButton2 // this.uiButton2.Cursor = System.Windows.Forms.Cursors.Hand; this.uiButton2.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiButton2.Location = new System.Drawing.Point(250, 50); this.uiButton2.MinimumSize = new System.Drawing.Size(1, 1); this.uiButton2.Name = "uiButton2"; this.uiButton2.Size = new System.Drawing.Size(100, 35); this.uiButton2.TabIndex = 1; this.uiButton2.Text = "修改"; this.uiButton2.Click += new System.EventHandler(this.uiButton2_Click); // // uiButton1 // this.uiButton1.Cursor = System.Windows.Forms.Cursors.Hand; this.uiButton1.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiButton1.Location = new System.Drawing.Point(125, 50); this.uiButton1.MinimumSize = new System.Drawing.Size(1, 1); this.uiButton1.Name = "uiButton1"; this.uiButton1.Size = new System.Drawing.Size(100, 35); this.uiButton1.TabIndex = 0; this.uiButton1.Text = "新增"; this.uiButton1.Click += new System.EventHandler(this.uiButton1_Click); // // PeiZhiFuTu // this.Controls.Add(this.uiPanel2); this.Controls.Add(this.uiPanel1); this.Name = "PeiZhiFuTu"; this.Size = new System.Drawing.Size(500, 350); ((System.ComponentModel.ISupportInitialize)(this.uiDGVjslkpz)).EndInit(); this.uiPanel1.ResumeLayout(false); this.uiPanel2.ResumeLayout(false); this.ResumeLayout(false); } } }