コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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());
        }