F_MST_0303.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /*******************************************************************************
  2. * Copyright(c) 2020 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_MST_0303.cs
  5. * 2.功能描述:窑炉更新财年
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 付斌 2020/06/24 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Windows.Forms;
  12. using Dongke.IBOSS.PRD.Basics.BaseResources;
  13. using Dongke.IBOSS.PRD.Client.CommonModule;
  14. using Dongke.IBOSS.PRD.WCF.DataModels;
  15. using Dongke.IBOSS.PRD.WCF.Proxys;
  16. using Dongke.WinForm.Controls;
  17. namespace Dongke.IBOSS.PRD.Client.SystemModule
  18. {
  19. /// <summary>
  20. /// 组织机构新建/编辑界面
  21. /// </summary>
  22. public partial class F_MST_0303 : FormDialog
  23. {
  24. #region 构造函数
  25. /// <summary>
  26. /// 构造函数
  27. /// </summary>
  28. public F_MST_0303()
  29. {
  30. InitializeComponent();
  31. // 标题
  32. Text = FormTitles.F_MST_0303;
  33. // 按钮
  34. btnSave.Text = ButtonText.BTN_SAVE;
  35. btnCancel.Text = ButtonText.BTN_CLOSE;
  36. }
  37. #endregion
  38. #region 属性
  39. /// <summary>
  40. /// 上一个页面传过来的财年数据
  41. /// </summary>
  42. public int SK_Date { set; get; }
  43. #endregion
  44. #region 事件
  45. /// <summary>
  46. /// 窗体加载事件
  47. /// </summary>
  48. /// <param name="sender"></param>
  49. /// <param name="e"></param>
  50. private void F_MST_0303_Load(object sender, EventArgs e)
  51. {
  52. try
  53. {
  54. if (SK_Date == 0)
  55. {
  56. dtpSKDate.Value = DateTime.Now.Date;
  57. }
  58. else
  59. {
  60. dtpSKDate.Value = new DateTime(SK_Date + 1, 1, 1);
  61. }
  62. dtpSKDate.Focus();
  63. }
  64. catch (Exception ex)
  65. {
  66. // 对异常进行共通处理
  67. ExceptionManager.HandleEventException(ToString(),
  68. System.Reflection.MethodBase.GetCurrentMethod().Name, Text, ex);
  69. }
  70. }
  71. /// <summary>
  72. /// 保存按钮事件
  73. /// </summary>
  74. /// <param name="sender"></param>
  75. /// <param name="e"></param>
  76. private void btnSave_Click(object sender, EventArgs e)
  77. {
  78. try
  79. {
  80. #region 校验
  81. if (dtpSKDate.Value.Year <= SK_Date)
  82. {
  83. MessageBox.Show(string.Format(Messages.MSG_CMN_W007, "输入值小于或等于当前系统的财年数"), Text,
  84. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  85. return;
  86. }
  87. DialogResult drs = MessageBox.Show("修改财年后窑炉烧成号将重置,是否继续操作?",
  88. Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
  89. if (drs == DialogResult.No)
  90. {
  91. return;
  92. }
  93. #endregion
  94. #region 操作
  95. // 异步处理
  96. ClientRequestEntity cre = new ClientRequestEntity();
  97. cre.NameSpace = "F_MST_0303";
  98. cre.Name = "SaveSKDate";
  99. cre.Properties["SKDate"] = dtpSKDate.Value.Year;
  100. ServiceResultEntity sre = null;
  101. DoAsync(() => { return SystemModuleProxy.Service.DoRequest(cre); }, out sre);
  102. if (sre.Status == Constant.ServiceResultStatus.Success)
  103. {
  104. if (sre.OtherStatus > 0)
  105. {
  106. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "更新财年", "保存"), Text,
  107. MessageBoxButtons.OK, MessageBoxIcon.Information);
  108. DialogResult = DialogResult.OK;
  109. Close();
  110. }
  111. else if (sre.OtherStatus < 0 && !string.IsNullOrEmpty(sre.Message))
  112. {
  113. MessageBox.Show(string.Format(Messages.MSG_CMN_W007, sre.Message), Text,
  114. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  115. }
  116. else
  117. {
  118. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "更新财年", "保存"), Text,
  119. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  120. }
  121. }
  122. else
  123. {
  124. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "更新财年", "保存"), Text,
  125. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  126. }
  127. #endregion
  128. }
  129. catch (Exception ex)
  130. {
  131. // 对异常进行共通处理
  132. ExceptionManager.HandleEventException(ToString(),
  133. System.Reflection.MethodBase.GetCurrentMethod().Name, Text, ex);
  134. }
  135. }
  136. /// <summary>
  137. /// 关闭按钮事件
  138. /// </summary>
  139. /// <param name="sender"></param>
  140. /// <param name="e"></param>
  141. private void btnClose_Click(object sender, EventArgs e)
  142. {
  143. Close();
  144. }
  145. #endregion
  146. }
  147. }