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));
        }
Example #2
0
        public DepartmentViewModel departmentDetails()
        {
            string userId = User.Identity.GetUserId();
            Staff  s1     = StaffDepartmentDAO.GetStaffByUserId(userId);

            if (s1 == null)
            {
                return(null);
            }
            Department dep = DepartmentDAO.GetDepartmentByUserId(userId);

            return(StaffDepartmentDAO.ConvertDepartmentToDepartmentViewModel(dep));
        }