private void SendEmail(CostSharingRequestStatus CSRS)
 {
     if (CSRS.Approver != 0)
     {
         if (_presenter.GetUser(CSRS.Approver).IsAssignedJob != true)
         {
             EmailSender.Send(_presenter.GetUser(CSRS.Approver).Email, "Cost Sharing Payment Approval", (_presenter.CurrentCostSharingRequest.AppUser.FullName).ToUpper() + " Requests for Cost Sharing with Request No. '" + (_presenter.CurrentCostSharingRequest.RequestNo).ToUpper() + "'");
         }
         else
         {
             EmailSender.Send(_presenter.GetUser(_presenter.GetAssignedJobbycurrentuser(CSRS.Approver).AssignedTo).Email, "Cost Sharing Payment Approval", (_presenter.CurrentCostSharingRequest.AppUser.FullName).ToUpper() + " Requests for Cost Sharing with Request No. '" + (_presenter.CurrentCostSharingRequest.RequestNo).ToUpper() + "'");
         }
     }
     else
     {
         foreach (AppUser Payer in _presenter.GetAppUsersByEmployeePosition(CSRS.ApproverPosition))
         {
             if (Payer.IsAssignedJob != true)
             {
                 EmailSender.Send(Payer.Email, "Cost Sharing Payment Approval", (_presenter.CurrentCostSharingRequest.AppUser.FullName).ToUpper() + " Requests for Cost Sharing with Request No. " + (_presenter.CurrentCostSharingRequest.RequestNo).ToUpper());
             }
             else
             {
                 EmailSender.Send(_presenter.GetUser(_presenter.GetAssignedJobbycurrentuser(Payer.Id).AssignedTo).Email, "Cost Sharing Payment Approval", (_presenter.CurrentCostSharingRequest.AppUser.FullName).ToUpper() + " Requests for Cost Sharing with Request No. '" + (_presenter.CurrentCostSharingRequest.RequestNo).ToUpper());
             }
         }
     }
 }
 private void SendEmail(CostSharingRequestStatus CPRS)
 {
     if (GetSuperviser(CPRS.Approver).IsAssignedJob != true)
     {
         EmailSender.Send(GetSuperviser(CPRS.Approver).Email, "Cost Sharing Request", (CurrentCostSharingRequest.AppUser.FullName).ToUpper() + " Requests for Cost Sharing with Request No. - '" + (CurrentCostSharingRequest.RequestNo).ToUpper() + "'");
     }
     else
     {
         EmailSender.Send(GetSuperviser(_controller.GetAssignedJobbycurrentuser(CPRS.Approver).AssignedTo).Email, "Cost Sharing Request", (CurrentCostSharingRequest.AppUser.FullName).ToUpper() + " Requests for Cost Sharing with Request No. - '" + (CurrentCostSharingRequest.RequestNo).ToUpper() + "'");
     }
 }
 private void SaveCostSharingRequestStatus()
 {
     if (GetApprovalSetting(RequestType.CostSharing_Request.ToString().Replace('_', ' '), 0) != null)
     {
         int i = 1;
         foreach (ApprovalLevel AL in GetApprovalSetting(RequestType.CostSharing_Request.ToString().Replace('_', ' '), 0).ApprovalLevels)
         {
             CostSharingRequestStatus CSRS = new CostSharingRequestStatus();
             CSRS.CostSharingRequest = CurrentCostSharingRequest;
             //All Approver positions must be entered into the database before the approval workflow could run effectively!
             if (AL.EmployeePosition.PositionName == "Superviser/Line Manager")
             {
                 if (CurrentUser().Superviser != 0)
                 {
                     CSRS.Approver = CurrentUser().Superviser.Value;
                 }
                 else
                 {
                     CSRS.ApprovalStatus = ApprovalStatus.Approved.ToString();
                     CSRS.Date           = Convert.ToDateTime(DateTime.Today.Date.ToShortDateString());
                 }
             }
             else if (AL.EmployeePosition.PositionName == "Program Manager")
             {
                 if (CurrentCostSharingRequest.CostSharingRequestDetails[0].Project.Id != 0)
                 {
                     CSRS.Approver = GetProject(CurrentCostSharingRequest.CostSharingRequestDetails[0].Project.Id).AppUser.Id;
                 }
             }
             else
             {
                 if (Approver(AL.EmployeePosition.Id) != null)
                 {
                     if (AL.EmployeePosition.PositionName == "Finance Officer")
                     {
                         CSRS.ApproverPosition = AL.EmployeePosition.Id; //So that we can entertain more than one finance manager to handle the request
                     }
                     else
                     {
                         CSRS.Approver = Approver(AL.EmployeePosition.Id).Id;
                     }
                 }
                 else
                 {
                     CSRS.Approver = 0;
                 }
             }
             CSRS.WorkflowLevel = i;
             i++;
             CurrentCostSharingRequest.CostSharingRequestStatuses.Add(CSRS);
         }
     }
 }
 private void SendEmailRejected(CostSharingRequestStatus CSRS)
 {
     EmailSender.Send(_presenter.GetUser(_presenter.CurrentCostSharingRequest.AppUser.Id).Email, "Cost Sharing Payment Request Rejection", "Your Cost Sharing Request with Request No. " + (_presenter.CurrentCostSharingRequest.VoucherNo).ToUpper() + " was Rejected by " + _presenter.CurrentUser().FullName + " for this reason '" + (CSRS.RejectedReason).ToUpper() + "'");
 }