public HttpResponse GetCareerRatings(string user) { JavaScriptSerializer jss = new JavaScriptSerializer(); StudentAccountClient sac = new StudentAccountClient(); StudentAccount student = sac.GetByPartitionAndRowKey(StudentAccountClient.GetPartitionKeyForEmail(user), user); AssessmentCareerClient acc = new AssessmentCareerClient(); List <AssessmentCareer> careerRatings = new List <AssessmentCareer>(acc.GetAllCurrentByStudent(student.School, user, student.Year, student.Grade)); //StudentProfileClient spc = new StudentProfileClient(); //StudentProfile student = spc.GetByPartitionAndRowKey(StudentProfileClient.GetPartitionKeyForEmail(user), user); //AssessmentCareerRatingClient acrc = new AssessmentCareerRatingClient(); //List<AssessmentCareerRating> careerRatings = new List<AssessmentCareerRating>(acrc.GetAllBySchoolAndStudent(student.School, user)); List <CareerRating> results = new List <CareerRating>(); string response; if (careerRatings.Count != 0) { foreach (AssessmentCareer careerRating in careerRatings) { results.Add(new CareerRating { dolcode = careerRating.DolCode, rating = careerRating.Value }); } response = "{\"result\": \"ok\", \"results\":" + jss.Serialize(results) + "}"; } else { response = "{\"result\": \"ok\", \"results\":[]}"; } Response.ContentType = "application/json"; Response.Write(response); Response.End(); return(null); }
public ActionResult Index() { string user = AuthTokens[1]; StudentAccountClient sac = new StudentAccountClient(); StudentAccount student = sac.GetByPartitionAndRowKey(StudentAccountClient.GetPartitionKeyForEmail(user), user); AssessmentInterestClient aic = new AssessmentInterestClient(); List <AssessmentInterest> importantThingRatings = new List <AssessmentInterest>(aic.GetAllCurrentByStudent(student.School, user, student.Year, student.Grade)); AssessmentCareerClient acc = new AssessmentCareerClient(); List <AssessmentCareer> careerRatings = new List <AssessmentCareer>(acc.GetAllCurrentByStudent(student.School, user, student.Year, student.Grade)); //StudentProfileClient spc = new StudentProfileClient(); //StudentProfile student = spc.GetByPartitionAndRowKey(StudentProfileClient.GetPartitionKeyForEmail(user), user); //AssessmentInterestRatingClient airc = new AssessmentInterestRatingClient(); //List<AssessmentInterestRating> importantThingRatings = new List<AssessmentInterestRating>(airc.GetAllBySchoolAndStudent(student.School, user)); //AssessmentCareerRatingClient acrc = new AssessmentCareerRatingClient(); //List<AssessmentCareerRating> careerRatings = new List<AssessmentCareerRating>(acrc.GetAllBySchoolAndStudent(student.School, user)); ViewBag.CareersRated = careerRatings.Count == 0 ? "no" : "yes"; ViewBag.School = student.School; JavaScriptSerializer jss = new JavaScriptSerializer(); ViewBag.interestsRated = jss.Serialize(importantThingRatings.Where(x => x.Value == "1").Select(x => x.Interest).ToList()); if (importantThingRatings.Where(x => x.Value == "1").ToList().Count == 3) { ViewBag.ImportantThings = "yes"; } else { ViewBag.ImportantThings = "no"; } if (TempData["message"] != null) { ViewBag.Message = TempData["message"]; } if (TempData["successmessage"] != null) { ViewBag.Successmessage = TempData["successmessage"]; } ViewBag.UpdateAccessCode = student.Year != AccessCodeClient.CurrentGradYear(); return(View()); }