PeiZhiJingJu.cs 15 KB

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