/// <summary> /// Final approves this request with comments. /// </summary> /// <param name="comments">The comments.</param> public void FinalApprove(string comments) { // if you have the authority and it can be reviewed, then final approve RequestOfficer officer = new RequestOfficer(this.applicationContext); if (officer.CanApprove()) { if (CanBeReviewed) { this.Status = RequestStatus.Approved; this.FinalReviewedBy = this.applicationContext.Identity.Name; this.FinalReviewedOn = DateTime.Now; this.PendingReviewBy = ""; ttrProvider.Save(this); // audit the approval AddApprovalAudit(ApprovalStatus.FinalApproved, comments); // send out an email to the requestor RequestNotifier notifier = new RequestNotifier(); notifier.SendRequestFinalReviewed(this, comments); } else throw new System.InvalidOperationException(Resources.FinalApproveNotAllowedException); } else throw new System.Security.SecurityException(Resources.FinalApproveNotAuthorizedException); }
private void Route(System.Net.Mail.MailAddress recipient) { this.PendingReviewBy = this.odsProvider.GetEmployeeByWorkEmailAddress(recipient.Address).NetworkId; ttrProvider.Save(this); AddApprovalAudit(ApprovalStatus.Routed, ""); RequestNotifier pendingApprovalNotifier = new RequestNotifier(); pendingApprovalNotifier.SendForReview(this, recipient); }
/// <summary> /// Denies this request with comments. /// </summary> /// <param name="comments">The comments.</param> public void Deny(string comments) { // if you have the authority and it can be reviewed, then deny RequestOfficer officer = new RequestOfficer(this.applicationContext); if (officer.CanDeny()) { if (CanBeReviewed) { // comments are required for denial if (string.IsNullOrEmpty(comments)) throw new System.InvalidOperationException(Resources.CommentsMissingForDenyException); else { this.PendingReviewBy = ""; this.Status = RequestStatus.Denied; this.FinalReviewedBy = this.applicationContext.Identity.Name; this.FinalReviewedOn = DateTime.Now; ttrProvider.Save(this); // audit the reviewal AddApprovalAudit(ApprovalStatus.Denied, comments); // notify the requestor RequestNotifier notifier = new RequestNotifier(); notifier.SendRequestFinalReviewed(this, comments); } } else throw new System.InvalidOperationException(Resources.DenyNotAllowedException); } else throw new System.Security.SecurityException(Resources.DenyNotAuthorizedException); }