private void SendEmail(CashPaymentRequestStatus CPRS) { if (CPRS.Approver != 0) { if (_presenter.GetUser(CPRS.Approver).IsAssignedJob != true) { EmailSender.Send(_presenter.GetUser(CPRS.Approver).Email, "Payment Approval", (_presenter.CurrentCashPaymentRequest.AppUser.FullName).ToUpper() + " Requests for Payment with Request No. " + (_presenter.CurrentCashPaymentRequest.RequestNo).ToUpper()); } else { EmailSender.Send(_presenter.GetUser(_presenter.GetAssignedJobbycurrentuser(CPRS.Approver).AssignedTo).Email, "Payment Approval", (_presenter.CurrentCashPaymentRequest.AppUser.FullName).ToUpper() + " Requests for Payment with Request No. " + (_presenter.CurrentCashPaymentRequest.RequestNo).ToUpper()); } } else { foreach (AppUser Payer in _presenter.GetAppUsersByEmployeePosition(CPRS.ApproverPosition)) { if (Payer.IsAssignedJob != true) { EmailSender.Send(Payer.Email, "Payment Approval", (_presenter.CurrentCashPaymentRequest.AppUser.FullName).ToUpper() + " Requests for Payment with Request No. " + (_presenter.CurrentCashPaymentRequest.RequestNo).ToUpper()); } else { EmailSender.Send(_presenter.GetUser(_presenter.GetAssignedJobbycurrentuser(Payer.Id).AssignedTo).Email, "Payment Approval", (_presenter.CurrentCashPaymentRequest.AppUser.FullName).ToUpper() + " Requests for Payment with Request No. '" + (_presenter.CurrentCashPaymentRequest.RequestNo).ToUpper()); } } } }
private void SendEmail(CashPaymentRequestStatus CPRS) { if (CPRS.Approver != 0) { if (GetSuperviser(CPRS.Approver).IsAssignedJob != true) { EmailSender.Send(GetSuperviser(CPRS.Approver).Email, "Cash Payment Request", (CurrentCashPaymentRequest.AppUser.FullName).ToUpper() + "Requests for Cash Payment with Request No. - '" + (CurrentCashPaymentRequest.RequestNo).ToUpper() + "'"); } else { EmailSender.Send(GetSuperviser(_controller.GetAssignedJobbycurrentuser(CPRS.Approver).AssignedTo).Email, "Cash Payment Request", (CurrentCashPaymentRequest.AppUser.FullName).ToUpper() + " Requests for Cash Payment with Request No. - '" + (CurrentCashPaymentRequest.RequestNo).ToUpper() + "'"); } } else { foreach (AppUser accountant in _settingController.GetAppUsersByEmployeePosition(CPRS.ApproverPosition)) { if (accountant.IsAssignedJob != true) { EmailSender.Send(accountant.Email, "Cash Payment Request", (CurrentCashPaymentRequest.AppUser.FullName).ToUpper() + " Requests for Cash Payment with Request No. - '" + (CurrentCashPaymentRequest.RequestNo).ToUpper() + "'"); } else { EmailSender.Send(GetSuperviser(_controller.GetAssignedJobbycurrentuser(accountant.Id).AssignedTo).Email, "Cash Payment Request", (CurrentCashPaymentRequest.AppUser.FullName).ToUpper() + " Requests for Cash Payment with Request No. - '" + (CurrentCashPaymentRequest.RequestNo).ToUpper() + "'"); } } } }
private void SendEmail(CashPaymentRequestStatus CPRS) { if (GetSuperviser(CPRS.Approver).IsAssignedJob != true) { EmailSender.Send(GetSuperviser(CPRS.Approver).Email, "Cash Payment Request", (CurrentCashPaymentRequest.AppUser.FullName).ToUpper() + "Requests for Cash Payment with Request No. - '" + (CurrentCashPaymentRequest.RequestNo).ToUpper() + "'"); } else { EmailSender.Send(GetSuperviser(_controller.GetAssignedJobbycurrentuser(CPRS.Approver).AssignedTo).Email, "Cash Payment Request", (CurrentCashPaymentRequest.AppUser.FullName).ToUpper() + " Requests for Cash Payment with Request No. - '" + (CurrentCashPaymentRequest.RequestNo).ToUpper() + "'"); } }
private void SaveCashPaymentRequestStatus() { if (GetApprovalSetting(RequestType.CashPayment_Request.ToString().Replace('_', ' '), CurrentCashPaymentRequest.TotalAmount) != null) { int i = 1; foreach (ApprovalLevel AL in GetApprovalSetting(RequestType.CashPayment_Request.ToString().Replace('_', ' '), CurrentCashPaymentRequest.TotalAmount).ApprovalLevels) { CashPaymentRequestStatus CPRS = new CashPaymentRequestStatus(); CPRS.CashPaymentRequest = CurrentCashPaymentRequest; //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) { CPRS.Approver = CurrentUser().Superviser.Value; } else { CPRS.ApprovalStatus = ApprovalStatus.Approved.ToString(); CPRS.Date = Convert.ToDateTime(DateTime.Today.Date.ToShortDateString()); } } else if (AL.EmployeePosition.PositionName == "Program Manager") { if (CurrentCashPaymentRequest.CashPaymentRequestDetails[0].Project.Id != 0) { CPRS.Approver = GetProject(CurrentCashPaymentRequest.CashPaymentRequestDetails[0].Project.Id).AppUser.Id; } } else { if (Approver(AL.EmployeePosition.Id) != null) { if (AL.EmployeePosition.PositionName == "Finance Officer") { CPRS.ApproverPosition = AL.EmployeePosition.Id; //So that we can entertain more than one finance manager to handle the request } else { CPRS.Approver = Approver(AL.EmployeePosition.Id).Id; } } else { CPRS.Approver = 0; } } CPRS.WorkflowLevel = i; i++; CurrentCashPaymentRequest.CashPaymentRequestStatuses.Add(CPRS); } } }
private void SendEmailRejected(CashPaymentRequestStatus CPRS) { EmailSender.Send(_presenter.GetUser(_presenter.CurrentCashPaymentRequest.AppUser.Id).Email, "Payment Request Rejection", "Your Payment Request with Voucher No. " + (_presenter.CurrentCashPaymentRequest.VoucherNo).ToUpper() + " made by " + (_presenter.GetUser(_presenter.CurrentCashPaymentRequest.AppUser.Id).FullName).ToUpper() + " was Rejected by " + _presenter.CurrentUser().FullName + " for this reason - '" + (CPRS.RejectedReason).ToUpper() + "'"); if (CPRS.WorkflowLevel > 1) { for (int i = 0; i + 1 < CPRS.WorkflowLevel; i++) { EmailSender.Send(_presenter.GetUser(_presenter.CurrentCashPaymentRequest.CashPaymentRequestStatuses[i].Approver).Email, "Payment Request Rejection", "Payment Request with Voucher No. " + (_presenter.CurrentCashPaymentRequest.VoucherNo).ToUpper() + " made by " + (_presenter.GetUser(_presenter.CurrentCashPaymentRequest.AppUser.Id).FullName).ToUpper() + " was Rejected by " + _presenter.CurrentUser().FullName + " for this reason - '" + (CPRS.RejectedReason).ToUpper() + "'"); } } }