Ejemplo n.º 1
0
 private static string GetFinalDecisionActivityFeedItemDescription(FinalDecisionCommentKind decision,
     string commentForChange)
 {
     switch (decision)
     {
         case FinalDecisionCommentKind.Accept:
             return "Accept";
         case FinalDecisionCommentKind.Ammend:
             return "Amend";
         case FinalDecisionCommentKind.Changed:
             return "Preliminary Decision Changed: " + commentForChange;
         default:
             throw new ArgumentException();
     }
 }
Ejemplo n.º 2
0
 public void AddFinalDecisionComment(UserHeader user, int caseId, FinalDecisionCommentKind decision, string text)
 {
     var @case = _database.GetCaseById(caseId);
     if (user.Role != Role.PanelMember) throw new ForbiddenException();
     if (@case.AssignedUsers.All(x => x.Id != user.Id)) throw new ForbiddenException();
     var comment = new FinalDecisionComment
     {
         Id = Guid.NewGuid(),
         CaseId = caseId,
         PanelMemberId = user.Id,
         Decision = decision,
         CommentForChange = text,
         Date = DateTime.Now,
     };
     _database.CreateFinalDecisionComment(comment);
     var caseWorker = @case.AssignedUsers.FirstOrDefault(x => x.Role == Role.CaseWorker);
     _mailNotifier.NotifyCaseWorkerAboutFinalDecisionComment(
         new User
         {
             UserId = caseWorker.Id,
             Email = caseWorker.Email,
             FirstName = caseWorker.FirstName,
             LastName = caseWorker.LastName
         },
         new User {UserId = user.Id, Email = user.Email, FirstName = user.FirstName, LastName = user.LastName},
         caseId, text == null ? decision.ToString() : decision + ": " + text);
 }