/*******************************************************************************
* Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_PC_0101_1_5.cs
* 2.功能描述:操作时间及备注录入
* 编辑履历:
* 作者 日期 版本 修改内容
* 王鑫 2015/09/25 1.00 新建
*******************************************************************************/
using System;
using System.Windows.Forms;
using System.Data;
using Dongke.IBOSS.PRD.Basics.BaseControls;
using Dongke.IBOSS.PRD.Basics.BaseResources;
using Dongke.IBOSS.PRD.WCF.Proxys;
using Dongke.IBOSS.PRD.Client.CommonModule;
namespace Dongke.IBOSS.PRD.Client.PCModule
{
public partial class F_PC_0101_1_5 : FormBase
{
#region 成员变量
// 窗体标题
private string _titleStr = "";
// 实例窗体
//private F_PC_0101 _fpc0101;
private DataTable _dtBindSource = null;
#endregion
#region 构造函数
//public F_PC_0101_1_5(F_PC_0101 fpc0101, string titleStr)
//{
// InitializeComponent();
// this._titleStr = titleStr;
// this._fpc0101 = fpc0101;
// this._fpc0101.SetTimeOrRemarks(null, "");
// this.Text = _titleStr;
// this.btnSave.Text = ButtonText.BTN_SAVE;
//}
public F_PC_0101_1_5(DataTable dtBindSource, string titleStr)
{
InitializeComponent();
_dtBindSource = dtBindSource;
this.Text = titleStr;
this.btnSave.Text = ButtonText.BTN_SAVE;
this.btnCancel.Text = ButtonText.BTN_CLOSE;
this.txtGroutingLineCode.Text = dtBindSource.Rows[0]["GroutingLineCode"].ToString();
this.txtRecordRemarks.Text = dtBindSource.Rows[0]["RecordRemarks"].ToString();
}
#endregion
#region 事件
///
/// 保存按钮事件
///
///
///
private void btnSave_Click(object sender, EventArgs e)
{
try
{
DataTable dtName = this.dgvGroutingLineDetail.DataSource as DataTable;
dtName.TableName = "GMouldRecord";
if(dtName.Rows.Count>0)
{
dtName.Rows[0]["RecordRemarks"] = this.txtRecordRemarks.Text.Trim();
}
int returnRow = (int)DoAsync(new BaseAsyncMethod(() =>
{
return PCModuleProxy.Service.UpdateAllLineStartGroutingLineDetail(dtName);
}));
if (returnRow > 0)
{
//停用成功
//MessageBox.Show(this.Text + "成功");
MessageBox.Show(this.Text + "成功", this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Information);
this.DialogResult = DialogResult.OK;
}
else if (returnRow == -500)
{
//停用成功
//MessageBox.Show("数据已经被修改,请重新编辑");
MessageBox.Show("数据已经被修改,请重新编辑", this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Warning);
this.DialogResult = DialogResult.No;
}
else if (returnRow == -500)
{
//停用成功
// MessageBox.Show(this.Text + "失败");
MessageBox.Show(this.Text + "失败", this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Warning);
this.DialogResult = DialogResult.No;
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 窗体加载事件
///
///
///
private void F_PC_0101_1_2_Load(object sender, EventArgs e)
{
this.dgvGroutingLineDetail.AutoGenerateColumns = false;
DateTime accountDate = (DateTime)DoAsync(new BaseAsyncMethod(() =>
{
return CommonModuleProxy.Service.GetAccountDate();
}));
this.txtDateStart.Value = accountDate;
this.dgvGroutingLineDetail.DataSource = _dtBindSource;
// 设置可输入单元格的颜色
this.dgvGroutingLineDetail.IsSetInputColumnsColor = true;
}
#endregion
}
}