Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Windows.Forms;
- using System.Windows.Media.Imaging;
- using Healix.Forms.BaseControls;
- using Healix.Wpf.Forms.AssessmentClaims.Events;
- using Healix.Wpf.Parts.ClaimClosureCheckList.Events;
- using HIHWebAPI;
- using HIHWebAPI.Models;
- namespace Healix.Wpf.Parts.ClaimClosureCheckList.Models
- {
- public class ClaimClosureCheckListModel
- {
- public ClaimClosureCheckListModel(int claimId, int memberId)
- {
- _claimId = claimId;
- MemberId = memberId;
- Entity = HihFacade.WebAPI.ClosureChecklistOperations.GetByClaimId(claimId) ?? new ClosureChecklist() { ClaimId = claimId };
- ClaimClosureChecklistResult = HihFacade.WebAPI.ClosureChecklistOperations.GetClaimClosureChecklist(claimId) ?? new ClaimClosureChecklistResult();
- ClosureChecklistOperations = HihFacade.WebAPI.ClosureChecklistOperations;
- }
- private IClosureChecklistOperations ClosureChecklistOperations;
- private int _claimId;
- private ClosureChecklist Entity { get; set; }
- private ClaimClosureChecklistResult ClaimClosureChecklistResult { get; set; }
- public int Id
- {
- get => Entity.Id;
- set
- {
- Entity.Id = value;
- NotifyPropertyChanged(nameof(Id));
- }
- }
- private int MemberId { get; set; }
- public int ClaimId
- {
- get => Entity.ClaimId;
- set
- {
- Entity.ClaimId = value;
- NotifyPropertyChanged(nameof(ClaimId));
- }
- }
- public bool IsProjectedCost
- {
- get => Entity.IsProjectedCost ?? false;
- set
- {
- Entity.IsProjectedCost = value;
- UnchekTickToConfirmChecklistComplete(value);
- Entity = ClosureChecklistOperations.AddEdit(Entity);
- NotifyPropertyChanged(nameof(IsProjectedCost));
- NotifyPropertyChanged(nameof(IsTickToConfirmChecklistCompleteEnabled));
- }
- }
- public bool IsSapSetUp
- {
- get => Entity.IsSapSetUp ?? false;
- set
- {
- Entity.IsSapSetUp = value;
- UnchekTickToConfirmChecklistComplete(value);
- Entity = ClosureChecklistOperations.AddEdit(Entity);
- NotifyPropertyChanged(nameof(IsSapSetUp));
- NotifyPropertyChanged(nameof(IsTickToConfirmChecklistCompleteEnabled));
- }
- }
- public bool? IsAdmissionDateAndDischargeDateSelected
- {
- get => Entity.IsAdmissionDateAndDischargeDateSelected;
- set
- {
- Entity.IsAdmissionDateAndDischargeDateSelected = value;
- Entity = ClosureChecklistOperations.AddEdit(Entity);
- NotifyPropertyChanged(nameof(IsAdmissionDateAndDischargeDateSelected));
- NotifyPropertyChanged(nameof(IsTickToConfirmChecklistCompleteEnabled));
- //NotifyPropertyChanged(nameof(IsAdmissionDateAndDischargeDate));
- //UnchekTickToConfirmChecklistComplete(IsAdmissionDateAndDischargeDate);
- }
- }
- //public bool IsAdmissionDateAndDischargeDate
- //{
- // get => (IsAdmissionDateAndDischargeDateSelected == false) || (IsAdmissionDateAndDischargeDateSelected == true) && IsInpatientDates;
- //}
- public bool IsRecoveryTabCompletedAppropriately
- {
- get => (Entity.IsRecoveryTabCompletedAppropriately ?? false);
- set
- {
- Entity.IsRecoveryTabCompletedAppropriately = value;
- UnchekTickToConfirmChecklistComplete(value);
- Entity = ClosureChecklistOperations.AddEdit(Entity);
- NotifyPropertyChanged(nameof(IsRecoveryTabCompletedAppropriately));
- NotifyPropertyChanged(nameof(IsTickToConfirmChecklistCompleteEnabled));
- }
- }
- public bool IsFinalCourtesyCall
- {
- get => Entity.IsFinalCourtesyCall ?? false;
- set
- {
- Entity.IsFinalCourtesyCall = value;
- UnchekTickToConfirmChecklistComplete(value);
- Entity = ClosureChecklistOperations.AddEdit(Entity);
- NotifyPropertyChanged(nameof(IsFinalCourtesyCall));
- NotifyPropertyChanged(nameof(IsTickToConfirmChecklistCompleteEnabled));
- }
- }
- public bool IsTickToConfirmChecklistCompleteEnabled
- {
- get => IsProjectedCost
- && IsSapSetUp
- && IsRecoveryTabCompletedAppropriately
- && ((IsAdmissionDateAndDischargeDateSelected == false) || (IsAdmissionDateAndDischargeDateSelected == true) && IsInpatientDates);
- }
- public bool IsTickToConfirmChecklistComplete
- {
- get => Entity.IsTickToConfirmChecklistComplete ?? false;
- set
- {
- if (value)
- {
- MessageBox.Show("To complete the closure process please update the Claim Status and ensure a final update is sent to the Underwriter.", Properties.Resources.DialogCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
- Cursor.Current = Cursors.WaitCursor;
- var cmd = new CmsCommand
- {
- MethodName = "CreateChecklistCompletedAction",
- UserName = ProgramBase.UserInfo?.DisplayName,
- UserId = ProgramBase.UserId
- };
- cmd["ClaimId"] = ClaimId;
- cmd["MemberId"] = MemberId;
- TaskRuner.HIHFacade.Invoke(f => f.Execute(cmd));
- Cursor.Current = Cursors.Default;
- }
- Entity.IsTickToConfirmChecklistComplete = value;
- Entity = ClosureChecklistOperations.AddEdit(Entity);
- NotifyPropertyChanged(nameof(IsTickToConfirmChecklistComplete));
- if(value)
- ClaimDetailEditModeEvent.RaiseEvent(this, new GenericEventArgs<int>(_claimId));
- }
- }
- public bool IsMembershipVisible
- {
- get => ClaimClosureChecklistResult.MembershipResultList != null && ClaimClosureChecklistResult.MembershipResultList.Count > 1;
- }
- public bool IsPolicyVerified
- {
- get => ClaimClosureChecklistResult.CheckboxResultList.Any(c => c.IsPolicyVerified);
- }
- public string CoverDecision
- {
- get => ClaimClosureChecklistResult.ActionTypeResultList.FirstOrDefault(_ => _.CoverDecisionDescription != "0")?.CoverDecisionDescription;
- }
- public bool IsCoverDecisionMultipleVisible
- {
- get => ClaimClosureChecklistResult.ActionTypeResultList.Count(_ => _.CoverDecisionDescription != "0") > 1;
- }
- public string AssessmentOutcome
- {
- get => ClaimClosureChecklistResult.ClaimDetailResultList.FirstOrDefault()?.AssessmentOutcome;
- }
- public string Excess
- {
- get => ClaimClosureChecklistResult.ClaimDetailResultList.FirstOrDefault()?.Excess;
- }
- public bool? IsReciprocalHealthAgreement
- {
- get => ClaimClosureChecklistResult.ClaimDetailResultList.FirstOrDefault()?.IsReciprocalHealthAgreement ?? false;
- }
- public string ProjectedCost
- {
- get => Math.Round(ClaimClosureChecklistResult.ClaimDetailResultList.FirstOrDefault()?.ProjectedCost ?? 0, 2).ToString();
- }
- public string ClientClaimRef
- {
- get => ClaimClosureChecklistResult.ClaimDetailResultList.FirstOrDefault()?.ClientClaimRef;
- }
- public bool? IsSapMembership
- {
- get => ClaimClosureChecklistResult.MembershipResultList.Count > 0 && ClaimClosureChecklistResult.MembershipResultList.FirstOrDefault(_ => _.SAPlans != 0)?.SAPlans != null;
- }
- public string AdmissionDate
- {
- get => ClaimClosureChecklistResult.ClaimDetailResultList.FirstOrDefault()?.AdmissionDate?.ToString("dd/MM/yyyy");
- }
- public string DischargeDate
- {
- get => ClaimClosureChecklistResult.ClaimDetailResultList.FirstOrDefault()?.DischargeDate?.ToString("dd/MM/yyyy");
- }
- public bool IsInpatientDates
- {
- get => ClaimClosureChecklistResult.ClaimDetailResultList.FirstOrDefault()?.AdmissionDate != null &&
- ClaimClosureChecklistResult.ClaimDetailResultList.FirstOrDefault()?.DischargeDate != null;
- }
- public string LatestSummary
- {
- get => ClaimClosureChecklistResult.ActionTypeResultList.FirstOrDefault(_ => _.LatestSummaryDescription != "0")?.LatestSummaryDescription;
- }
- public bool IsComplaintNotificationSent
- {
- get => ClaimClosureChecklistResult.CheckboxResultList.Any(c => c.IsComplaintNotificationSent);
- }
- public bool IsHCNSent
- {
- get => CheckIsHCNSent(ClaimClosureChecklistResult.ActionTypeResultList);
- }
- private bool CheckIsHCNSent(IList<ActionTypeResult> actionList)
- {
- var HCNSentDate = ClaimClosureChecklistResult.ActionTypeResultList
- .FirstOrDefault(t => t.HCNSentDescription != "0" && t.HCNSentDescription.Contains("sent"))?.CreatedOn;
- var projectedCostChangedDate = ClaimClosureChecklistResult.ActionTypeResultList
- .FirstOrDefault(t => t.ProjectedCostChangedDescription != "0")?.CreatedOn;
- if (HCNSentDate != null && projectedCostChangedDate != null && HCNSentDate > projectedCostChangedDate)
- return true;
- else return false;
- }
- public bool? UnderwriterReferenceReq
- {
- get => ClaimClosureChecklistResult.ClaimDetailResultList.FirstOrDefault()?.UnderwriterReferenceReq;
- }
- public bool IsClientClaimRef
- {
- get => !string.IsNullOrEmpty(ClientClaimRef) || (UnderwriterReferenceReq ?? false);
- }
- public bool IsClientClaimRefRed
- {
- get => string.IsNullOrEmpty(ClientClaimRef) && (UnderwriterReferenceReq ?? false);
- }
- public BitmapSource WarningImage
- {
- get
- {
- return Properties.Resources.WarningIconSmall.ToWpfBitmap();
- }
- }
- public string SapMembershipText
- {
- get => (IsSapMembership ?? false) ? Properties.Resources.SapMembershipTextChecked : Properties.Resources.SapMembershipTextUnchecked;
- }
- public bool? HCNSentCheckBoxState
- {
- get
- {
- return !IsHCNSent &&
- (ClaimClosureChecklistResult.ClaimDetailResultList.FirstOrDefault()?.ClaimCostThreshold == 0 ||
- (ClaimClosureChecklistResult.ClaimDetailResultList.FirstOrDefault()?.ProjectedCost <
- ClaimClosureChecklistResult.ClaimDetailResultList.FirstOrDefault()?.ClaimCostThreshold))
- ? (bool?) null
- : (!IsHCNSent &&
- (ClaimClosureChecklistResult.ClaimDetailResultList.FirstOrDefault()?.ProjectedCost >=
- ClaimClosureChecklistResult.ClaimDetailResultList.FirstOrDefault()?.ClaimCostThreshold))
- ? false
- : true;
- }
- //get => null;
- //get => false;
- //get => true;
- }
- public bool IsActiveComplaint
- {
- get => ClaimClosureChecklistResult.CheckboxResultList.Any(c => c.IsActiveComplaint);
- }
- public bool? ComplaintNotificationSentCheckBoxState
- {
- get => !IsActiveComplaint
- ? (bool?)null
- : (IsComplaintNotificationSent ? true : false);
- //get => null;
- //get => false;
- //get => true;
- }
- void UnchekTickToConfirmChecklistComplete(bool b)
- {
- if (!b && IsTickToConfirmChecklistComplete)
- IsTickToConfirmChecklistComplete = b;
- }
- public event PropertyChangedEventHandler PropertyChanged;
- internal void NotifyPropertyChanged(string propertyName)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement