PeiZhiFuTu.cs 15 KB

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