PeiZhiJingJu.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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. using Sunny.UI;
  8. using System.Windows.Forms;
  9. namespace WWPipeLine.MapTools.Conditions.XiTongGuanLi
  10. {
  11. public class PeiZhiJingJu : ConditionPanel
  12. {
  13. private Sunny.UI.UIDataGridView uiDGVjslkpz;
  14. private Sunny.UI.UIPanel uiPanel1;
  15. private Sunny.UI.UIButton uiButton3;
  16. private Sunny.UI.UIButton uiButton2;
  17. private Sunny.UI.UIButton uiButton1;
  18. private Sunny.UI.UILabel uiLabel3;
  19. private Sunny.UI.UILabel uiLabel4;
  20. private Sunny.UI.UITextBox uiTBspjj;
  21. private Sunny.UI.UITextBox uiTBczjj;
  22. private Sunny.UI.UIPanel uiPanel2;
  23. private Recordset _rd;
  24. private Sunny.UI.UILabel uiLBsmid;
  25. private int _rdsmid = 0;
  26. public PeiZhiJingJu() : base()
  27. {
  28. this.ConditionPanelName = "管线净距配置";
  29. InitializeComponent();
  30. IsShowPanelFooter = false;
  31. }
  32. protected override void OnLoad(EventArgs e)
  33. {
  34. QueryParameter queryParameter = new QueryParameter
  35. {
  36. AttributeFilter = " pzlx='净距配置' ",
  37. ResultFields = new string[] { "smid", "gxlx", "pzlx", "gxspjj", "gxczjj" },
  38. OrderBy = new string[] { "smid" },
  39. CursorType = CursorType.Dynamic
  40. };
  41. _rd = ComsStatic.dvJSLK_PZ.Query(queryParameter);
  42. ComsStatic.setUIDataGridView(uiDGVjslkpz, MapBasic.ComsStatic.RecordsetToDataTable(_rd));
  43. }
  44. private void uiButton3_Click(object sender, EventArgs e)
  45. {
  46. if (_rdsmid == 0) { UIMessageTip.ShowError("请先选择需要删除的信息!"); return; }
  47. if (_rd.SeekID(_rdsmid))
  48. {
  49. MapBasic.ComsStatic.ShowUIMessageTipOKorError(_rd.Delete(), "净距配置删除");
  50. OnLoad(e);
  51. }
  52. else
  53. { Sunny.UI.UIMessageTip.ShowError("信息在删除选择时失败!"); }
  54. }
  55. private void uiButton2_Click(object sender, EventArgs e)
  56. {
  57. if (_rdsmid == 0) { UIMessageTip.ShowError("请先选择需要编辑的信息!"); return; }
  58. if (_rd.SeekID(_rdsmid))
  59. {
  60. _rd.Edit();
  61. _rd.SetFieldValue("gxspjj", ComsStatic.StringToDouble(uiTBspjj.Text));
  62. _rd.SetFieldValue("gxczjj", ComsStatic.StringToDouble(uiTBczjj.Text));
  63. ComsStatic.ShowUIMessageTipOKorError(_rd.Update(), "净距配置编辑");
  64. OnLoad(e);
  65. }
  66. else
  67. { Sunny.UI.UIMessageTip.ShowError("信息在编辑选择时失败!"); }
  68. }
  69. public override void AfterClose()
  70. {
  71. if (!(_rd is null)) _rd.Close(); _rd.Dispose();
  72. base.AfterClose();
  73. }
  74. private void uiButton1_Click(object sender, EventArgs e)
  75. {
  76. if (string.IsNullOrEmpty(uiTBspjj.Text) || uiTBspjj.Text == "0" || string.IsNullOrEmpty(uiTBczjj.Text) || uiTBczjj.Text == "0")
  77. {
  78. UIMessageTip.ShowError("请输入正确的配置数据!"); return;
  79. }
  80. if (_rd.RecordCount > 0)
  81. {
  82. UIMessageTip.ShowError("已经存在管线的净距信息!"); return;
  83. }
  84. _rd.AddNew(new GeoPoint(0, 0));
  85. _rd.SetFieldValue("pzlx", "净距配置");
  86. _rd.SetFieldValue("gxlx", "供水管线");
  87. _rd.SetFieldValue("gxspjj", ComsStatic.StringToDouble(uiTBspjj.Text));
  88. _rd.SetFieldValue("gxczjj", ComsStatic.StringToDouble(uiTBczjj.Text));
  89. ComsStatic.ShowUIMessageTipOKorError(_rd.Update(), "净距配置信息新增");
  90. OnLoad(e);
  91. }
  92. private void uiTextBox2_KeyPress(object sender, KeyPressEventArgs e)
  93. {
  94. if ((e.KeyChar < 48 || e.KeyChar > 57) && (e.KeyChar < 96 || e.KeyChar > 105) && (e.KeyChar != 8))
  95. e.Handled = true;
  96. }
  97. private void uiDGVjslkpz_SelectIndexChange(object sender, int index)
  98. {
  99. var selectRows = (sender as UIDataGridView).SelectedRows;
  100. if (selectRows == null || selectRows.Count != 1) return;
  101. _rdsmid = ComsStatic.StringToInt(selectRows[0].Cells["SmID"].Value.ToString());
  102. if (_rdsmid != 0 && _rd.SeekID(_rdsmid))
  103. {
  104. uiLBsmid.Text = _rd.GetFieldValue("smid").ToString();
  105. uiTBspjj.Text = _rd.GetFieldValue("gxspjj").ToString();
  106. uiTBczjj.Text = _rd.GetFieldValue("gxczjj").ToString();
  107. }
  108. else
  109. { Sunny.UI.UIMessageTip.ShowError("信息错误!"); }
  110. }
  111. private void InitializeComponent()
  112. {
  113. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
  114. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
  115. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
  116. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
  117. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
  118. this.uiDGVjslkpz = new Sunny.UI.UIDataGridView();
  119. this.uiPanel1 = new Sunny.UI.UIPanel();
  120. this.uiPanel2 = new Sunny.UI.UIPanel();
  121. this.uiLBsmid = new Sunny.UI.UILabel();
  122. this.uiTBspjj = new Sunny.UI.UITextBox();
  123. this.uiTBczjj = new Sunny.UI.UITextBox();
  124. this.uiLabel4 = new Sunny.UI.UILabel();
  125. this.uiLabel3 = new Sunny.UI.UILabel();
  126. this.uiButton3 = new Sunny.UI.UIButton();
  127. this.uiButton2 = new Sunny.UI.UIButton();
  128. this.uiButton1 = new Sunny.UI.UIButton();
  129. ((System.ComponentModel.ISupportInitialize)(this.uiDGVjslkpz)).BeginInit();
  130. this.uiPanel1.SuspendLayout();
  131. this.uiPanel2.SuspendLayout();
  132. this.SuspendLayout();
  133. //
  134. // uiDGVjslkpz
  135. //
  136. dataGridViewCellStyle11.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
  137. this.uiDGVjslkpz.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11;
  138. this.uiDGVjslkpz.BackgroundColor = System.Drawing.Color.White;
  139. this.uiDGVjslkpz.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
  140. dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  141. dataGridViewCellStyle12.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
  142. dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 12F);
  143. dataGridViewCellStyle12.ForeColor = System.Drawing.Color.White;
  144. dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
  145. dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  146. dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  147. this.uiDGVjslkpz.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12;
  148. this.uiDGVjslkpz.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  149. dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  150. dataGridViewCellStyle13.BackColor = System.Drawing.SystemColors.Window;
  151. dataGridViewCellStyle13.Font = new System.Drawing.Font("微软雅黑", 12F);
  152. dataGridViewCellStyle13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
  153. dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(200)))), ((int)(((byte)(255)))));
  154. dataGridViewCellStyle13.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
  155. dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
  156. this.uiDGVjslkpz.DefaultCellStyle = dataGridViewCellStyle13;
  157. this.uiDGVjslkpz.Dock = System.Windows.Forms.DockStyle.Fill;
  158. this.uiDGVjslkpz.EnableHeadersVisualStyles = false;
  159. this.uiDGVjslkpz.Font = new System.Drawing.Font("微软雅黑", 12F);
  160. this.uiDGVjslkpz.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
  161. this.uiDGVjslkpz.Location = new System.Drawing.Point(0, 0);
  162. this.uiDGVjslkpz.Name = "uiDGVjslkpz";
  163. dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  164. dataGridViewCellStyle14.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
  165. dataGridViewCellStyle14.Font = new System.Drawing.Font("微软雅黑", 12F);
  166. dataGridViewCellStyle14.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
  167. dataGridViewCellStyle14.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
  168. dataGridViewCellStyle14.SelectionForeColor = System.Drawing.Color.White;
  169. dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  170. this.uiDGVjslkpz.RowHeadersDefaultCellStyle = dataGridViewCellStyle14;
  171. dataGridViewCellStyle15.BackColor = System.Drawing.Color.White;
  172. this.uiDGVjslkpz.RowsDefaultCellStyle = dataGridViewCellStyle15;
  173. this.uiDGVjslkpz.RowTemplate.Height = 23;
  174. this.uiDGVjslkpz.SelectedIndex = -1;
  175. this.uiDGVjslkpz.ShowGridLine = true;
  176. this.uiDGVjslkpz.Size = new System.Drawing.Size(500, 350);
  177. this.uiDGVjslkpz.TabIndex = 0;
  178. this.uiDGVjslkpz.SelectIndexChange += new Sunny.UI.UIDataGridView.OnSelectIndexChange(this.uiDGVjslkpz_SelectIndexChange);
  179. //
  180. // uiPanel1
  181. //
  182. this.uiPanel1.Controls.Add(this.uiDGVjslkpz);
  183. this.uiPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
  184. this.uiPanel1.Font = new System.Drawing.Font("微软雅黑", 12F);
  185. this.uiPanel1.Location = new System.Drawing.Point(0, 0);
  186. this.uiPanel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
  187. this.uiPanel1.MinimumSize = new System.Drawing.Size(1, 1);
  188. this.uiPanel1.Name = "uiPanel1";
  189. this.uiPanel1.Size = new System.Drawing.Size(500, 350);
  190. this.uiPanel1.TabIndex = 1;
  191. this.uiPanel1.Text = "uiPanel1";
  192. this.uiPanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
  193. //
  194. // uiPanel2
  195. //
  196. this.uiPanel2.Controls.Add(this.uiLBsmid);
  197. this.uiPanel2.Controls.Add(this.uiTBspjj);
  198. this.uiPanel2.Controls.Add(this.uiTBczjj);
  199. this.uiPanel2.Controls.Add(this.uiLabel4);
  200. this.uiPanel2.Controls.Add(this.uiLabel3);
  201. this.uiPanel2.Controls.Add(this.uiButton3);
  202. this.uiPanel2.Controls.Add(this.uiButton2);
  203. this.uiPanel2.Controls.Add(this.uiButton1);
  204. this.uiPanel2.Dock = System.Windows.Forms.DockStyle.Bottom;
  205. this.uiPanel2.Font = new System.Drawing.Font("微软雅黑", 12F);
  206. this.uiPanel2.Location = new System.Drawing.Point(0, 258);
  207. this.uiPanel2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
  208. this.uiPanel2.MinimumSize = new System.Drawing.Size(1, 1);
  209. this.uiPanel2.Name = "uiPanel2";
  210. this.uiPanel2.Size = new System.Drawing.Size(500, 92);
  211. this.uiPanel2.TabIndex = 2;
  212. this.uiPanel2.Text = null;
  213. this.uiPanel2.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
  214. //
  215. // uiLBsmid
  216. //
  217. this.uiLBsmid.Font = new System.Drawing.Font("微软雅黑", 12F);
  218. this.uiLBsmid.Location = new System.Drawing.Point(14, 48);
  219. this.uiLBsmid.Name = "uiLBsmid";
  220. this.uiLBsmid.Size = new System.Drawing.Size(59, 23);
  221. this.uiLBsmid.TabIndex = 11;
  222. this.uiLBsmid.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  223. this.uiLBsmid.Visible = false;
  224. //
  225. // uiTBspjj
  226. //
  227. this.uiTBspjj.Cursor = System.Windows.Forms.Cursors.IBeam;
  228. this.uiTBspjj.FillColor = System.Drawing.Color.White;
  229. this.uiTBspjj.Font = new System.Drawing.Font("微软雅黑", 12F);
  230. this.uiTBspjj.Location = new System.Drawing.Point(115, 10);
  231. this.uiTBspjj.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
  232. this.uiTBspjj.Maximum = 2147483647D;
  233. this.uiTBspjj.MaxLength = 4;
  234. this.uiTBspjj.Minimum = -2147483648D;
  235. this.uiTBspjj.MinimumSize = new System.Drawing.Size(1, 1);
  236. this.uiTBspjj.Name = "uiTBspjj";
  237. this.uiTBspjj.Size = new System.Drawing.Size(91, 29);
  238. this.uiTBspjj.TabIndex = 8;
  239. this.uiTBspjj.Text = "0";
  240. this.uiTBspjj.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
  241. this.uiTBspjj.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.uiTextBox2_KeyPress);
  242. //
  243. // uiTBczjj
  244. //
  245. this.uiTBczjj.Cursor = System.Windows.Forms.Cursors.IBeam;
  246. this.uiTBczjj.FillColor = System.Drawing.Color.White;
  247. this.uiTBczjj.Font = new System.Drawing.Font("微软雅黑", 12F);
  248. this.uiTBczjj.Location = new System.Drawing.Point(372, 10);
  249. this.uiTBczjj.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
  250. this.uiTBczjj.Maximum = 2147483647D;
  251. this.uiTBczjj.MaxLength = 4;
  252. this.uiTBczjj.Minimum = -2147483648D;
  253. this.uiTBczjj.MinimumSize = new System.Drawing.Size(1, 1);
  254. this.uiTBczjj.Name = "uiTBczjj";
  255. this.uiTBczjj.Size = new System.Drawing.Size(91, 29);
  256. this.uiTBczjj.TabIndex = 8;
  257. this.uiTBczjj.Text = "0";
  258. this.uiTBczjj.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
  259. this.uiTBczjj.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.uiTextBox2_KeyPress);
  260. //
  261. // uiLabel4
  262. //
  263. this.uiLabel4.Font = new System.Drawing.Font("微软雅黑", 12F);
  264. this.uiLabel4.Location = new System.Drawing.Point(253, 10);
  265. this.uiLabel4.Name = "uiLabel4";
  266. this.uiLabel4.Size = new System.Drawing.Size(91, 28);
  267. this.uiLabel4.TabIndex = 6;
  268. this.uiLabel4.Text = "垂直净距";
  269. this.uiLabel4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  270. //
  271. // uiLabel3
  272. //
  273. this.uiLabel3.Font = new System.Drawing.Font("微软雅黑", 12F);
  274. this.uiLabel3.Location = new System.Drawing.Point(15, 10);
  275. this.uiLabel3.Name = "uiLabel3";
  276. this.uiLabel3.Size = new System.Drawing.Size(91, 28);
  277. this.uiLabel3.TabIndex = 5;
  278. this.uiLabel3.Text = "水平净距";
  279. this.uiLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  280. //
  281. // uiButton3
  282. //
  283. this.uiButton3.Cursor = System.Windows.Forms.Cursors.Hand;
  284. this.uiButton3.Font = new System.Drawing.Font("微软雅黑", 12F);
  285. this.uiButton3.Location = new System.Drawing.Point(350, 48);
  286. this.uiButton3.MinimumSize = new System.Drawing.Size(1, 1);
  287. this.uiButton3.Name = "uiButton3";
  288. this.uiButton3.Size = new System.Drawing.Size(100, 35);
  289. this.uiButton3.TabIndex = 2;
  290. this.uiButton3.Text = "删除";
  291. this.uiButton3.Click += new System.EventHandler(this.uiButton3_Click);
  292. //
  293. // uiButton2
  294. //
  295. this.uiButton2.Cursor = System.Windows.Forms.Cursors.Hand;
  296. this.uiButton2.Font = new System.Drawing.Font("微软雅黑", 12F);
  297. this.uiButton2.Location = new System.Drawing.Point(222, 48);
  298. this.uiButton2.MinimumSize = new System.Drawing.Size(1, 1);
  299. this.uiButton2.Name = "uiButton2";
  300. this.uiButton2.Size = new System.Drawing.Size(100, 35);
  301. this.uiButton2.TabIndex = 1;
  302. this.uiButton2.Text = "修改";
  303. this.uiButton2.Click += new System.EventHandler(this.uiButton2_Click);
  304. //
  305. // uiButton1
  306. //
  307. this.uiButton1.Cursor = System.Windows.Forms.Cursors.Hand;
  308. this.uiButton1.Font = new System.Drawing.Font("微软雅黑", 12F);
  309. this.uiButton1.Location = new System.Drawing.Point(99, 48);
  310. this.uiButton1.MinimumSize = new System.Drawing.Size(1, 1);
  311. this.uiButton1.Name = "uiButton1";
  312. this.uiButton1.Size = new System.Drawing.Size(100, 35);
  313. this.uiButton1.TabIndex = 0;
  314. this.uiButton1.Text = "新增";
  315. this.uiButton1.Click += new System.EventHandler(this.uiButton1_Click);
  316. //
  317. // PeiZhiJingJu
  318. //
  319. this.Controls.Add(this.uiPanel2);
  320. this.Controls.Add(this.uiPanel1);
  321. this.Name = "PeiZhiJingJu";
  322. this.Size = new System.Drawing.Size(500, 350);
  323. ((System.ComponentModel.ISupportInitialize)(this.uiDGVjslkpz)).EndInit();
  324. this.uiPanel1.ResumeLayout(false);
  325. this.uiPanel2.ResumeLayout(false);
  326. this.ResumeLayout(false);
  327. }
  328. }
  329. }