F_PP_0102.cs 4.7 KB

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