F_PC_0101_1_5.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PC_0101_1_5.cs
  5. * 2.功能描述:操作时间及备注录入
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2015/09/25 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Windows.Forms;
  12. using System.Data;
  13. using Dongke.IBOSS.PRD.Basics.BaseControls;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  15. using Dongke.IBOSS.PRD.WCF.Proxys;
  16. using Dongke.IBOSS.PRD.Client.CommonModule;
  17. namespace Dongke.IBOSS.PRD.Client.PCModule
  18. {
  19. public partial class F_PC_0101_1_5 : FormBase
  20. {
  21. #region 成员变量
  22. // 窗体标题
  23. private string _titleStr = "";
  24. // 实例窗体
  25. //private F_PC_0101 _fpc0101;
  26. private DataTable _dtBindSource = null;
  27. #endregion
  28. #region 构造函数
  29. //public F_PC_0101_1_5(F_PC_0101 fpc0101, string titleStr)
  30. //{
  31. // InitializeComponent();
  32. // this._titleStr = titleStr;
  33. // this._fpc0101 = fpc0101;
  34. // this._fpc0101.SetTimeOrRemarks(null, "");
  35. // this.Text = _titleStr;
  36. // this.btnSave.Text = ButtonText.BTN_SAVE;
  37. //}
  38. public F_PC_0101_1_5(DataTable dtBindSource, string titleStr)
  39. {
  40. InitializeComponent();
  41. _dtBindSource = dtBindSource;
  42. this.Text = titleStr;
  43. this.btnSave.Text = ButtonText.BTN_SAVE;
  44. this.btnCancel.Text = ButtonText.BTN_CLOSE;
  45. this.txtGroutingLineCode.Text = dtBindSource.Rows[0]["GroutingLineCode"].ToString();
  46. this.txtRecordRemarks.Text = dtBindSource.Rows[0]["RecordRemarks"].ToString();
  47. }
  48. #endregion
  49. #region 事件
  50. /// <summary>
  51. /// 保存按钮事件
  52. /// </summary>
  53. /// <param name="sender"></param>
  54. /// <param name="e"></param>
  55. private void btnSave_Click(object sender, EventArgs e)
  56. {
  57. try
  58. {
  59. DataTable dtName = this.dgvGroutingLineDetail.DataSource as DataTable;
  60. dtName.TableName = "GMouldRecord";
  61. if(dtName.Rows.Count>0)
  62. {
  63. dtName.Rows[0]["RecordRemarks"] = this.txtRecordRemarks.Text.Trim();
  64. }
  65. int returnRow = (int)DoAsync(new BaseAsyncMethod(() =>
  66. {
  67. return PCModuleProxy.Service.UpdateAllLineStartGroutingLineDetail(dtName);
  68. }));
  69. if (returnRow > 0)
  70. {
  71. //停用成功
  72. //MessageBox.Show(this.Text + "成功");
  73. MessageBox.Show(this.Text + "成功", this.Text,
  74. MessageBoxButtons.OK, MessageBoxIcon.Information);
  75. this.DialogResult = DialogResult.OK;
  76. }
  77. else if (returnRow == -500)
  78. {
  79. //停用成功
  80. //MessageBox.Show("数据已经被修改,请重新编辑");
  81. MessageBox.Show("数据已经被修改,请重新编辑", this.Text,
  82. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  83. this.DialogResult = DialogResult.No;
  84. }
  85. else if (returnRow == -500)
  86. {
  87. //停用成功
  88. // MessageBox.Show(this.Text + "失败");
  89. MessageBox.Show(this.Text + "失败", this.Text,
  90. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  91. this.DialogResult = DialogResult.No;
  92. }
  93. }
  94. catch (Exception ex)
  95. {
  96. // 对异常进行共通处理
  97. ExceptionManager.HandleEventException(this.ToString(),
  98. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  99. }
  100. }
  101. /// <summary>
  102. /// 窗体加载事件
  103. /// </summary>
  104. /// <param name="sender"></param>
  105. /// <param name="e"></param>
  106. private void F_PC_0101_1_2_Load(object sender, EventArgs e)
  107. {
  108. this.dgvGroutingLineDetail.AutoGenerateColumns = false;
  109. DateTime accountDate = (DateTime)DoAsync(new BaseAsyncMethod(() =>
  110. {
  111. return CommonModuleProxy.Service.GetAccountDate();
  112. }));
  113. this.txtDateStart.Value = accountDate;
  114. this.dgvGroutingLineDetail.DataSource = _dtBindSource;
  115. // 设置可输入单元格的颜色
  116. this.dgvGroutingLineDetail.IsSetInputColumnsColor = true;
  117. }
  118. #endregion
  119. }
  120. }