public bool CancelPendingRequisition(int requisitionId, int cancelledBy) { Requisition r = requisitionRepo.FindById(requisitionId); if (r.EmployeeId != cancelledBy) { return(false); } r.Status = RequisitionStatusEnum.CANCELLED.ToString(); requisitionRepo.Update(r); CascadeToRequisitionDetails("cancel", requisitionId); return(true); }
public void ApproveRejectPendingRequisition(int requisitionId, string action, string remarks) { Requisition r = requisitionRepo.FindById(requisitionId); if (remarks != null) { r.Remarks = remarks; } if (action.Equals("approve")) { r.Status = RequisitionStatusEnum.APPROVED.ToString(); requisitionRepo.Update(r); CascadeToRequisitionDetails(action, requisitionId); } else { r.Status = RequisitionStatusEnum.REJECTED.ToString(); requisitionRepo.Update(r); CascadeToRequisitionDetails(action, requisitionId); } emailNotificationService.NotifyEmployeeApprovedOrRejectedRequisition(r, r.Employee); }