private void approveDenyDailyLeave(bool isApprove, Domain.User currentUser, TimeSheetManager timeSheetManager, DailyLeaveManager dlm, DailyLeave dailyLeave, string userDescription) { if (dailyLeave.WorkflowStage.Type == "Final") { throw new Exception("هم اکنون تایید نهایی می باشد"); } var isManager = timeSheetManager.IsUserOrganisationMnager(dailyLeave.UserID, currentUser); if (dailyLeave.WorkflowStage.Type == "Manager" && !isManager) { throw new Exception("آیتم منتظر تایید مدیر ستادی است"); } var data = new ApproveAndDenyJson() { id = dailyLeave.ID.ToString(), date = DateTime.Now, description = userDescription, workflowStageID = dailyLeave.WorkflowStageID }; if (isApprove) { dlm.Approve(dailyLeave); HistoryUtilities.RegisterApproveHistory(data, this._uow, currentUser); } else { dlm.Deny(dailyLeave); HistoryUtilities.RegisterApproveHistory(data, this._uow, currentUser); } }
public ActionResult DenyConfirmed(Guid id) { DailyLeaveManager dlm = new DailyLeaveManager(UOW); var result = dlm.GetByID(id); dlm.Deny(result); UOW.SaveChanges(); return(RedirectToAction("ApproveIndex", new { ac = "Deny" })); }
public ActionResult DenyAll() { DailyLeaveManager dlm = new DailyLeaveManager(UOW); var dailyLeaves = dlm.GetByOrganisationID(this.CurrentUser.OrganizationUnitID). Where(x => x.WorkflowStage.Order == 3); foreach (var leave in dailyLeaves) { dlm.Deny(leave); } UOW.SaveChanges(); return(RedirectToAction("ApproveIndex", new { ac = "DenyAll" })); }