/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_PM_2114.cs * 2.功能描述:恢复数据 * 编辑履历: * 作者 日期 版本 修改内容 * 王鑫 2015/06/13 1.00 新建 *******************************************************************************/ using System; using System.Data; using System.Reflection; using System.Text; using System.Windows.Forms; using Dongke.IBOSS.PRD.Basics.BaseControls; using Dongke.IBOSS.PRD.Basics.BaseResources; using Dongke.IBOSS.PRD.Client.CommonModule; using Dongke.IBOSS.PRD.Client.Controls; using Dongke.IBOSS.PRD.WCF.DataModels; using Dongke.IBOSS.PRD.WCF.Proxys; namespace Dongke.IBOSS.PRD.Client.PMModule { public partial class F_PM_2114 : DKFormBase { #region 成员变量 private string _currentbarcode = "";//当前产品条码 #endregion #region 构造函数 public F_PM_2114() { InitializeComponent(); this.btnClose.Text = ButtonText.BTN_CLOSE; this.btnSave.Text = ButtonText.BTN_SAVE; this.Text = "恢复数据"; } #endregion #region 事件 /// /// 保存按钮事件 /// /// /// private void btnSave_Click(object sender, EventArgs e) { try { if (this.txtBarCode.Text.Trim() == "") { MessageBox.Show("产品条码不能为空", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtBarCode.Focus(); return; } int returnValue = (int)DoAsync(new BaseAsyncMethod(() => { return PMModuleProxy.Service.ResetBarCode(this.txtBarCode.Text.Trim()); })); if (returnValue == -1) { MessageBox.Show("此条码没有清除,不能恢复", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.txtBarCode.Focus(); this.txtBarCode.SelectAll(); return; } else if (returnValue == 0) { MessageBox.Show("没有可恢复的数据", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.txtBarCode.Focus(); this.txtBarCode.SelectAll(); return; } else if (returnValue > 0) { MessageBox.Show("恢复数据成功", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtBarCode.Text = "";//成功后,直接下一个 this.DialogResult = DialogResult.OK; return; } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } #endregion } }