public ClaimListItemViewModel([NotNull] Claim claim, int currentUserId) { if (claim == null) { throw new ArgumentNullException(nameof(claim)); } var lastComment = claim.CommentDiscussion.Comments.Where(c => c.IsVisibleToPlayer) .OrderByDescending(c => c.CommentId).FirstOrDefault(); ClaimId = claim.ClaimId; ClaimFullStatusView = new ClaimFullStatusView(claim, new AccessArguments(claim, currentUserId)); Name = claim.Name; Player = claim.Player; UpdateDate = lastComment?.LastEditTime ?? claim.CreateDate; CreateDate = claim.CreateDate; Responsible = claim.ResponsibleMasterUser; LastModifiedBy = lastComment?.Author ?? claim.Player; UnreadCommentsCount = claim.CommentDiscussion.GetUnreadCount(currentUserId); ProjectId = claim.ProjectId; ProjectName = claim.Project.ProjectName; Fields = claim.GetFields(); FeePaid = claim.ClaimBalance(); FeeDue = claim.ClaimFeeDue(); PreferentialFeeUser = claim.PreferentialFeeUser; AccomodationType = claim.AccommodationRequest?.AccommodationType.Name; RoomName = claim.AccommodationRequest?.Accommodation?.Name; }
public ClaimListItemViewModel([NotNull] Claim claim, int currentUserId) { if (claim == null) { throw new ArgumentNullException(nameof(claim)); } var lastComment = claim.Comments.Where(c => c.IsVisibleToPlayer).OrderByDescending(c => c.CommentId).FirstOrDefault(); ClaimId = claim.ClaimId; ClaimStatus = (ClaimStatusView)claim.ClaimStatus; Name = claim.Name; Player = claim.Player; UpdateDate = lastComment?.LastEditTime ?? claim.CreateDate; CreateDate = claim.CreateDate; Responsible = claim.ResponsibleMasterUser; LastModifiedBy = lastComment?.Author ?? claim.Player; UnreadCommentsCount = claim.Comments.Count(comment => (comment.IsVisibleToPlayer || claim.HasMasterAccess(currentUserId)) && !comment.IsReadByUser(currentUserId)); ProjectId = claim.ProjectId; ProjectName = claim.Project.ProjectName; Fields = new CustomFieldsViewModel(currentUserId, claim); FeePaid = claim.ClaimBalance(); FeeDue = claim.ClaimFeeDue(); }
public RequestParticipantViewModel(Claim claim) { ClaimId = claim.ClaimId; Claim = claim; UserId = claim.PlayerUserId; User = claim.Player; FeeTotal = Claim.ClaimTotalFee(); FeeToPay = Claim.ClaimFeeDue(); }