FrmVTPluginInfo.cs.svn-base 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using System.Collections;
  9. using CoreFS.CA06;
  10. using Core.Mes.Client.Common;
  11. namespace Core.LgMes.Client.LgDeviceManager
  12. {
  13. public partial class FrmVTPluginInfo : FrmLgDevFunctions
  14. {
  15. public FrmVTPluginInfo(OpeBase opb)
  16. {
  17. InitializeComponent();
  18. ob = opb;
  19. }
  20. private void FrmVTPluginInfo_Load(object sender, EventArgs e)
  21. {
  22. udteBuyTime.DateTime = DateTime.Today;
  23. proc_LoadPluginID();
  24. proc_Query("", "");
  25. }
  26. private void cbCCM_CheckedChanged(object sender, EventArgs e)
  27. {
  28. cmbCCM.Enabled = chkCCM.Checked;
  29. }
  30. private void cbID_CheckedChanged(object sender, EventArgs e)
  31. {
  32. cmbID.Enabled = chkID.Checked;
  33. }
  34. private void cbbCCM_SelectedIndexChanged(object sender, EventArgs e)
  35. {
  36. proc_LoadPluginID();
  37. }
  38. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  39. {
  40. try
  41. {
  42. if (ultraGrid1.Rows.Count == 0) return;
  43. if (ultraGrid1.ActiveRow == null) return;
  44. cmbZJH.Text = Convert.ToString(ultraGrid1.ActiveRow.Cells["RH炉号"].Value);
  45. txtNO.Text = Convert.ToString(ultraGrid1.ActiveRow.Cells["槽号"].Value);
  46. txtCS.Text = Convert.ToString(ultraGrid1.ActiveRow.Cells["槽龄"].Value);
  47. udteBuyTime.DateTime = Convert.ToDateTime(ultraGrid1.ActiveRow.Cells["购买日期"].Value);
  48. txtMemo.Text = Convert.ToString(ultraGrid1.ActiveRow.Cells["备注"].Value);
  49. }
  50. catch (Exception ex)
  51. {
  52. MessageBox.Show(ex.Message);
  53. }
  54. }
  55. private void proc_ExecuteCommand_Return(object[] obj, out DataSet ds, out string strErr)
  56. {
  57. //CallingMessage par = new CallingMessage();
  58. //par.ServerName = "炼钢工器具";
  59. //par.AssemblyName = "Core.LgMes.Server.LgDeviceManager";
  60. //par.ClassName = "Core.LgMes.Server.LgDeviceManager.jjqmanager";
  61. //par.MethodName = "ExecuteCommand_Return";
  62. //par.args = obj;
  63. strErr = "";
  64. ds = null;//ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr) as DataSet;
  65. }
  66. private void proc_ExecuteCommand_NonReturn(object[] obj, out string strErr)
  67. {
  68. //CallingMessage par = new CallingMessage();
  69. //par.ServerName = "炼钢工器具";
  70. //par.AssemblyName = "Core.LgMes.Server.LgDeviceManager";
  71. //par.ClassName = "Core.LgMes.Server.LgDeviceManager.jjqmanager";
  72. //par.MethodName = "ExecuteCommand_NonReturn";
  73. //par.args = obj;
  74. strErr = "";
  75. //ClientCommon._RemotingHelp.ExecuteMethod(par, out strErr);
  76. }
  77. private void proc_ResetControl()
  78. {
  79. try
  80. {
  81. cmbZJH.SelectedIndex = -1;
  82. txtNO.Clear();
  83. txtCS.Clear();
  84. udteBuyTime.DateTime = DateTime.Today;
  85. txtMemo.Clear();
  86. }
  87. catch { }
  88. }
  89. /// <summary>
  90. /// 加载真空槽号
  91. /// </summary>
  92. private void proc_LoadPluginID()
  93. {
  94. try
  95. {
  96. string strWhere = "";
  97. if (cmbCCM.SelectedIndex > -1)
  98. {
  99. strWhere = "and RHS_ID = '" + cmbCCM.Text.Trim() + "' ";
  100. }
  101. string strErr = "";
  102. ArrayList arry = new ArrayList();
  103. ArrayList sqlList = new ArrayList();
  104. arry.Add("FrmVTPluginInfo_Query2");
  105. if (cmbCCM.SelectedIndex > -1)
  106. {
  107. sqlList.Add(strWhere);
  108. }
  109. else
  110. {
  111. sqlList.Add(strWhere);
  112. }
  113. CoreClientParam CCP_LgEts = new CoreClientParam();
  114. DataTable dt = new DataTable();
  115. CCP_LgEts.ServerName = "Core.LgMes.Server.Common.ComDBQuery";
  116. CCP_LgEts.MethodName = "doQuery";
  117. CCP_LgEts.ServerParams = new object[] { arry, sqlList };
  118. CCP_LgEts.SourceDataTable = dt;
  119. this.ExecuteQueryToDataTable(CCP_LgEts, CoreInvokeType.Internal);
  120. DataSet ds = new DataSet();
  121. ds.Tables.Add(dt);
  122. if (strErr != "" || !(ds != null && ds.Tables.Count > 0))
  123. {
  124. MessageBox.Show("真空槽槽号信息加载失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  125. if (MessageBox.Show("是否重新加载真空槽槽号信息?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
  126. proc_LoadPluginID();
  127. return;
  128. }
  129. cmbID.ResetText();
  130. cmbID.DataSource = ds.Tables[0];
  131. cmbID.DisplayMember = "PLUGINNO";
  132. }
  133. catch (Exception ex)
  134. {
  135. MessageBox.Show(ex.Message);
  136. }
  137. }
  138. /// <summary>
  139. /// 真空槽信息查询
  140. /// </summary>
  141. /// <param RH炉号="strRHS"></param>
  142. /// <param 槽号="strID"></param>
  143. private void proc_Query(string strRHS, string strID)
  144. {
  145. try
  146. {
  147. string strwhere = "";
  148. string PLUG = "";
  149. if (chkCCM.Checked && cmbCCM.SelectedIndex > -1)
  150. {
  151. strwhere= "and t.RHS_ID = '"+cmbCCM.SelectedItem.ToString()+"'";
  152. }
  153. if (chkID.Checked && cmbID.SelectedIndex > -1)
  154. {
  155. PLUG= "and t.PLUGINNO='"+cmbID.Text.Trim()+"'";
  156. }
  157. string strErr = "";
  158. ArrayList arry = new ArrayList();
  159. ArrayList sqlList = new ArrayList();
  160. arry.Add("FrmVTPluginInfo_Query1");
  161. if (chkCCM.Checked)
  162. {
  163. sqlList.Add(strwhere);
  164. }
  165. else { sqlList.Add(strwhere); }
  166. if (chkID.Checked)
  167. {
  168. sqlList.Add(PLUG);
  169. }
  170. else { sqlList.Add(PLUG); }
  171. CoreClientParam CCP_LgEts = new CoreClientParam();
  172. DataTable dt = new DataTable();
  173. CCP_LgEts.ServerName = "Core.LgMes.Server.Common.ComDBQuery";
  174. CCP_LgEts.MethodName = "doQuery";
  175. CCP_LgEts.ServerParams = new object[] { arry, sqlList };
  176. CCP_LgEts.SourceDataTable = dt;
  177. this.ExecuteQueryToDataTable(CCP_LgEts, CoreInvokeType.Internal);
  178. DataSet ds = new DataSet();
  179. ds.Tables.Add(dt);
  180. try
  181. {
  182. ((DataSet)ultraGrid1.DataSource).Tables[0].Rows.Clear();
  183. }
  184. catch (Exception)
  185. {
  186. }
  187. if (ds != null && ds.Tables[0].Rows.Count > 0)
  188. {
  189. ultraGrid1.DataSource = ds.Tables[0];
  190. }
  191. if (strErr != "" || !(ds != null && ds.Tables.Count > 0))
  192. {
  193. MessageBox.Show("真空槽信息查询失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  194. return;
  195. }
  196. if (ds.Tables[0].Rows.Count == 0)
  197. {
  198. proc_ResetControl();
  199. return;
  200. }
  201. if (strRHS.Length > 0) //定位记录
  202. {
  203. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  204. {
  205. if (Convert.ToString(ultraGrid1.Rows[i].Cells["RH炉号"].Value) == strRHS)
  206. {
  207. if (strID.Length > 0)
  208. {
  209. if (Convert.ToString(ultraGrid1.Rows[i].Cells["槽号"].Value) == strID)
  210. {
  211. ultraGrid1.ActiveRow = ultraGrid1.Rows[i];
  212. ultraGrid1.Rows[i].Selected = true;
  213. return;
  214. }
  215. }
  216. else
  217. {
  218. ultraGrid1.ActiveRow = ultraGrid1.Rows[i];
  219. ultraGrid1.Rows[i].Selected = true;
  220. return;
  221. }
  222. }
  223. }
  224. }
  225. }
  226. catch (Exception ex)
  227. {
  228. MessageBox.Show(ex.Message);
  229. }
  230. }
  231. /// <summary>
  232. /// 真空槽信息新增
  233. /// </summary>
  234. private void proc_Add()
  235. {
  236. try
  237. {
  238. if (cmbZJH.SelectedIndex < 0)
  239. {
  240. MessageBox.Show("请选择RH炉号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  241. cmbZJH.Focus();
  242. return;
  243. }
  244. if (txtNO.Text.Trim().Length == 0)
  245. {
  246. MessageBox.Show("请录入槽号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  247. txtNO.Focus();
  248. return;
  249. }
  250. string strRHS = cmbZJH.Text.Trim();
  251. string strNO = txtNO.Text.Trim();
  252. string strUseTimes = (txtCS.Text.Trim().Length == 0 ? "0" : txtCS.Text.Trim());
  253. string strDate = udteBuyTime.DateTime.ToString("yyyy-MM-dd");
  254. string strMemo = txtMemo.Text.Trim();
  255. string strErr = "";
  256. ArrayList arry = new ArrayList();
  257. arry.Add("FrmVTPluginInfo_Query3");
  258. arry.Add(strRHS);
  259. arry.Add(strNO);
  260. CommonClientToServer ccs = new CommonClientToServer();
  261. ccs.ob = this.ob;
  262. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  263. if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  264. {
  265. MessageBox.Show("新增[" + strRHS + "]槽号[" + strNO + "]失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  266. return;
  267. }
  268. int iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
  269. if (iCnt > 0)
  270. {
  271. MessageBox.Show("[" + strRHS + "]已存在槽号[" + strNO + "],不能重复录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  272. txtNO.Focus();
  273. return;
  274. }
  275. strErr = "";
  276. arry.Clear();
  277. ccs.ob = this.ob;
  278. arry.Add("FrmVTPluginInfo_Add.1");
  279. arry.Add(strNO);
  280. arry.Add(strRHS);
  281. arry.Add(strUseTimes);
  282. arry.Add(strDate);
  283. arry.Add(strMemo);
  284. string strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
  285. if (!(strErr == null || strErr == ""))
  286. {
  287. MessageBox.Show("新增[" + strRHS + "]槽号[" + strNO + "]失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  288. return;
  289. }
  290. proc_Query(strRHS, strNO);
  291. MessageBox.Show("新增[" + strRHS + "]槽号[" + strNO + "]成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  292. }
  293. catch (Exception ex)
  294. {
  295. MessageBox.Show(ex.Message);
  296. }
  297. }
  298. /// <summary>
  299. /// 真空槽信息修改
  300. /// </summary>
  301. private void proc_Edit()
  302. {
  303. try
  304. {
  305. if (ultraGrid1.Rows.Count == 0)
  306. return;
  307. if (ultraGrid1.ActiveRow == null)
  308. {
  309. MessageBox.Show("请选择您要修改的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  310. return;
  311. }
  312. if (cmbZJH.SelectedIndex < 0)
  313. {
  314. MessageBox.Show("请选择RH炉号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  315. cmbZJH.Focus();
  316. return;
  317. }
  318. if (txtNO.Text.Trim().Length == 0)
  319. {
  320. MessageBox.Show("请录入槽号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  321. txtNO.Focus();
  322. return;
  323. }
  324. string strRHS = cmbZJH.Text.Trim();
  325. string strNO = txtNO.Text.Trim();
  326. string strUseTimes = (txtCS.Text.Trim().Length == 0 ? "0" : txtCS.Text.Trim());
  327. string strDate = udteBuyTime.DateTime.ToString("yyyy-MM-dd");
  328. string strMemo = txtMemo.Text.Trim();
  329. if (MessageBox.Show("确定要修改[" + strRHS + "]槽号[" + strNO + "]相关信息吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  330. return;
  331. string strErr = "";
  332. ArrayList arry = new ArrayList();
  333. arry.Add("FrmVTPluginInfo_Query4");
  334. arry.Add(strRHS);
  335. arry.Add(strNO);
  336. CommonClientToServer ccs = new CommonClientToServer();
  337. ccs.ob = this.ob;
  338. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  339. if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  340. {
  341. MessageBox.Show("[" + strRHS + "]槽号[" + strNO + "]信息修改失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  342. return;
  343. }
  344. int iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
  345. if (iCnt == 0)
  346. {
  347. MessageBox.Show("[" + strRHS + "]不存在槽号[" + strNO + "],无法修改!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  348. txtNO.Focus();
  349. return;
  350. }
  351. strErr = "";
  352. arry.Clear();
  353. ccs.ob = this.ob;
  354. arry.Add("FrmVTPluginInfo_Edit.1");
  355. arry.Add(strUseTimes);
  356. arry.Add(strDate);
  357. arry.Add(strMemo);
  358. arry.Add(strRHS);
  359. arry.Add(strNO);
  360. string strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
  361. if (!(strErr == null || strErr == ""))
  362. {
  363. MessageBox.Show("[" + strRHS + "]槽号[" + strNO + "]信息修改失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  364. return;
  365. }
  366. proc_Query(strRHS, strNO);
  367. MessageBox.Show("[" + strRHS + "]槽号[" + strNO + "]信息修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  368. }
  369. catch (Exception ex)
  370. {
  371. MessageBox.Show(ex.Message);
  372. }
  373. }
  374. /// <summary>
  375. /// 真空槽信息删除
  376. /// </summary>
  377. private void proc_Del()
  378. {
  379. try
  380. {
  381. if (ultraGrid1.Rows.Count == 0)
  382. return;
  383. if (ultraGrid1.ActiveRow == null)
  384. {
  385. MessageBox.Show("请选择您要删除的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  386. return;
  387. }
  388. string strID = Convert.ToString(ultraGrid1.ActiveRow.Cells["ID"].Value);
  389. string strNO = Convert.ToString(ultraGrid1.ActiveRow.Cells["槽号"].Value);
  390. string strRHS = Convert.ToString(ultraGrid1.ActiveRow.Cells["RH炉号"].Value);
  391. if (MessageBox.Show("确定要删除[" + strRHS + "]槽号[" + strNO + "]信息吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  392. return;
  393. string strErr = "";
  394. ArrayList arry = new ArrayList();
  395. arry.Add("FrmVTPluginInfo_Query5");
  396. arry.Add(strID);
  397. CommonClientToServer ccs = new CommonClientToServer();
  398. ccs.ob = this.ob;
  399. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  400. if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  401. {
  402. MessageBox.Show("[" + strRHS + "]槽号[" + strNO + "]信息删除失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  403. return;
  404. }
  405. int iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
  406. if (iCnt == 0)
  407. {
  408. MessageBox.Show("[" + strRHS + "]不存在槽号[" + strNO + "],无法删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  409. txtNO.Focus();
  410. return;
  411. }
  412. iCnt = 0;
  413. strErr = "";
  414. arry.Clear();
  415. ds = null;
  416. ccs.ob = this.ob;
  417. arry.Add("FrmVTPluginInfo_Query6");
  418. arry.Add(strID);
  419. arry.Add(strID);
  420. arry.Add(strID);
  421. ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  422. if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  423. {
  424. MessageBox.Show("[" + strRHS + "]槽号[" + strNO + "]信息删除失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  425. return;
  426. }
  427. iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
  428. if (iCnt > 0)
  429. {
  430. MessageBox.Show("[" + strRHS + "]槽号[" + strNO + "]存在使用记录,不能删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  431. txtNO.Focus();
  432. return;
  433. }
  434. strErr = "";
  435. arry.Clear();
  436. ds = null;
  437. ccs.ob = this.ob;
  438. arry.Add("FrmVTPluginInfo_Query7");
  439. arry.Add(strID);
  440. arry.Add(strID);
  441. arry.Add(strID);
  442. ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery", "doSimpleQuery", arry, out strErr);
  443. if (strErr != "" || !(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
  444. {
  445. MessageBox.Show("[" + strRHS + "]槽号[" + strNO + "]信息删除失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  446. return;
  447. }
  448. iCnt = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
  449. if (iCnt > 0)
  450. {
  451. MessageBox.Show("[" + strRHS + "]槽号[" + strNO + "]存在使用记录,不能删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  452. txtNO.Focus();
  453. return;
  454. }
  455. strErr = "";
  456. arry.Clear();
  457. ccs.ob = this.ob;
  458. arry.Add("FrmVTPluginInfo_Del.1");
  459. arry.Add(strID);
  460. string strReturn = ccs.NoQueryFunctions("Core.LgMes.Server.Common.ComDBSave", "doSimpleSave", arry, out strErr);
  461. if (!(strErr == null || strErr == ""))
  462. {
  463. MessageBox.Show("[" + strRHS + "]槽号[" + strNO + "]信息删除失败!\r\n" + strErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  464. return;
  465. }
  466. proc_Query(strRHS, strNO);
  467. MessageBox.Show("[" + strRHS + "]槽号[" + strNO + "]信息删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  468. }
  469. catch (Exception ex)
  470. {
  471. MessageBox.Show(ex.Message);
  472. }
  473. }
  474. /// <summary>
  475. /// 菜单栏
  476. /// </summary>
  477. /// <param name="sender"></param>
  478. /// <param name="e"></param>
  479. private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  480. {
  481. if (e.ClickedItem == null) return;
  482. switch (e.ClickedItem.Name)
  483. {
  484. case "QUERY":
  485. {
  486. proc_Query("", "");
  487. break;
  488. }
  489. case "ADD":
  490. {
  491. proc_Add();
  492. break;
  493. }
  494. case "EDIT":
  495. {
  496. proc_Edit();
  497. break;
  498. }
  499. case "DEL":
  500. {
  501. proc_Del();
  502. break;
  503. }
  504. case "CLOSE":
  505. {
  506. this.Close();
  507. break;
  508. }
  509. }
  510. }
  511. private void tbCS_KeyPress(object sender, KeyPressEventArgs e)
  512. {
  513. if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b' || e.KeyChar == '.') ||
  514. (((TextBox)(sender)).Text.Trim().Contains(".") && e.KeyChar == '.') ||
  515. (((TextBox)(sender)).Text.Trim().Length == 0 && e.KeyChar == '.'))
  516. {
  517. e.Handled = true;
  518. }
  519. }
  520. }
  521. }