public ActionResult Delegation(Delegation delegation) { deptId = GetDeptId(); status = "Ongoing"; string currentStatus = departmentDAO.GetDepartmentByDeptId(deptId).DelegateStatus; if (currentStatus == status) { SetFlash(Enums.FlashMessageType.Error, "You've already granted authourity to someone!"); return(RedirectToAction("Delegation", "DepartmentHead")); } else { delegation.EmployeeId = employeeDAO.GetEmployeeByName(deptId, delegation.EmployeeName).Id; if (!departmentDAO.InsertDelegation(delegation, deptId)) { SetFlash(Enums.FlashMessageType.Error, "Something went wrong!"); return(RedirectToAction("Delegation", "DepartmentHead")); } ///// start Email ///// EmailDAO emailDAO = new EmailDAO(); Employee employee = emailDAO.EmailDelegation(delegation.EmployeeId); Email email = new Email(); email.SendEmail(employee.Email, "Delegation", "Please Check delegation status"); /////////////////////// /// SetFlash(Enums.FlashMessageType.Success, "Authourity successfully granted!"); //delegationDAO.CreateDelegation(delegation); //departmentDAO.UpdateDepartmentDelegation(deptId, delegation.EmployeeId, status); return(RedirectToAction("Delegation", "DepartmentHead")); } }
public ActionResult CollectionPoint() { List <CollectionPoint> collectionPoints = new List <CollectionPoint>(); collectionPoints = collectionPointDAO.GetCollectionPoints(); //Getting all 6 collection point locations ViewData["collectionPoints"] = collectionPoints; string deptId = GetDeptId(Session["username"].ToString()); Department department = departmentDAO.GetDepartmentByDeptId(deptId); //Getting current repname of department string repName = employeeDAO.GetEmployeeById(department.RepId).Name; //Getting current collection point of department string collectionPointName = collectionPointDAO.GetCollectionPointById(department.CollectionPoinId).Name; ViewData["representativeName"] = repName; ViewData["collectionPoint"] = collectionPointName; return(View()); }