public ActionResult CancelDelegation(int Id) { deptId = GetDeptId(); DelegationDAO delegationDAO = new DelegationDAO(); //status = "completed"; //departmentDAO.UpdateDepartmentDelegation(deptId, delegationDAO.GetDelegationById(Id).EmployeeId, status); //delegationDAO.CancelDelegation(Id); if (!departmentDAO.CancelDelegation(deptId, Id)) { SetFlash(Enums.FlashMessageType.Error, "Something went wrong!"); return(RedirectToAction("Delegation", "DepartmentHead")); } ///// start Email ///// Delegation delegation = delegationDAO.GetDelegationById(Id); EmailDAO emailDAO = new EmailDAO(); Employee employee = emailDAO.EmailDelegation(delegation.EmployeeId); Email email = new Email(); email.SendEmail(employee.Email, "Delegation", "Dear " + delegation.EmployeeName + ",Please Check delegation status"); /////////////////////// SetFlash(Enums.FlashMessageType.Success, "You've cancelled Authority Delegation!"); return(RedirectToAction("Delegation", "DepartmentHead")); }
public MResponseList <Delegation> getDelegates(string deptId) { DelegationDAO delegationDAO = new DelegationDAO(); MResponseList <Delegation> respone = new MResponseList <Delegation>() { ResList = delegationDAO.GetDelegations(deptId), }; return(respone); }
//EmployeeDAO _employeeDAO; //RequisitionDAO _requisitionDAO; //RequisitionItemDAO _requisitionItemDAO; //ItemDAO _itemDAO; //DepartmentDAO _deparmentDAO; //CollectionPointDAO _collectionPointDAO; public DepartmentHeadController() { _employeeDAO = new EmployeeDAO(); _requisitionDAO = new RequisitionDAO(); _requisitionItemDAO = new RequisitionItemDAO(); _itemDAO = new ItemDAO(); _departmentDAO = new DepartmentDAO(); _notificationChannelDAO = new NotificationChannelDAO(); _collectionPointDAO = new CollectionPointDAO(); _delegationDAO = new DelegationDAO(); }
public HomeController() { _employeeDAO = new EmployeeDAO(); _collectionPointDAO = new CollectionPointDAO(); _notificationChannelDAO = new NotificationChannelDAO(); _requisitionDAO = new RequisitionDAO(); _delegationDAO = new DelegationDAO(); _departmentDAO = new DepartmentDAO(); _disbursementDAO = new DisbursementDAO(); _disbursementItemDAO = new DisbursementItemDAO(); }
public MResponse CancelDelegate(int headId, string deptId, Delegation delegation) { bool success = new DelegationDAO().CancelDelegation(deptId, delegation.Id); if (success) { Email email = new Email(); Employee e = new EmployeeDAO().GetEmployeeById(headId); email.SendEmail(delegation.Email, "Authority Delegation Cancel", email.CancelMsgBody(delegation, e.Name)); } MResponse response = new MResponse(success); return(response); }
public MResponse PostDelegate(Delegation delegation, int headId, string deptId) { bool success = new DelegationDAO().InsertDelegation(delegation, deptId); if (success) { Email email = new Email(); Employee e = new EmployeeDAO().GetEmployeeById(headId); email.SendEmail(delegation.Email, "Authority Delegation", email.CreateMsgBody(delegation, e.Name)); } MResponse response = new MResponse(success); return(response); }
public ActionResult ViewDelegationStatus() { EmployeeDAO employeeDAO = new EmployeeDAO(); Employee emp = new Employee(); emp = employeeDAO.GetEmployeeByUsername(Session["username"].ToString()); int empId = emp.Id; //int empId = 11237; // String today = DateTime.Now.ToString("yyyy/MM/dd"); DateTime today = DateTime.Today; DelegationDAO dele = new DelegationDAO(); ViewData["delegation"] = dele.GetDelegationStatus(empId); ViewData["today"] = today; return(View()); }
public override void OnActionExecuting(ActionExecutingContext aec) { DelegationDAO delegationDAO = new DelegationDAO(); EmployeeDAO employeeDAO = new EmployeeDAO(); Debug.WriteLine("OnActionExecuting", aec.RouteData); int IdEmployee = (int)aec.HttpContext.Session["IdEmployee"]; string controllerName = aec.ActionDescriptor.ControllerDescriptor.ControllerName; if (controllerName.Contains("Employee")) { if (delegationDAO.CheckIfInDelegationPeriod(IdEmployee)) { Debug.WriteLine("OnActionExecuting should be acting head"); employeeDAO.UpdateRoleToActingHead(IdEmployee); HttpContext.Current.Session.Clear(); aec.Result = new RedirectToRouteResult( new RouteValueDictionary { { "controller", "DepartmentActingHead" }, { "action", "Notification" } }); } } if (controllerName.Contains("ActingHead")) { if (!delegationDAO.CheckIfInDelegationPeriod(IdEmployee)) { Debug.WriteLine("OnActionExecuting should be Employee"); employeeDAO.UpdateRoleToEmployee(IdEmployee); HttpContext.Current.Session.Clear(); aec.Result = new RedirectToRouteResult( new RouteValueDictionary { { "controller", "Employee" }, { "action", "Index" } }); } } }