S_CMN_020.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*******************************************************************************
  2. * Copyright(c) 2012 dongke All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:S_CMN_020.cs
  5. * 2.功能描述:记录漏扫成型工信息
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2015/05/11 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Text;
  14. using System.Windows.Forms;
  15. using Dongke.IBOSS.PRD.Basics.BaseControls;
  16. using Dongke.IBOSS.PRD.Basics.BaseResources;
  17. using Dongke.IBOSS.PRD.Basics.Library;
  18. using Dongke.IBOSS.PRD.Client.CommonModule;
  19. using Dongke.IBOSS.PRD.WCF.Proxys;
  20. namespace Dongke.IBOSS.PRD.Client.Controls.FormCommon
  21. {
  22. /// <summary>
  23. /// 记录漏扫成型工信息
  24. /// </summary>
  25. public partial class S_CMN_020 : FormBase
  26. {
  27. #region 成员变量
  28. private int _missid = 0; //漏扫表ID
  29. #endregion
  30. #region 构造函数
  31. public S_CMN_020()
  32. {
  33. InitializeComponent();
  34. this.Text = FormTitles.S_CMN_020;
  35. this.btnSave.Text = ButtonText.BTN_SAVE;
  36. this.btnClose.Text = ButtonText.BTN_CLOSE;
  37. }
  38. public S_CMN_020(int missid, string errorMessage)
  39. {
  40. InitializeComponent();
  41. this._missid = missid;
  42. this.txtErrorMessage.Text = errorMessage;
  43. this.Text = FormTitles.S_CMN_020;
  44. this.btnSave.Text = ButtonText.BTN_SAVE;
  45. this.btnClose.Text = ButtonText.BTN_CLOSE;
  46. }
  47. public S_CMN_020(int missid, string errorMessage,string groutingusercode)
  48. {
  49. InitializeComponent();
  50. this._missid = missid;
  51. this.txtErrorMessage.Text = errorMessage;
  52. this.txtGroutingusercode.Text = groutingusercode;
  53. this.Text = FormTitles.S_CMN_020;
  54. this.btnSave.Text = ButtonText.BTN_SAVE;
  55. this.btnClose.Text = ButtonText.BTN_CLOSE;
  56. }
  57. #endregion
  58. #region 事件
  59. /// <summary>
  60. /// 确定按钮事件
  61. /// </summary>
  62. /// <param name="sender"></param>
  63. /// <param name="e"></param>
  64. private void btnSave_Click(object sender, EventArgs e)
  65. {
  66. try
  67. {
  68. // 验证输入是否正确
  69. if (!this.CheckInputValidity())
  70. {
  71. return;
  72. }
  73. int returnRow = (int)DoAsync(new BaseAsyncMethod(() =>
  74. {
  75. return PMModuleProxy.Service.UpdateGroutingUserCodeByMissingID(this.txtGroutingusercode.Text.Trim(), this._missid);
  76. }));
  77. // 提示信息
  78. if (returnRow == -1)
  79. {
  80. // 提示信息
  81. MessageBox.Show("存在无效的漏扫工号",
  82. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  83. this.txtGroutingusercode.SelectAll();
  84. return;
  85. }
  86. // 提示信息
  87. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "新增" + this.Text, "保存"),
  88. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  89. this.Close();
  90. }
  91. catch (Exception ex)
  92. {
  93. this.btnSave.Enabled = true;
  94. this.btnClose.Enabled = true;
  95. // 对异常进行共通处理
  96. ExceptionManager.HandleEventException(this.ToString(),
  97. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  98. }
  99. }
  100. #endregion
  101. #region 私有方法
  102. /// <summary>
  103. /// 验证输入格式是否正确
  104. /// </summary>
  105. /// <returns></returns>
  106. private bool CheckInputValidity()
  107. {
  108. if (string.IsNullOrEmpty(this.txtGroutingusercode.Text.Trim()))
  109. {
  110. this.txtGroutingusercode.IsMustInput = true;
  111. this.txtGroutingusercode.Focus();
  112. return false;
  113. }
  114. return true;
  115. }
  116. #endregion
  117. }
  118. }