public JsonResult GetPCMCourtOutcomeById(int Outcome_Id) { //get current username string loginName = User.Identity.Name; Session["LoginName"] = loginName; var currentUser = (User)Session["CurrentUser"]; var userProvince = -1; var userId = 0; if (currentUser != null) { userId = currentUser.User_Id; if (currentUser.Employees.Any()) { userProvince = currentUser.Employees.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id; } if (currentUser.apl_Social_Worker.Any()) { userProvince = currentUser.apl_Social_Worker.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id; } } PCMChildrensCourtModel cm = new PCMChildrensCourtModel(); PCMChildrensCourtViewModel vm = new PCMChildrensCourtViewModel(); vm.PlacementRecomendation_List = cm.GetPlacementRecomendation(); vm.Recommendation_Type_List = cm.GetRecommendationType(); vm.CourtOutcomeCaseStatusation_Type = cm.GetCourtOutcomeCaseStatusType(); ViewBag.Recommendation_Type_List = new SelectList(db.apl_Recommendation_Type.ToList(), "Recommendation_Type_Id", "Description"); ViewBag.PlacementRecomendation_List = new SelectList(db.apl_Placement_Type.ToList(), "Placement_Type_Id", "Description"); ViewBag.CourtOutcomeCaseStatusation_Type = new SelectList(db.apl_PCM_Court_Case_Status.ToList(), "Court_Case_Status_Id", "Description"); using (SDIIS_DatabaseEntities db = new SDIIS_DatabaseEntities()) { db.Configuration.LazyLoadingEnabled = false; vm = cm.GetChildrensCourtOutcometById(Outcome_Id); string value = string.Empty; value = JsonConvert.SerializeObject(vm, Formatting.Indented, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); return(Json(value, JsonRequestBehavior.AllowGet)); } }
public JsonResult GetOutcometList() { //get current username string loginName = User.Identity.Name; Session["LoginName"] = loginName; var currentUser = (User)Session["CurrentUser"]; var userProvince = -1; var userId = 0; if (currentUser != null) { userId = currentUser.User_Id; if (currentUser.Employees.Any()) { userProvince = currentUser.Employees.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id; } if (currentUser.apl_Social_Worker.Any()) { userProvince = currentUser.apl_Social_Worker.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id; } } int assID = Convert.ToInt32(Session["IntakeassId"]); PCMChildrensCourtModel cm = new PCMChildrensCourtModel(); PCMChildrensCourtViewModel vm = new PCMChildrensCourtViewModel(); vm.PlacementRecomendation_List = cm.GetPlacementRecomendation(); vm.Recommendation_Type_List = cm.GetRecommendationType(); vm.CourtOutcomeCaseStatusation_Type = cm.GetCourtOutcomeCaseStatusType(); ViewBag.Recommendation_Type_List = new SelectList(db.apl_Recommendation_Type.ToList(), "Recommendation_Type_Id", "Description"); ViewBag.PlacementRecomendation_List = new SelectList(db.apl_Placement_Type.ToList(), "Placement_Type_Id", "Description"); ViewBag.CourtOutcomeCaseStatusation_Type = new SelectList(db.apl_PCM_Court_Case_Status.ToList(), "Court_Case_Status_Id", "Description"); return(Json(cm.GetOutcometList(assID), JsonRequestBehavior.AllowGet)); }
public ActionResult Index(int id) { //get current username string loginName = User.Identity.Name; Session["LoginName"] = loginName; var currentUser = (User)Session["CurrentUser"]; var userProvince = -1; var userId = 0; if (currentUser != null) { userId = currentUser.User_Id; if (currentUser.Employees.Any()) { userProvince = currentUser.Employees.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id; } if (currentUser.apl_Social_Worker.Any()) { userProvince = currentUser.apl_Social_Worker.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id; } } bool IdExist = db.PCM_Childrens_Court.Any(x => x.Intake_Assessment_Id == id); if (IdExist) { PCMChildrensCourtModel cm = new PCMChildrensCourtModel(); PCMChildrensCourtViewModel vm = new PCMChildrensCourtViewModel(); vm.PlacementRecomendation_List = cm.GetPlacementRecomendation(); vm.Recommendation_Type_List = cm.GetRecommendationType(); vm.CourtOutcomeCaseStatusation_Type = cm.GetCourtOutcomeCaseStatusType(); ViewBag.Recommendation_Type_List = new SelectList(db.apl_Recommendation_Type.ToList(), "Recommendation_Type_Id", "Description"); ViewBag.PlacementRecomendation_List = new SelectList(db.apl_Placement_Type.ToList(), "Placement_Type_Id", "Description"); ViewBag.CourtOutcomeCaseStatusation_Type = new SelectList(db.apl_PCM_Court_Case_Status.ToList(), "Court_Case_Status_Id", "Description"); List <PCMChildrensCourtViewModel> vm1 = new List <PCMChildrensCourtViewModel>(); vm1 = cm.GetPCMChildrensOutcometList(); } else { PCMChildrensCourtModel cm = new PCMChildrensCourtModel(); PCMChildrensCourtViewModel vm = new PCMChildrensCourtViewModel(); vm.PlacementRecomendation_List = cm.GetPlacementRecomendation(); vm.Recommendation_Type_List = cm.GetRecommendationType(); vm.CourtOutcomeCaseStatusation_Type = cm.GetCourtOutcomeCaseStatusType(); ViewBag.Recommendation_Type_List = new SelectList(db.apl_Recommendation_Type.ToList(), "Recommendation_Type_Id", "Description"); ViewBag.PlacementRecomendation_List = new SelectList(db.apl_Placement_Type.ToList(), "Placement_Type_Id", "Description"); ViewBag.CourtOutcomeCaseStatusation_Type = new SelectList(db.apl_PCM_Court_Case_Status.ToList(), "Court_Case_Status_Id", "Description"); Response.Write("Does not Exist"); } int?Placementid = cm.GetPlacementId(id); int?Recomendationid = cm.GetRecomendationId(id); ViewBag.MessagePlacement = Placementid; Session["Placementid"] = Placementid; Session["Rec1"] = Recomendationid; Session["Idc1"] = id; Session["IntakeassId"] = id; return(PartialView(vm)); }