public ActionResult CollectionPoint()
        {
            List <CollectionPoint> collectionPoints = new List <CollectionPoint>();

            collectionPoints             = collectionPointDAO.GetCollectionPoints(); //Getting all 6 collection point locations
            ViewData["collectionPoints"] = collectionPoints;

            deptId = GetDeptId();// departmentID of current logined DepartmentHead

            List <Employee> employees = new List <Employee>();

            employees = employeeDAO.GetEmployeeByDeptId(deptId);
            List <SelectListItem> Employees = new List <SelectListItem>();

            foreach (var emp in employees)
            {
                Employees.Add(new SelectListItem {
                    Value = emp.Name, Text = emp.Name
                });
            }
            ViewData["employees"] = Employees;

            Department department = departmentDAO.GetDepartmentByDeptId(deptId);

            int CollectionPoint = department.CollectionPoinId;

            string repName             = employeeDAO.GetEmployeeById(department.RepId).Name;
            string collectionPointName = collectionPointDAO.GetCollectionPointById(department.CollectionPoinId).Name;

            ViewData["representativeName"] = repName;
            ViewData["collectionPoint"]    = collectionPointName;

            return(View());
        }
        public ActionResult ChangeCollectionPoint()
        {
            string id    = User.Identity.GetUserId();
            var    staff = StaffDepartmentDAO.GetStaffByUserId(id);

            Department          dep     = staff.Department;
            DepartmentViewModel depView = StaffDepartmentDAO.ConvertDepartmentToDepartmentViewModel(dep);

            // Set CollectionPoint viewbag here!
            ViewBag.CollectionPoint = CollectionPointDAO.GetCollectionPoints();

            if (User.IsInRole("DH") || User.IsInRole("Temp DH"))
            {
                // get DR candidate list
                List <Staff> possibleList = StaffDepartmentDAO.FindPossibleDRList(staff);
                possibleList = possibleList == null ? new List <Staff>() : possibleList;
                Staff currentDR = StaffDepartmentDAO.FindDepartmentRole(staff.departmentId, "DR");

                // Set StaffList viewbag here!
                ViewBag.StaffList = new SelectList(
                    possibleList,
                    "staffId",
                    "staffName",
                    currentDR == null ? -1 : currentDR.staffId);
            }
            return(View(depView));
        }
Esempio n. 3
0
        public MResponse GetCollectionPoints()
        {
            CollectionPointDAO dao = new CollectionPointDAO();
            MResponseList <CollectionPoint> response = new MResponseList <CollectionPoint>()
            {
                ResList = dao.GetCollectionPoints(),
                Success = true
            };

            return(response);
        }
        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());
        }
Esempio n. 5
0
        public List <CollectionPointViewModel> ListAllCollectionPoints()
        {
            var result = CollectionPointDAO.GetCollectionPoints();

            return(result);
        }