public ActionResult ProcessRequest(int id) { LeaveRequestInfo reqInfo = db.LeaveRequestInfo.Find(id); LeaveRequestDescription reqDes = EmployeeLeaveRequestViewModelsController.getLatestDescription(reqInfo, db); DepartmentManagerLeaveRequestViewModel viewModel = new DepartmentManagerLeaveRequestViewModel() { AllDayEvent = reqDes.AllDayEvent, DepartmentManager = reqDes.DepartmentManager, DepartmentManagerStatus = reqDes.DepartmentManagerStatus, Employee = reqInfo.Employee, EndTime = reqDes.EndTime, Description = reqDes.Description, LeaveReason = reqDes.LeaveReason, StartTime = reqDes.StartTime, DepartmentManagerComment = reqDes.DepartmentManagerComment, LeaveRequestID = reqInfo.LeaveRequestInfoID }; ViewBag.departmentManagerStatusID = new SelectList(db.RequestStatus, "requestStatusID", "requestStatusName", GetRequestStatusByName(reqDes.DepartmentManagerStatus.RequestStatusName).RequestStatusID); ViewData["employeeName"] = reqInfo.Employee.EmployeeName; ViewData["startTime"] = reqDes.StartTime; ViewData["endTime"] = reqDes.EndTime; ViewData["allDayEvent"] = reqDes.AllDayEvent; return(View("DepartmentManagerProcessRequest", viewModel)); }
public void sendMailWithNewPass(Employee employee, string password) { string email = employee.EmployeeEmail; string subject = "Request Updated"; string employeeHTMLBody = getHTMLEmailForNewPass(password, employee.EmployeeName); EmployeeLeaveRequestViewModelsController.sendMailUsingDBSettings(db, email, subject, employeeHTMLBody); }
private void sendMailToDepartmentManager(LeaveRequestInfo info, LeaveRequestDescription desc) { Employee employee = db.Employees.Single(e => e.EmployeeID == desc.DepartmentManager.EmployeeID); string email = employee.EmployeeEmail; string subject = "New Leave Request"; string depManagerHTMLBody = getHTMLEmailForDepManager(info, desc); EmployeeLeaveRequestViewModelsController.sendMailUsingDBSettings(db, email, subject, depManagerHTMLBody); }
private void sendMailToEmployee(int employeeID) { Employee employee = db.Employees.Single(e => e.EmployeeID == employeeID); string email = employee.EmployeeEmail; string subject = "Request Updated"; string employeeHTMLBody = getHTMLEmailForEmployee(); EmployeeLeaveRequestViewModelsController.sendMailUsingDBSettings(db, email, subject, employeeHTMLBody); }
public void sendMailToNewEmployee(int employeeID, string password) { Employee employee = db.Employees.Single(e => e.EmployeeID == employeeID); string email = employee.EmployeeEmail; string subject = "Registration"; string employeeHTMLBody = getHTMLEmailForNewEmployee(password, employee.EmployeeName); EmployeeLeaveRequestViewModelsController.sendMailUsingDBSettings(db, email, subject, employeeHTMLBody); }
private Dictionary <LeaveRequestInfo, LeaveRequestDescription> getLRForCurrentDelManager(int id) { Dictionary <LeaveRequestInfo, LeaveRequestDescription> allRequests = EmployeeLeaveRequestViewModelsController.getAllLeaveRequests(db); Dictionary <LeaveRequestInfo, LeaveRequestDescription> delManRequests = new Dictionary <LeaveRequestInfo, LeaveRequestDescription>(); foreach (KeyValuePair <LeaveRequestInfo, LeaveRequestDescription> pair in allRequests) { if (pair.Value.DeliveryManager.EmployeeID == id && pair.Value.DeliveryManagerStatus.RequestStatusName.Equals("Pending")) { delManRequests.Add(pair.Key, pair.Value); } } return(delManRequests); }
public ActionResult ProcessRequest([Bind(Include = "leaveRequestID,departmentManagerComment,departmentManagerStatusID")] DepartmentManagerLeaveRequestViewModel departmentManagerLeaveRequestViewModel) { if (ModelState.IsValid) { LeaveRequestInfo requestToUpdate = db.LeaveRequestInfo.Find(departmentManagerLeaveRequestViewModel.LeaveRequestID); LeaveRequestDescription descToUpdate = EmployeeLeaveRequestViewModelsController.getLatestDescription(requestToUpdate, db); descToUpdate.DepartmentManagerComment = departmentManagerLeaveRequestViewModel.DepartmentManagerComment; descToUpdate.DepartmentManagerStatus = db.RequestStatus.Find(departmentManagerLeaveRequestViewModel.DepartmentManagerStatusID); db.SaveChanges(); if (!descToUpdate.DepartmentManagerStatus.RequestStatusName.Equals("Pending")) { sendMailToEmployee(requestToUpdate.Employee.EmployeeID); } return(RedirectToAction("Index")); } return(View()); }