VmPolicyEnsure.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. 
  2. ///////////////////////////////////////////////////////////////////////////////
  3. //文件名称: VmPolicyEnsure.cs
  4. //文件描述: VmPolicyEnsure.cs
  5. //创 建 者: xls
  6. //创建日期: 2018/9/17 23:40:48
  7. //版 本 号:1.0.0.0
  8. ////////////////////////////////////////////////////////////////////////////////
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. using System.Windows;
  15. using Com.FirmLib.UI.BllCommon;
  16. using Com.FirmLib.UI.Common;
  17. using Com.FirmLib.UI.Insuer.Model;
  18. using FWindSoft.MVVM;
  19. using FWindSoft.Wpf;
  20. using FWindSoft.Wpf.Common;
  21. namespace Com.FirmLib.UI.Insuer
  22. {
  23. public class VmPolicyEnsure : BaseViewModel
  24. {
  25. public VmPolicyEnsure()
  26. {
  27. Init();
  28. }
  29. private void Init()
  30. {
  31. this.EditType = EditType.Update;
  32. CorrectEndDate = DateTimeManager.ConvertDateTime(DateTime.Now);
  33. }
  34. public void Init(LoadParameter parameter)
  35. {
  36. PolicyUpdateContext context = parameter.Parameter as PolicyUpdateContext;
  37. if (context == null)
  38. return;
  39. Context = context;
  40. }
  41. #region 属性相关
  42. private PolicyUpdateContext Context { get; set; }
  43. private EditType m_EditType;
  44. /// <summary>
  45. /// 编辑类型\修改还是更正
  46. /// </summary>
  47. public EditType EditType
  48. {
  49. get { return this.m_EditType; }
  50. set
  51. {
  52. this.m_EditType = value;
  53. RaisePropertyChanged(nameof(this.EditType));
  54. }
  55. }
  56. private string m_CorrectDate;
  57. /// <summary>
  58. /// 改正日期
  59. /// </summary>
  60. public string CorrectEndDate
  61. {
  62. get { return this.m_CorrectDate; }
  63. set
  64. {
  65. this.m_CorrectDate = value;
  66. RaisePropertyChanged(() => this.CorrectEndDate);
  67. }
  68. }
  69. #endregion
  70. #region 命令相关
  71. /// <summary>
  72. /// 确定按钮
  73. /// </summary>
  74. /// <param name="parameter"></param>
  75. [Command]
  76. public void EnsureCommand(object parameter)
  77. {
  78. try
  79. {
  80. Window window = parameter as Window;
  81. if (window == null)
  82. {
  83. return;
  84. }
  85. PolicyUpdateContext context = Context;
  86. context.CanExecute = true;
  87. context.EditType = this.EditType;
  88. context.EffectiveTime = this.CorrectEndDate;
  89. window.SetRealResult(context);
  90. window.DialogResult = true;
  91. }
  92. catch (Exception ex)
  93. {
  94. MessageTipEx.Show(ex);
  95. }
  96. }
  97. public bool CanEnsureCommand(object parameter)
  98. {
  99. return true;
  100. }
  101. #endregion
  102. }
  103. }