123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339 |
- 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;
- namespace WWPipeLine.MapTools.Conditions.XiTongGuanLi
- {
- public class PeiZhiJingJu : 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 uiLabel3;
- private Sunny.UI.UILabel uiLabel4;
- private Sunny.UI.UITextBox uiTBspjj;
- private Sunny.UI.UITextBox uiTBczjj;
- private Sunny.UI.UIPanel uiPanel2;
- private Recordset _rd;
- private Sunny.UI.UILabel uiLBsmid;
- private int _rdsmid = 0;
- public PeiZhiJingJu() : base()
- {
- this.ConditionPanelName = "管线净距配置";
- InitializeComponent();
- IsShowPanelFooter = false;
- }
- protected override void OnLoad(EventArgs e)
- {
- QueryParameter queryParameter = new QueryParameter
- {
- AttributeFilter = " pzlx='净距配置' ",
- ResultFields = new string[] { "smid", "gxlx", "pzlx", "gxspjj", "gxczjj" },
- OrderBy = new string[] { "smid" },
- CursorType = CursorType.Dynamic
- };
- _rd = ComsStatic.dvJSLK_PZ.Query(queryParameter);
- ComsStatic.setUIDataGridView(uiDGVjslkpz, MapBasic.ComsStatic.RecordsetToDataTable(_rd));
- }
- private void uiButton3_Click(object sender, EventArgs e)
- {
- if (_rdsmid == 0) { UIMessageTip.ShowError("请先选择需要删除的信息!"); return; }
- if (_rd.SeekID(_rdsmid))
- {
- MapBasic.ComsStatic.ShowUIMessageTipOKorError(_rd.Delete(), "净距配置删除");
- OnLoad(e);
- }
- else
- { Sunny.UI.UIMessageTip.ShowError("信息在删除选择时失败!"); }
- }
- private void uiButton2_Click(object sender, EventArgs e)
- {
- if (_rdsmid == 0) { UIMessageTip.ShowError("请先选择需要编辑的信息!"); return; }
- if (_rd.SeekID(_rdsmid))
- {
- _rd.Edit();
- _rd.SetFieldValue("gxspjj", ComsStatic.StringToDouble(uiTBspjj.Text));
- _rd.SetFieldValue("gxczjj", ComsStatic.StringToDouble(uiTBczjj.Text));
- ComsStatic.ShowUIMessageTipOKorError(_rd.Update(), "净距配置编辑");
- OnLoad(e);
- }
- else
- { Sunny.UI.UIMessageTip.ShowError("信息在编辑选择时失败!"); }
- }
- public override void AfterClose()
- {
- if (!(_rd is null)) _rd.Close(); _rd.Dispose();
- base.AfterClose();
- }
- private void uiButton1_Click(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(uiTBspjj.Text) || uiTBspjj.Text == "0" || string.IsNullOrEmpty(uiTBczjj.Text) || uiTBczjj.Text == "0")
- {
- UIMessageTip.ShowError("请输入正确的配置数据!"); return;
- }
- if (_rd.RecordCount > 0)
- {
- UIMessageTip.ShowError("已经存在管线的净距信息!"); return;
- }
- _rd.AddNew(new GeoPoint(0, 0));
- _rd.SetFieldValue("pzlx", "净距配置");
- _rd.SetFieldValue("gxlx", "供水管线");
- _rd.SetFieldValue("gxspjj", ComsStatic.StringToDouble(uiTBspjj.Text));
- _rd.SetFieldValue("gxczjj", ComsStatic.StringToDouble(uiTBczjj.Text));
- ComsStatic.ShowUIMessageTipOKorError(_rd.Update(), "净距配置信息新增");
- OnLoad(e);
- }
- private void uiTextBox2_KeyPress(object sender, KeyPressEventArgs e)
- {
- if ((e.KeyChar < 48 || e.KeyChar > 57) && (e.KeyChar < 96 || e.KeyChar > 105) && (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();
- uiTBspjj.Text = _rd.GetFieldValue("gxspjj").ToString();
- uiTBczjj.Text = _rd.GetFieldValue("gxczjj").ToString();
- }
- else
- { Sunny.UI.UIMessageTip.ShowError("信息错误!"); }
- }
- private void InitializeComponent()
- {
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = 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.uiTBspjj = new Sunny.UI.UITextBox();
- this.uiTBczjj = new Sunny.UI.UITextBox();
- this.uiLabel4 = new Sunny.UI.UILabel();
- this.uiLabel3 = 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
- //
- dataGridViewCellStyle11.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
- this.uiDGVjslkpz.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11;
- this.uiDGVjslkpz.BackgroundColor = System.Drawing.Color.White;
- this.uiDGVjslkpz.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
- dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle12.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
- dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 12F);
- dataGridViewCellStyle12.ForeColor = System.Drawing.Color.White;
- dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
- dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.uiDGVjslkpz.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12;
- this.uiDGVjslkpz.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- dataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Window;
- dataGridViewCellStyle13.Font = new System.Drawing.Font("微软雅黑", 12F);
- dataGridViewCellStyle13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
- dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(200)))), ((int)(((byte)(255)))));
- dataGridViewCellStyle13.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
- dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
- this.uiDGVjslkpz.DefaultCellStyle = dataGridViewCellStyle13;
- 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";
- dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- dataGridViewCellStyle14.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
- dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 12F);
- dataGridViewCellStyle14.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
- dataGridViewCellStyle14.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
- dataGridViewCellStyle14.SelectionForeColor = System.Drawing.Color.White;
- dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.uiDGVjslkpz.RowHeadersDefaultCellStyle = dataGridViewCellStyle14;
- dataGridViewCellStyle15.BackColor = System.Drawing.Color.White;
- this.uiDGVjslkpz.RowsDefaultCellStyle = dataGridViewCellStyle15;
- 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.uiTBspjj);
- this.uiPanel2.Controls.Add(this.uiTBczjj);
- this.uiPanel2.Controls.Add(this.uiLabel4);
- this.uiPanel2.Controls.Add(this.uiLabel3);
- 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, 258);
- 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, 92);
- 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(14, 48);
- 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;
- //
- // uiTBspjj
- //
- this.uiTBspjj.Cursor = System.Windows.Forms.Cursors.IBeam;
- this.uiTBspjj.FillColor = System.Drawing.Color.White;
- this.uiTBspjj.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.uiTBspjj.Location = new System.Drawing.Point(115, 10);
- this.uiTBspjj.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.uiTBspjj.Maximum = 2147483647D;
- this.uiTBspjj.MaxLength = 4;
- this.uiTBspjj.Minimum = -2147483648D;
- this.uiTBspjj.MinimumSize = new System.Drawing.Size(1, 1);
- this.uiTBspjj.Name = "uiTBspjj";
- this.uiTBspjj.Size = new System.Drawing.Size(91, 29);
- this.uiTBspjj.TabIndex = 8;
- this.uiTBspjj.Text = "0";
- this.uiTBspjj.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
- this.uiTBspjj.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.uiTextBox2_KeyPress);
- //
- // uiTBczjj
- //
- this.uiTBczjj.Cursor = System.Windows.Forms.Cursors.IBeam;
- this.uiTBczjj.FillColor = System.Drawing.Color.White;
- this.uiTBczjj.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.uiTBczjj.Location = new System.Drawing.Point(372, 10);
- this.uiTBczjj.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
- this.uiTBczjj.Maximum = 2147483647D;
- this.uiTBczjj.MaxLength = 4;
- this.uiTBczjj.Minimum = -2147483648D;
- this.uiTBczjj.MinimumSize = new System.Drawing.Size(1, 1);
- this.uiTBczjj.Name = "uiTBczjj";
- this.uiTBczjj.Size = new System.Drawing.Size(91, 29);
- this.uiTBczjj.TabIndex = 8;
- this.uiTBczjj.Text = "0";
- this.uiTBczjj.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
- this.uiTBczjj.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.uiTextBox2_KeyPress);
- //
- // uiLabel4
- //
- this.uiLabel4.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.uiLabel4.Location = new System.Drawing.Point(253, 10);
- this.uiLabel4.Name = "uiLabel4";
- this.uiLabel4.Size = new System.Drawing.Size(91, 28);
- this.uiLabel4.TabIndex = 6;
- this.uiLabel4.Text = "垂直净距";
- this.uiLabel4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // uiLabel3
- //
- this.uiLabel3.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.uiLabel3.Location = new System.Drawing.Point(15, 10);
- this.uiLabel3.Name = "uiLabel3";
- this.uiLabel3.Size = new System.Drawing.Size(91, 28);
- this.uiLabel3.TabIndex = 5;
- this.uiLabel3.Text = "水平净距";
- this.uiLabel3.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(350, 48);
- 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(222, 48);
- 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(99, 48);
- 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);
- //
- // PeiZhiJingJu
- //
- this.Controls.Add(this.uiPanel2);
- this.Controls.Add(this.uiPanel1);
- this.Name = "PeiZhiJingJu";
- 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);
- }
- }
- }
|