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 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()); }