F_PM_2114.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_2114.cs
  5. * 2.功能描述:恢复数据
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2015/06/13 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Reflection;
  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.Client.CommonModule;
  18. using Dongke.IBOSS.PRD.Client.Controls;
  19. using Dongke.IBOSS.PRD.WCF.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.Proxys;
  21. namespace Dongke.IBOSS.PRD.Client.PMModule
  22. {
  23. public partial class F_PM_2114 : DKFormBase
  24. {
  25. #region 成员变量
  26. private string _currentbarcode = "";//当前产品条码
  27. #endregion
  28. #region 构造函数
  29. public F_PM_2114()
  30. {
  31. InitializeComponent();
  32. this.btnClose.Text = ButtonText.BTN_CLOSE;
  33. this.btnSave.Text = ButtonText.BTN_SAVE;
  34. this.Text = "恢复数据";
  35. }
  36. #endregion
  37. #region 事件
  38. /// <summary>
  39. /// 保存按钮事件
  40. /// </summary>
  41. /// <param name="sender"></param>
  42. /// <param name="e"></param>
  43. private void btnSave_Click(object sender, EventArgs e)
  44. {
  45. try
  46. {
  47. if (this.txtBarCode.Text.Trim() == "")
  48. {
  49. MessageBox.Show("产品条码不能为空", this.Text,
  50. MessageBoxButtons.OK, MessageBoxIcon.Information);
  51. this.txtBarCode.Focus();
  52. return;
  53. }
  54. int returnValue = (int)DoAsync(new BaseAsyncMethod(() =>
  55. {
  56. return PMModuleProxy.Service.ResetBarCode(this.txtBarCode.Text.Trim());
  57. }));
  58. if (returnValue == -1)
  59. {
  60. MessageBox.Show("此条码没有清除,不能恢复", this.Text,
  61. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  62. this.txtBarCode.Focus();
  63. this.txtBarCode.SelectAll();
  64. return;
  65. }
  66. else if (returnValue == 0)
  67. {
  68. MessageBox.Show("没有可恢复的数据", this.Text,
  69. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  70. this.txtBarCode.Focus();
  71. this.txtBarCode.SelectAll();
  72. return;
  73. }
  74. else if (returnValue > 0)
  75. {
  76. MessageBox.Show("恢复数据成功", this.Text,
  77. MessageBoxButtons.OK, MessageBoxIcon.Information);
  78. this.txtBarCode.Text = "";//成功后,直接下一个
  79. this.DialogResult = DialogResult.OK;
  80. return;
  81. }
  82. }
  83. catch (Exception ex)
  84. {
  85. // 对异常进行共通处理
  86. ExceptionManager.HandleEventException(this.ToString(),
  87. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  88. }
  89. }
  90. #endregion
  91. }
  92. }