コード例 #1
0
        public Dictionary <string, object> GetAllRepresentativesOfDepartment()
        {
            Dictionary <string, object> repDict = new Dictionary <string, object>();

            Employee user = AuthUtil.GetCurrentLoggedUser();

            if (user == null)
            {
                repDict.Add("repList", new List <Employee>());
                repDict.Add("curRep", new Employee());
            }
            else
            {
                long            currentRepId = DepartmentService.GetCurrentRep(user.DeptId);
                List <Employee> employees    = RepresentativeService.GetEmployeesByDepartment(user.DeptId);
                Employee        emp          = employees.Find(e => e.EmpId == currentRepId);
                if (emp == null)
                {
                    emp = DepartmentDAO.GetCurrentRepInfoById(user.DeptId);
                }

                repDict.Add("repList", employees);
                repDict.Add("curRep", emp);
            }

            return(repDict);
        }
コード例 #2
0
        public string ChangeRepresentativeOfDepartement(long repId)
        {
            Employee user = AuthUtil.GetCurrentLoggedUser();

            if (user == null)
            {
                return("Failed");
            }

            long deptId              = user.DeptId;
            long currentRep          = DepartmentService.GetCurrentRep(deptId);
            bool all                 = DelegateService.CheckPreviousHeadForNav(deptId);
            long newRep              = repId;
            EmailNotification notice = new EmailNotification();

            RepresentativeService.UpdateEmployeeRole(newRep, currentRep, deptId);
            Employee newRepMailReceiver = EmployeeService.GetEmployeeById(newRep);
            Employee oldRepMailReceiver = EmployeeService.GetEmployeeById(currentRep);

            Task.Run(() => {
                notice.ReceiverMailAddress = newRepMailReceiver.Email;
                emailService.SendMail(notice, EmailTrigger.ON_ASSIGNED_AS_DEPT_REP);
                notice.ReceiverMailAddress = oldRepMailReceiver.Email;
                emailService.SendMail(notice, EmailTrigger.ON_REMOVED_DEPT_REP);
            });

            return("Success");
        }
コード例 #3
0
        public Dictionary <string, List <Employee> > GetAllEmployeesOfDepartment()
        {
            Dictionary <string, List <Employee> > repDict = new Dictionary <string, List <Employee> >();

            Employee user = AuthUtil.GetCurrentLoggedUser();

            if (user == null)
            {
                repDict.Add("repList", new List <Employee>());
            }
            else
            {
                List <Employee> employees = RepresentativeService.GetEmployeesByDepartment(user.DeptId);
                repDict.Add("repList", employees);
            }

            return(repDict);
        }