SpecialDefinitionDialog.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Data.SQLite;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. using PaintDotNet.Base.CommTool;
  12. using PaintDotNet.GeneralAnalysis.Special;
  13. namespace PaintDotNet.GeneralAnalysis
  14. {
  15. public partial class SpecialDefinitionDialog : Form
  16. {
  17. #region
  18. /// <summary>
  19. /// Required designer variable.
  20. /// </summary>
  21. private System.ComponentModel.IContainer components = null;
  22. /// <summary>
  23. /// Clean up any resources being used.
  24. /// </summary>
  25. /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  26. protected override void Dispose(bool disposing)
  27. {
  28. if (disposing && (components != null))
  29. {
  30. components.Dispose();
  31. }
  32. base.Dispose(disposing);
  33. }
  34. #region Windows Form Designer generated code
  35. private void InitializeLanguageText()
  36. {
  37. this.Text = PdnResources.GetString("Menu.Generalanalysis.Specificdefinition.Specialdefinitionoflength.text");
  38. this.maxValue.HeaderText = PdnResources.GetString("Menu.Endvalue.text") + "(<)";
  39. this.minValue.HeaderText = PdnResources.GetString("Menu.Startingvalue.text") + "(≥)";
  40. this.description.HeaderText = PdnResources.GetString("Menu.instruction.text");
  41. this.groupBox1.Text = PdnResources.GetString("Menu.Specialdata.text");
  42. this.groupBox2.Text = PdnResources.GetString("Menu.Levelinformation.text");
  43. this.name.HeaderText = PdnResources.GetString("Menu.name.text");
  44. }
  45. /// <summary>
  46. /// Required method for Designer support - do not modify
  47. /// the contents of this method with the code editor.
  48. /// </summary>
  49. private void InitializeComponent()
  50. {
  51. this.components = new System.ComponentModel.Container();
  52. this.groupBox1 = new System.Windows.Forms.GroupBox();
  53. this.lstSpecialList = new System.Windows.Forms.ListBox();
  54. this.btnSpecialDelete = new System.Windows.Forms.Button();
  55. this.btnSpecialUpdate = new System.Windows.Forms.Button();
  56. this.btnSpecialAdd = new System.Windows.Forms.Button();
  57. this.groupBox2 = new System.Windows.Forms.GroupBox();
  58. this.dgvInfoList = new System.Windows.Forms.DataGridView();
  59. this.id = new System.Windows.Forms.DataGridViewTextBoxColumn();
  60. this.name = new System.Windows.Forms.DataGridViewTextBoxColumn();
  61. this.description = new System.Windows.Forms.DataGridViewTextBoxColumn();
  62. this.minValue = new System.Windows.Forms.DataGridViewTextBoxColumn();
  63. this.maxValue = new System.Windows.Forms.DataGridViewTextBoxColumn();
  64. this.btnSpecialInfoDelete = new System.Windows.Forms.Button();
  65. this.btnSpecialInfoUpdate = new System.Windows.Forms.Button();
  66. this.btnSpecialInfoAdd = new System.Windows.Forms.Button();
  67. this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
  68. this.groupBox1.SuspendLayout();
  69. this.groupBox2.SuspendLayout();
  70. ((System.ComponentModel.ISupportInitialize)(this.dgvInfoList)).BeginInit();
  71. this.SuspendLayout();
  72. //
  73. // groupBox1
  74. //
  75. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  76. | System.Windows.Forms.AnchorStyles.Left)));
  77. this.groupBox1.Controls.Add(this.lstSpecialList);
  78. this.groupBox1.Controls.Add(this.btnSpecialDelete);
  79. this.groupBox1.Controls.Add(this.btnSpecialUpdate);
  80. this.groupBox1.Controls.Add(this.btnSpecialAdd);
  81. this.groupBox1.Location = new System.Drawing.Point(9, 10);
  82. this.groupBox1.Margin = new System.Windows.Forms.Padding(2);
  83. this.groupBox1.Name = "groupBox1";
  84. this.groupBox1.Padding = new System.Windows.Forms.Padding(2);
  85. this.groupBox1.Size = new System.Drawing.Size(253, 359);
  86. this.groupBox1.TabIndex = 0;
  87. this.groupBox1.TabStop = false;
  88. this.groupBox1.Text = "专项数据";
  89. //
  90. // lstSpecialList
  91. //
  92. this.lstSpecialList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  93. | System.Windows.Forms.AnchorStyles.Left)));
  94. this.lstSpecialList.FormattingEnabled = true;
  95. this.lstSpecialList.ItemHeight = 12;
  96. this.lstSpecialList.Location = new System.Drawing.Point(8, 46);
  97. this.lstSpecialList.Margin = new System.Windows.Forms.Padding(2);
  98. this.lstSpecialList.Name = "lstSpecialList";
  99. this.lstSpecialList.Size = new System.Drawing.Size(236, 304);
  100. this.lstSpecialList.TabIndex = 8;
  101. this.lstSpecialList.SelectedIndexChanged += new System.EventHandler(this.lstSpecialList_SelectedIndexChanged);
  102. //
  103. // btnSpecialDelete
  104. //
  105. this.btnSpecialDelete.Location = new System.Drawing.Point(212, 17);
  106. this.btnSpecialDelete.Margin = new System.Windows.Forms.Padding(2);
  107. this.btnSpecialDelete.Name = "btnSpecialDelete";
  108. this.btnSpecialDelete.Size = new System.Drawing.Size(31, 22);
  109. this.btnSpecialDelete.TabIndex = 3;
  110. this.btnSpecialDelete.UseVisualStyleBackColor = true;
  111. this.btnSpecialDelete.Click += new System.EventHandler(this.btnSpecialDelete_Click);
  112. //
  113. // btnSpecialUpdate
  114. //
  115. this.btnSpecialUpdate.Location = new System.Drawing.Point(174, 17);
  116. this.btnSpecialUpdate.Margin = new System.Windows.Forms.Padding(2);
  117. this.btnSpecialUpdate.Name = "btnSpecialUpdate";
  118. this.btnSpecialUpdate.Size = new System.Drawing.Size(31, 22);
  119. this.btnSpecialUpdate.TabIndex = 2;
  120. this.btnSpecialUpdate.UseVisualStyleBackColor = true;
  121. this.btnSpecialUpdate.Click += new System.EventHandler(this.btnSpecialUpdate_Click);
  122. //
  123. // btnSpecialAdd
  124. //
  125. this.btnSpecialAdd.Location = new System.Drawing.Point(136, 17);
  126. this.btnSpecialAdd.Margin = new System.Windows.Forms.Padding(2);
  127. this.btnSpecialAdd.Name = "btnSpecialAdd";
  128. this.btnSpecialAdd.Size = new System.Drawing.Size(31, 22);
  129. this.btnSpecialAdd.TabIndex = 1;
  130. this.btnSpecialAdd.UseVisualStyleBackColor = true;
  131. this.btnSpecialAdd.Click += new System.EventHandler(this.btnSpecialAdd_Click);
  132. //
  133. // groupBox2
  134. //
  135. this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  136. | System.Windows.Forms.AnchorStyles.Left)
  137. | System.Windows.Forms.AnchorStyles.Right)));
  138. this.groupBox2.Controls.Add(this.dgvInfoList);
  139. this.groupBox2.Controls.Add(this.btnSpecialInfoDelete);
  140. this.groupBox2.Controls.Add(this.btnSpecialInfoUpdate);
  141. this.groupBox2.Controls.Add(this.btnSpecialInfoAdd);
  142. this.groupBox2.Location = new System.Drawing.Point(266, 10);
  143. this.groupBox2.Margin = new System.Windows.Forms.Padding(2);
  144. this.groupBox2.Name = "groupBox2";
  145. this.groupBox2.Padding = new System.Windows.Forms.Padding(2);
  146. this.groupBox2.Size = new System.Drawing.Size(459, 359);
  147. this.groupBox2.TabIndex = 1;
  148. this.groupBox2.TabStop = false;
  149. this.groupBox2.Text = "级别信息";
  150. //
  151. // dgvInfoList
  152. //
  153. this.dgvInfoList.AllowUserToAddRows = false;
  154. this.dgvInfoList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  155. | System.Windows.Forms.AnchorStyles.Left)
  156. | System.Windows.Forms.AnchorStyles.Right)));
  157. this.dgvInfoList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  158. this.dgvInfoList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  159. this.id,
  160. this.name,
  161. this.description,
  162. this.minValue,
  163. this.maxValue});
  164. this.dgvInfoList.Location = new System.Drawing.Point(9, 46);
  165. this.dgvInfoList.Margin = new System.Windows.Forms.Padding(2);
  166. this.dgvInfoList.Name = "dgvInfoList";
  167. this.dgvInfoList.RowHeadersVisible = false;
  168. this.dgvInfoList.RowHeadersWidth = 51;
  169. this.dgvInfoList.RowTemplate.Height = 27;
  170. this.dgvInfoList.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
  171. this.dgvInfoList.Size = new System.Drawing.Size(441, 302);
  172. this.dgvInfoList.TabIndex = 7;
  173. //
  174. // id
  175. //
  176. this.id.HeaderText = "id";
  177. this.id.MinimumWidth = 6;
  178. this.id.Name = "id";
  179. this.id.Visible = false;
  180. //
  181. // name
  182. //
  183. this.name.FillWeight = 129.3591F;
  184. this.name.HeaderText = "name";
  185. this.name.MinimumWidth = 6;
  186. this.name.Name = "name";
  187. this.name.Width = 80;
  188. //
  189. // description
  190. //
  191. this.description.FillWeight = 111.8908F;
  192. this.description.HeaderText = "description";
  193. this.description.MinimumWidth = 6;
  194. this.description.Name = "description";
  195. //
  196. // minValue
  197. //
  198. this.minValue.FillWeight = 77.53182F;
  199. this.minValue.HeaderText = "minValue";
  200. this.minValue.MinimumWidth = 6;
  201. this.minValue.Name = "minValue";
  202. this.minValue.Width = 150;
  203. //
  204. // maxValue
  205. //
  206. this.maxValue.FillWeight = 81.21828F;
  207. this.maxValue.HeaderText = "maxValue";
  208. this.maxValue.MinimumWidth = 6;
  209. this.maxValue.Name = "maxValue";
  210. this.maxValue.Width = 110;
  211. //
  212. // btnSpecialInfoDelete
  213. //
  214. this.btnSpecialInfoDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  215. this.btnSpecialInfoDelete.Location = new System.Drawing.Point(418, 17);
  216. this.btnSpecialInfoDelete.Margin = new System.Windows.Forms.Padding(2);
  217. this.btnSpecialInfoDelete.Name = "btnSpecialInfoDelete";
  218. this.btnSpecialInfoDelete.Size = new System.Drawing.Size(31, 22);
  219. this.btnSpecialInfoDelete.TabIndex = 6;
  220. this.btnSpecialInfoDelete.UseVisualStyleBackColor = true;
  221. this.btnSpecialInfoDelete.Click += new System.EventHandler(this.btnSpecialInfoDelete_Click);
  222. //
  223. // btnSpecialInfoUpdate
  224. //
  225. this.btnSpecialInfoUpdate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  226. this.btnSpecialInfoUpdate.Location = new System.Drawing.Point(380, 17);
  227. this.btnSpecialInfoUpdate.Margin = new System.Windows.Forms.Padding(2);
  228. this.btnSpecialInfoUpdate.Name = "btnSpecialInfoUpdate";
  229. this.btnSpecialInfoUpdate.Size = new System.Drawing.Size(31, 22);
  230. this.btnSpecialInfoUpdate.TabIndex = 5;
  231. this.btnSpecialInfoUpdate.UseVisualStyleBackColor = true;
  232. this.btnSpecialInfoUpdate.Click += new System.EventHandler(this.btnSpecialInfoUpdate_Click);
  233. //
  234. // btnSpecialInfoAdd
  235. //
  236. this.btnSpecialInfoAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  237. this.btnSpecialInfoAdd.Location = new System.Drawing.Point(341, 17);
  238. this.btnSpecialInfoAdd.Margin = new System.Windows.Forms.Padding(2);
  239. this.btnSpecialInfoAdd.Name = "btnSpecialInfoAdd";
  240. this.btnSpecialInfoAdd.Size = new System.Drawing.Size(31, 22);
  241. this.btnSpecialInfoAdd.TabIndex = 4;
  242. this.btnSpecialInfoAdd.UseVisualStyleBackColor = true;
  243. this.btnSpecialInfoAdd.Click += new System.EventHandler(this.btnSpecialInfoAdd_Click);
  244. //
  245. // SpecialDefinitionDialog
  246. //
  247. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  248. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  249. this.ClientSize = new System.Drawing.Size(734, 384);
  250. this.Controls.Add(this.groupBox2);
  251. this.Controls.Add(this.groupBox1);
  252. this.Margin = new System.Windows.Forms.Padding(2);
  253. this.MaximizeBox = false;
  254. this.Name = "SpecialDefinitionDialog";
  255. this.Text = "专项定义";
  256. this.groupBox1.ResumeLayout(false);
  257. this.groupBox2.ResumeLayout(false);
  258. ((System.ComponentModel.ISupportInitialize)(this.dgvInfoList)).EndInit();
  259. this.ResumeLayout(false);
  260. }
  261. #endregion
  262. private System.Windows.Forms.GroupBox groupBox1;
  263. private System.Windows.Forms.GroupBox groupBox2;
  264. private System.Windows.Forms.Button btnSpecialDelete;
  265. private System.Windows.Forms.Button btnSpecialUpdate;
  266. private System.Windows.Forms.Button btnSpecialAdd;
  267. private System.Windows.Forms.DataGridView dgvInfoList;
  268. private System.Windows.Forms.Button btnSpecialInfoDelete;
  269. private System.Windows.Forms.Button btnSpecialInfoUpdate;
  270. private System.Windows.Forms.Button btnSpecialInfoAdd;
  271. private System.Windows.Forms.ListBox lstSpecialList;
  272. private System.Windows.Forms.ToolTip toolTip1;
  273. #endregion
  274. private SpecialItem m_specialItem;
  275. private SQLiteHelper m_sqlHelper;
  276. private int m_selectedIndex;
  277. private DataTable m_specialList;
  278. private DataGridViewTextBoxColumn id;
  279. private DataGridViewTextBoxColumn name;
  280. private DataGridViewTextBoxColumn description;
  281. private DataGridViewTextBoxColumn minValue;
  282. private DataGridViewTextBoxColumn maxValue;
  283. private string m_specialId;
  284. public SpecialDefinitionDialog(SpecialItem item)
  285. {
  286. m_specialItem = item;
  287. InitializeComponent();
  288. InitializeLanguageText();
  289. InitializeButtonBackgroudImage();
  290. InitializeToolTip();
  291. InitializeData();
  292. }
  293. private void InitializeButtonBackgroudImage()
  294. {
  295. this.btnSpecialAdd.FlatStyle = FlatStyle.Flat;
  296. this.btnSpecialAdd.FlatAppearance.BorderSize = 0;
  297. this.btnSpecialAdd.BackgroundImageLayout = ImageLayout.Center;
  298. this.btnSpecialAdd.BackgroundImage = PdnResources.GetImageResource("Icons.MenuRulesListAddIcon.png").Reference;
  299. this.btnSpecialUpdate.FlatStyle = FlatStyle.Flat;
  300. this.btnSpecialUpdate.FlatAppearance.BorderSize = 0;
  301. this.btnSpecialUpdate.BackgroundImageLayout = ImageLayout.Center;
  302. this.btnSpecialUpdate.BackgroundImage = PdnResources.GetImageResource("Icons.MenuRulesListEditIcon.png").Reference;
  303. this.btnSpecialDelete.FlatStyle = FlatStyle.Flat;
  304. this.btnSpecialDelete.FlatAppearance.BorderSize = 0;
  305. this.btnSpecialDelete.BackgroundImageLayout = ImageLayout.Center;
  306. this.btnSpecialDelete.BackgroundImage = PdnResources.GetImageResource("Icons.MenuRulesListDeleteIcon.png").Reference;
  307. this.btnSpecialInfoAdd.FlatStyle = FlatStyle.Flat;
  308. this.btnSpecialInfoAdd.FlatAppearance.BorderSize = 0;
  309. this.btnSpecialInfoAdd.BackgroundImageLayout = ImageLayout.Center;
  310. this.btnSpecialInfoAdd.BackgroundImage = PdnResources.GetImageResource("Icons.MenuRulesListAddIcon.png").Reference;
  311. this.btnSpecialInfoUpdate.FlatStyle = FlatStyle.Flat;
  312. this.btnSpecialInfoUpdate.FlatAppearance.BorderSize = 0;
  313. this.btnSpecialInfoUpdate.BackgroundImageLayout = ImageLayout.Center;
  314. this.btnSpecialInfoUpdate.BackgroundImage = PdnResources.GetImageResource("Icons.MenuRulesListEditIcon.png").Reference;
  315. this.btnSpecialInfoDelete.FlatStyle = FlatStyle.Flat;
  316. this.btnSpecialInfoDelete.FlatAppearance.BorderSize = 0;
  317. this.btnSpecialInfoDelete.BackgroundImageLayout = ImageLayout.Center;
  318. this.btnSpecialInfoDelete.BackgroundImage = PdnResources.GetImageResource("Icons.MenuRulesListDeleteIcon.png").Reference;
  319. }
  320. private void InitializeToolTip()
  321. {
  322. this.toolTip1 = new ToolTip();
  323. this.toolTip1.SetToolTip(this.btnSpecialAdd, PdnResources.GetString("Menu.Addto.text"));
  324. this.toolTip1.SetToolTip(this.btnSpecialUpdate, PdnResources.GetString("Menu.modify.Text"));
  325. this.toolTip1.SetToolTip(this.btnSpecialDelete, PdnResources.GetString("Menu.Edit.Delete.Text"));
  326. this.toolTip1.SetToolTip(this.btnSpecialInfoAdd, PdnResources.GetString("Menu.Addto.text"));
  327. this.toolTip1.SetToolTip(this.btnSpecialInfoUpdate, PdnResources.GetString("Menu.modify.Text"));
  328. this.toolTip1.SetToolTip(this.btnSpecialInfoDelete, PdnResources.GetString("Menu.Edit.Delete.Text"));
  329. this.toolTip1.ShowAlways = true;
  330. }
  331. private void InitializeData()
  332. {
  333. m_sqlHelper = new SQLiteHelper(); //连接数据库
  334. m_sqlHelper.Connect();
  335. if (m_specialItem == SpecialItem.AREA)
  336. {
  337. this.Text = PdnResources.GetString("Menu.Generalanalysis.Specificdefinition.Specificdecontent.text");
  338. }
  339. SpecialListLoad();
  340. }
  341. public void SpecialListLoad()
  342. {
  343. string select_sql = "select * from mic_special_definition where delete_flag = 0 and special_type = ? "; //查询的SQL语句
  344. SQLiteParameter[] para = new SQLiteParameter[1];
  345. para[0] = new SQLiteParameter("special_type", m_specialItem);
  346. m_specialList = m_sqlHelper.ExecuteDataTable(select_sql, para); //执行查询操作,结果存放在dt中
  347. this.lstSpecialList.Items.Clear();
  348. if (m_specialList.Rows.Count > 0)
  349. {
  350. for (int i = 0; i < m_specialList.Rows.Count; ++i)
  351. {
  352. lstSpecialList.Items.Add(m_specialList.Rows[i]["special_name"].ToString());
  353. }
  354. if (m_selectedIndex > m_specialList.Rows.Count - 1)
  355. {
  356. m_selectedIndex = m_specialList.Rows.Count - 1;
  357. }
  358. lstSpecialList.SelectedIndex = m_selectedIndex;
  359. }
  360. }
  361. private void lstSpecialList_SelectedIndexChanged(object sender, EventArgs e)
  362. {
  363. m_selectedIndex = this.lstSpecialList.SelectedIndex;
  364. m_specialId = m_specialList.Rows[m_selectedIndex]["id"].ToString();
  365. UpdateInfoCatalog();
  366. }
  367. public void UpdateInfoCatalog()
  368. {
  369. dgvInfoList.AutoGenerateColumns = false;
  370. dgvInfoList.AllowUserToAddRows = false;
  371. dgvInfoList.ReadOnly = true;
  372. this.dgvInfoList.Rows.Clear();
  373. string select_sql = "select * from mic_special_definition_info where special_id = '" + m_specialId + "'"; //查询的SQL语句
  374. DataTable infoList = m_sqlHelper.ExecuteDataTable(select_sql, null); //执行查询操作,结果存放在dt中
  375. if (infoList.Rows.Count > 0)
  376. {
  377. dgvInfoList.Rows.Add(infoList.Rows.Count);
  378. for (int i = 0; i < infoList.Rows.Count; ++i)
  379. {
  380. dgvInfoList.Rows[i].Cells["id"].Value = infoList.Rows[i]["id"].ToString();
  381. dgvInfoList.Rows[i].Cells["name"].Value = infoList.Rows[i]["name"].ToString();
  382. dgvInfoList.Rows[i].Cells["description"].Value = infoList.Rows[i]["description"].ToString();
  383. dgvInfoList.Rows[i].Cells["minValue"].Value = infoList.Rows[i]["minValue"];
  384. dgvInfoList.Rows[i].Cells["maxValue"].Value = infoList.Rows[i]["maxValue"];
  385. }
  386. }
  387. }
  388. private void btnSpecialAdd_Click(object sender, EventArgs e)
  389. {
  390. SpecialDialog dg = new SpecialDialog(this, true, null, m_specialItem);
  391. dg.ShowDialog();
  392. }
  393. private void btnSpecialUpdate_Click(object sender, EventArgs e)
  394. {
  395. if (m_specialId == null)
  396. {
  397. MessageBox.Show(PdnResources.GetString("Menu.Pleaseaddspecialinformationfirst.Text"));
  398. return;
  399. }
  400. SpecialDialog dg = new SpecialDialog(this, false, m_specialId, m_specialItem);
  401. dg.ShowDialog();
  402. }
  403. private void btnSpecialDelete_Click(object sender, EventArgs e)
  404. {
  405. if (m_specialId == null)
  406. {
  407. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectthepecialdatatodeletefirst.Text"));
  408. return;
  409. }
  410. DialogResult result = MessageBox.Show(PdnResources.GetString("Menu.ousureyouwanttodeletetheselect.Text")+"?", PdnResources.GetString("Menu.Tips.text"), MessageBoxButtons.OKCancel);
  411. if (result == DialogResult.OK)
  412. {
  413. // 删除组织信息
  414. string delete_sql = "delete from mic_special_definition where id = '" + m_specialId + "'";
  415. m_sqlHelper.ExecuteNonQuery(delete_sql, null); //执行删除操作
  416. // 删除定义键
  417. delete_sql = "delete from mic_special_definition_info where special_id = '" + m_specialId + "'";
  418. m_sqlHelper.ExecuteNonQuery(delete_sql, null); //执行删除操作
  419. this.SpecialListLoad();
  420. //MessageBox.Show("删除成功");
  421. }
  422. }
  423. private void btnSpecialInfoAdd_Click(object sender, EventArgs e)
  424. {
  425. SpecialInfoDialog dg = new SpecialInfoDialog(this, m_specialId, true, null);
  426. dg.ShowDialog();
  427. }
  428. private void btnSpecialInfoUpdate_Click(object sender, EventArgs e)
  429. {
  430. if (dgvInfoList.SelectedRows.Count != 1)
  431. {
  432. MessageBox.Show(PdnResources.GetString("Menu.Selectwofdata.text"));
  433. return;
  434. }
  435. string specialInfoId = "";
  436. foreach (DataGridViewRow r in dgvInfoList.SelectedRows)
  437. {
  438. if (!r.IsNewRow)
  439. {
  440. specialInfoId = r.Cells["id"].Value.ToString();
  441. }
  442. }
  443. SpecialInfoDialog dg = new SpecialInfoDialog(this, m_specialId, false, specialInfoId);
  444. dg.ShowDialog();
  445. }
  446. private void btnSpecialInfoDelete_Click(object sender, EventArgs e)
  447. {
  448. if (dgvInfoList.SelectedRows.Count <= 0)
  449. {
  450. MessageBox.Show(PdnResources.GetString("Menu.Pleasesobedeleted.text"));
  451. return;
  452. }
  453. DialogResult result = MessageBox.Show(PdnResources.GetString("Menu.thatyouwanttodeleteheselect.Text")+"?", PdnResources.GetString("Menu.Tips.text"), MessageBoxButtons.OKCancel);
  454. if (result == DialogResult.OK)
  455. {
  456. //执行删除
  457. foreach (DataGridViewRow r in dgvInfoList.SelectedRows)
  458. {
  459. if (!r.IsNewRow)
  460. {
  461. string id = r.Cells["id"].Value.ToString();
  462. string sql = "delete from mic_special_definition_info where id ='" + id + "'";
  463. m_sqlHelper.ExecuteNonQuery(sql, null);
  464. dgvInfoList.Rows.Remove(r);
  465. }
  466. }
  467. //MessageBox.Show(PdnResources.GetString("Menu.successfullydeleted.text")+"!");
  468. }
  469. }
  470. }
  471. }