/*******************************************************************************
* Copyright(c) 2012 dongke All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:S_CMN_020.cs
* 2.功能描述:记录漏扫成型工信息
* 编辑履历:
* 作者 日期 版本 修改内容
* 王鑫 2015/05/11 1.00 新建
*******************************************************************************/
using System;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Dongke.IBOSS.PRD.Basics.BaseControls;
using Dongke.IBOSS.PRD.Basics.BaseResources;
using Dongke.IBOSS.PRD.Basics.Library;
using Dongke.IBOSS.PRD.Client.CommonModule;
using Dongke.IBOSS.PRD.WCF.Proxys;
namespace Dongke.IBOSS.PRD.Client.Controls.FormCommon
{
///
/// 记录漏扫成型工信息
///
public partial class S_CMN_020 : FormBase
{
#region 成员变量
private int _missid = 0; //漏扫表ID
#endregion
#region 构造函数
public S_CMN_020()
{
InitializeComponent();
this.Text = FormTitles.S_CMN_020;
this.btnSave.Text = ButtonText.BTN_SAVE;
this.btnClose.Text = ButtonText.BTN_CLOSE;
}
public S_CMN_020(int missid, string errorMessage)
{
InitializeComponent();
this._missid = missid;
this.txtErrorMessage.Text = errorMessage;
this.Text = FormTitles.S_CMN_020;
this.btnSave.Text = ButtonText.BTN_SAVE;
this.btnClose.Text = ButtonText.BTN_CLOSE;
}
public S_CMN_020(int missid, string errorMessage,string groutingusercode)
{
InitializeComponent();
this._missid = missid;
this.txtErrorMessage.Text = errorMessage;
this.txtGroutingusercode.Text = groutingusercode;
this.Text = FormTitles.S_CMN_020;
this.btnSave.Text = ButtonText.BTN_SAVE;
this.btnClose.Text = ButtonText.BTN_CLOSE;
}
#endregion
#region 事件
///
/// 确定按钮事件
///
///
///
private void btnSave_Click(object sender, EventArgs e)
{
try
{
// 验证输入是否正确
if (!this.CheckInputValidity())
{
return;
}
int returnRow = (int)DoAsync(new BaseAsyncMethod(() =>
{
return PMModuleProxy.Service.UpdateGroutingUserCodeByMissingID(this.txtGroutingusercode.Text.Trim(), this._missid);
}));
// 提示信息
if (returnRow == -1)
{
// 提示信息
MessageBox.Show("存在无效的漏扫工号",
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
this.txtGroutingusercode.SelectAll();
return;
}
// 提示信息
MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "新增" + this.Text, "保存"),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Close();
}
catch (Exception ex)
{
this.btnSave.Enabled = true;
this.btnClose.Enabled = true;
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
#endregion
#region 私有方法
///
/// 验证输入格式是否正确
///
///
private bool CheckInputValidity()
{
if (string.IsNullOrEmpty(this.txtGroutingusercode.Text.Trim()))
{
this.txtGroutingusercode.IsMustInput = true;
this.txtGroutingusercode.Focus();
return false;
}
return true;
}
#endregion
}
}