public PartialViewResult ShowRightContent(CYCARoleType type) { var currentUser = (User)Session["CurrentUser"]; var userId = -1; if (currentUser != null) { userId = currentUser.User_Id; } object viewModel; switch (type) { case CYCARoleType.FacilityManager: CYCA_CenterManagerRightViewModel returnModel = new CYCA_CenterManagerRightViewModel(); //returnModel = GetTeamLeadersAndChildren(); //returnModel = GetCenterManagerRightView(); returnModel = GetCenterManagerRightViewUpdated(); viewModel = returnModel; return(PartialView("~/Views/Home/_CenterManagerRight.cshtml", viewModel)); case CYCARoleType.TeamLeader: CYCA_TeamLeaderRightViewModel returnModelTeamLeader = new CYCA_TeamLeaderRightViewModel(); returnModelTeamLeader = GetCareWorkersAndChildren();; viewModel = returnModelTeamLeader; return(PartialView("~/Views/Home/_TeamLeaderRight.cshtml", viewModel)); case CYCARoleType.ProvincialCoordinator: CYCABedSpaceRequestViewModel returnModelProv = new CYCABedSpaceRequestViewModel(); var StatList = bedSpaceModel.GetBedStats(); ViewBag.RequestStatusList = new SelectList(StatList, "Request_Status_Id", "Description"); var request_Outcomes = bedSpaceModel.GetBedSpaceRequestOutcome(); ViewBag.RequestOutcomeList = new SelectList(request_Outcomes, "Outcome_Id", "Description"); return(PartialView("~/Views/Home/_ProvincialCoordinatorRight.cshtml")); case CYCARoleType.CareWorker: default: var venue_list = venues.GetAplCycaVenues(); ViewBag.VenueList = new SelectList(venue_list, "Venue_Id", "VenueName"); var userList = userModel.GetUserListById(userId); ViewBag.UsersList = new SelectList(userList, "User_Id", "fullname"); return(PartialView("~/Views/Home/_CareWorkerRight.cshtml")); } }
public CYCA_TeamLeaderRightViewModel GetCareWorkersAndChildren() { var currentUser = (User)Session["CurrentUser"]; var userId = -1; if (currentUser != null) { userId = currentUser.User_Id; } var facilityID = employee.GetFacilityIdByUserID(userId); CYCA_TeamLeaderRightViewModel returnModel = new CYCA_TeamLeaderRightViewModel(); returnModel.CareWorkers = new List <CareWorker>(); var loggedInEmployee = employee.GetLoggedInEmployee(userId); var workers = careworker.GetCareWorkers(facilityID, loggedInEmployee.Employee_Id); List <CareWorker> careList = new List <CareWorker>(); foreach (User u in workers) { var worker = new CareWorker(); worker.FacilityId = facilityID; worker.Name = u.First_Name + " " + u.Last_Name; worker.Desciption = "Care Worker"; worker.Summary = "Summary"; worker.UserId = u.User_Id; careList.Add(worker); } returnModel.CareWorkers.AddRange(careList); foreach (CareWorker t in returnModel.CareWorkers) { t.children = new List <CYCAChildAllocationViewModel>(); t.children.AddRange(children.getCareWorkerChildren(facilityID, currentUser, t.UserId)); } return(returnModel); }