F_PP_0102.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*******************************************************************************
  2. * Copyright(c) 2019 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PP_0102.cs
  5. * 2.功能描述:年计划新建
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 徐伟 2019/08/27 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Reflection;
  12. using System.Windows.Forms;
  13. using Dongke.IBOSS.PRD.Client.CommonModule;
  14. using Dongke.IBOSS.PRD.Client.Controls;
  15. using Dongke.IBOSS.PRD.Client.DataModels;
  16. using Dongke.IBOSS.PRD.WCF.DataModels;
  17. using Dongke.IBOSS.PRD.WCF.Proxys;
  18. namespace Dongke.IBOSS.PRD.Client.PPModule
  19. {
  20. /// <summary>
  21. /// 年计划窗体
  22. /// </summary>
  23. public partial class F_PP_0102 : DKDockPanelBase
  24. {
  25. #region 单例模式 防止窗体被重复创建
  26. private static F_PP_0102 _instance = null;
  27. public static F_PP_0102 Instance
  28. {
  29. get
  30. {
  31. if (_instance == null)
  32. {
  33. _instance = new F_PP_0102();
  34. }
  35. return _instance;
  36. }
  37. }
  38. private void F_PP_0102_FormClosed(object sender, FormClosedEventArgs e)
  39. {
  40. _instance = null;
  41. }
  42. #endregion
  43. #region 构造函数
  44. /// <summary>
  45. /// 年计划窗体
  46. /// </summary>
  47. public F_PP_0102()
  48. {
  49. InitializeComponent();
  50. //this.Text = "年计划";
  51. }
  52. #endregion
  53. //年计划id,0:插入操作,>0更新操作
  54. public int planId = 0;
  55. /// <summary>
  56. /// 画面加载
  57. /// </summary>
  58. /// <param name="sender"></param>
  59. /// <param name="e"></param>
  60. private void F_PP_0102_Load(object sender, System.EventArgs e)
  61. {
  62. try
  63. {
  64. // 加载权限
  65. FormPermissionManager.FormPermissionControl(this.Name, this,
  66. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  67. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  68. }
  69. catch (Exception ex)
  70. {
  71. // 对异常进行共通处理
  72. ExceptionManager.HandleEventException(this.ToString(),
  73. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  74. }
  75. }
  76. private void BtnCancel_Click(object sender, EventArgs e)
  77. {
  78. this.Close();
  79. }
  80. private void BtnSave_Click(object sender, EventArgs e)
  81. {
  82. PlanYearUpdate();
  83. this.Close();
  84. }
  85. //更新操作
  86. private void PlanYearUpdate()
  87. {
  88. //年计划 插入
  89. ClientRequestEntity cre = new ClientRequestEntity();
  90. //用户填写的数据
  91. cre.Properties["YEARNO"] = Convert.ToInt32(planYearNo.Text);
  92. cre.Properties["PLANNAME"] = planName.Text;
  93. cre.Properties["PLANTYPEID"] = Convert.ToInt32(planType.SelectedValue);
  94. cre.Properties["REMARKS"] = planRemarks.Text;
  95. cre.Properties["STARTMONTH"] = planStartMonth.Value.ToString();
  96. cre.Properties["ENDMONTH"] = planEndMonth.Value.ToString();
  97. //自动填写的数据
  98. cre.Properties["STARTDATE"] = Convert.ToDateTime($"{planYearNo.Text}-{planStartMonth.Value.ToString()}-01");
  99. cre.Properties["ENDDATE"] = Convert.ToDateTime($"{planYearNo.Text}-{planEndMonth.Value.ToString()}-1").AddMonths(1).AddDays(-1);
  100. cre.Properties["UPDATETIME"] = DateTime.Now;
  101. cre.Properties["UPDATEUSERID"] = LogInUserInfo.CurrentUser.CurrentUserEntity.UserID;
  102. ServiceResultEntity result;
  103. if (planId == 0)
  104. {
  105. //新建专属的列
  106. cre.Properties["PLANVER"] = PPModuleProxy.Service.PlanYearVer(Convert.ToInt32(planType.SelectedValue));
  107. cre.Properties["ACCOUNTID"] = LogInUserInfo.CurrentUser.CurrentUserEntity.AccountID;
  108. cre.Properties["CREATETIME"] = DateTime.Now;
  109. cre.Properties["CREATEUSERID"] = LogInUserInfo.CurrentUser.CurrentUserEntity.UserID;
  110. result = PPModuleProxy.Service.PlanYearInsert(cre);
  111. }
  112. else
  113. {
  114. //更新时主键要指定值
  115. cre.Properties["PLANID"] = planId;
  116. result = PPModuleProxy.Service.PlanYearUpdate(cre);
  117. }
  118. }
  119. }
  120. }