// // GET: /Home/ public ActionResult Index(int ID = 0) { List <UserObservationVM> lUserOb = new List <UserObservationVM>(); CLOBEntities clob = new CLOBEntities(); string sID = ID.ToString(); if (Session["UserID"] != null) { sID = Session["UserID"].ToString(); } var obs = from o in clob.CLOB_ObservationBackground where o.UserID == sID select new UserObservationVM { ObservationID = o.ObservationID, ObservationDate = o.ObservationDate }; foreach (UserObservationVM u in obs) { lUserOb.Add(u); } return(View(lUserOb)); }
public void UpdateBackgroundInformation(BackgroundInformationVM biVM) { CLOBEntities clob = new CLOBEntities(); int ObservID = 0; if (HttpContext.Current.Session["ObservationID"] != null) { ObservID = (int)HttpContext.Current.Session["ObservationID"]; } if (ObservID == 0) { CLOB_ObservationBackground ob = new CLOB_ObservationBackground { UserID = HttpContext.Current.Session["UserID"].ToString(), ObservationDate = DateTime.Now, ClassEndTime = biVM.ClassEndTime, ClassStartTime = biVM.ClassStartTime, StartingNumberOfMales = biVM.StartingNumberOfMales, StartingNumberOfFemales = biVM.StartingNumberOfFemales, EndingNumberOfMales = biVM.EndingNumberOfMales, EndingNumberOfFemales = biVM.EndingNumberOfFemales, ObtainedArtifactsCopy = biVM.ObtainedArtifactsCopy, UseInstructionalArtifacts = biVM.UseInstructionalArtifacts, Notes = biVM.Notes }; clob.CLOB_ObservationBackground.Add(ob); clob.SaveChanges(); HttpContext.Current.Session["ObservationID"] = ob.ObservationID; HttpContext.Current.Session.Remove("NewObservation"); } else { var result = clob.CLOB_ObservationBackground.Where(ob => ob.ObservationID == biVM.ObservationID).FirstOrDefault(); result.ObservationDate = Convert.ToDateTime(biVM.ObservationDateShort); result.ClassEndTime = biVM.ClassEndTime; result.ClassStartTime = biVM.ClassStartTime; result.StartingNumberOfMales = biVM.StartingNumberOfMales; result.StartingNumberOfFemales = biVM.StartingNumberOfFemales; result.EndingNumberOfMales = biVM.EndingNumberOfMales; result.EndingNumberOfFemales = biVM.EndingNumberOfFemales; result.ObtainedArtifactsCopy = biVM.ObtainedArtifactsCopy.ToString(); result.UseInstructionalArtifacts = biVM.UseInstructionalArtifacts.ToString(); result.Notes = biVM.Notes; clob.SaveChanges(); } }
public void UpdatePostObservation(FormCollection collection) { int ObservID = 0; string sPOQType = collection["POQType"].ToString(); if (HttpContext.Current.Session["ObservationID"] != null) { ObservID = (int)HttpContext.Current.Session["ObservationID"]; } CLOBEntities clob = new CLOBEntities(); // rather than update eeach row record, delete and rewrite var del = from c in clob.CLOB_ObservationsAnswers where c.ObservationID == ObservID && c.POQType == sPOQType select c; foreach (var a in del) { clob.CLOB_ObservationsAnswers.Remove(a); } clob.SaveChanges(); foreach (var key in collection.AllKeys) { if (key.StartsWith("a")) { int iID = Convert.ToInt32(key.Replace("a", "")); CLOB_ObservationsAnswers oa = new CLOB_ObservationsAnswers(); if (collection[key] == "true,false") { oa.Answer = "true"; } else { oa.Answer = collection[key].ToString(); } oa.POQID = iID; oa.POQType = sPOQType; oa.ObservationID = ObservID; clob.CLOB_ObservationsAnswers.Add(oa); clob.SaveChanges(); } } }
// Observation Information public ObservationInformationVM GetObservationInformation() { int ObservID = 0; if (HttpContext.Current.Session["ObservationID"] != null) { ObservID = (int)HttpContext.Current.Session["ObservationID"]; } ObservationInformationVM odVM = new ObservationInformationVM(); CLOBEntities clob = new CLOBEntities(); var obs = from o in clob.CLOB_ObservationInformation where o.ObservationID == ObservID select o; if (obs.Count() > 0) { odVM.AcknowledgeCount = (int)obs.First().AcknowledgeCount; odVM.ApplyCount = (int)obs.First().ApplyCount; odVM.CorrectCount = (int)obs.First().CorrectCount; odVM.DirectionsCount = (int)obs.First().DirectionsCount; odVM.ExplainCount = (int)obs.First().ExplainCount; odVM.FactsCount = (int)obs.First().FactsCount; odVM.ForeshadowCount = (int)obs.First().ForeshadowCount; odVM.GiveInfoCount = (int)obs.First().GiveInfoCount; odVM.ItineraryCount = (int)obs.First().ItineraryCount; odVM.MetaCount = (int)obs.First().MetaCount; odVM.NewAndOldCount = (int)obs.First().NewAndOldCount; odVM.Notes = obs.First().Notes; odVM.PraiseCount = (int)obs.First().PraiseCount; odVM.ProceduralCount = (int)obs.First().ProceduralCount; odVM.ReflectCount = (int)obs.First().ReflectCount; odVM.RephraseCount = (int)obs.First().RephraseCount; odVM.SituateCount = (int)obs.First().SituateCount; odVM.SolicitCount = (int)obs.First().SolicitCount; odVM.SuggestCount = (int)obs.First().SuggestCount; odVM.SummarizeCount = (int)obs.First().SummarizeCount; odVM.ThinkAloudCount = (int)obs.First().ThinkAloudCount; odVM.ObservationInformationID = (int)obs.First().ObservationInformationID; odVM.StudentDisengagementCode = obs.First().StudentDisengagementCode; odVM.ClassOrganizationCode = obs.First().ClassOrganizationCode; odVM.ClassActivityCode = obs.First().ClassActivityCode; } odVM.BuildCodeLists(); return(odVM); }
// Post Observation Questions public List <PostObservationVM> BuildPostObservationVM(string POType) { int ObservID = 0; if (HttpContext.Current.Session["ObservationID"] != null) { ObservID = (int)HttpContext.Current.Session["ObservationID"]; } List <PostObservationVM> lPostObservations = new List <PostObservationVM>(); CLOBEntities clob = new CLOBEntities(); var po = from q in clob.CLOB_PostObservationQuestions where q.POQType == POType join a in clob.CLOB_ObservationsAnswers on q.POQID equals a.POQID into AnswerGroup select new { q.POQID, q.SubSection, q.QuestionText, q.QuestionType, Answer = (from a in AnswerGroup where a.ObservationID == ObservID select a.Answer).FirstOrDefault() }; //var po = from a in clob.CLOB_ObservationsAnswers // where a.ObservationID == ObservID // join q in clob.CLOB_PostObservationQuestions // on a.POQID equals q.POQID // select new { q.POQID, q.SubSection, q.QuestionText, q.QuestionType, a.Answer }; foreach (var q in po) { lPostObservations.Add(new PostObservationVM { POQID = q.POQID, QuestionText = q.QuestionText, SubSection = q.SubSection, QuestionType = q.QuestionType, Answer = q.Answer }); } return(lPostObservations); }
// Background Information public BackgroundInformationVM GetBackgrounfInformation(int ID = 0) { int ObservID = 0; if (HttpContext.Current.Session["NewObservation"] == null) { if (ID != 0) { HttpContext.Current.Session["ObservationID"] = ID; ObservID = ID; } else { ObservID = (int)HttpContext.Current.Session["ObservationID"]; } CLOBEntities clob = new CLOBEntities(); var oi = (from o in clob.CLOB_ObservationBackground where o.ObservationID == ObservID select new BackgroundInformationVM { ClassEndTime = o.ClassEndTime, ClassID = o.ClassID, ClassStartTime = o.ClassStartTime, EndingNumberOfFemales = o.EndingNumberOfFemales, EndingNumberOfMales = o.EndingNumberOfMales, Notes = o.Notes, ObservationDate = o.ObservationDate, ObservationID = o.ObservationID, ObtainedArtifactsCopy = o.ObtainedArtifactsCopy, StartingNumberOfFemales = o.StartingNumberOfFemales, StartingNumberOfMales = o.StartingNumberOfMales, UseInstructionalArtifacts = o.UseInstructionalArtifacts }).FirstOrDefault(); return(oi); } return(new BackgroundInformationVM()); }
public JsonResult Chart1() { CLOBEntities clob = new CLOBEntities(); var z = (from c in clob.GetObservationInfoCounts() select new { c.AcknowledgeCount, c.ApplyCount, c.CorrectCount, c.DirectionsCount, c.ExplainCount, c.FactsCount, c.ForeshadowCount, c.GiveInfoCount, c.ItineraryCount, c.MetaCount, c.NewAndOldCount, c.PraiseCount, c.ProceduralCount, c.ReflectCount, c.RephraseCount, c.SituateCount, c.SolicitCount, c.SuggestCount, c.SummarizeCount, c.ThinkAloudCount }).FirstOrDefault(); if (z != null) { List <HCFormat> hcf = new List <HCFormat>(); HCFormatInt hcfi = new HCFormatInt(); hcfi.name = "Counts"; hcfi.data = new List <int>(); hcfi.data.Add((int)z.AcknowledgeCount); hcfi.data.Add((int)z.ApplyCount); hcfi.data.Add((int)z.CorrectCount); hcfi.data.Add((int)z.DirectionsCount); hcfi.data.Add((int)z.ExplainCount); hcfi.data.Add((int)z.FactsCount); hcfi.data.Add((int)z.ForeshadowCount); hcfi.data.Add((int)z.GiveInfoCount); hcfi.data.Add((int)z.ItineraryCount); hcfi.data.Add((int)z.MetaCount); hcfi.data.Add((int)z.NewAndOldCount); hcfi.data.Add((int)z.PraiseCount); hcfi.data.Add((int)z.ProceduralCount); hcfi.data.Add((int)z.ReflectCount); hcfi.data.Add((int)z.RephraseCount); hcfi.data.Add((int)z.SituateCount); hcfi.data.Add((int)z.SolicitCount); hcfi.data.Add((int)z.SuggestCount); hcfi.data.Add((int)z.SummarizeCount); hcfi.data.Add((int)z.ThinkAloudCount); hcf.Add(hcfi); HCFormatString hcfs = new HCFormatString(); hcfs.name = "CountNames"; hcfs.data = new List <string>(); hcfs.data.Add("Acknowledge"); hcfs.data.Add("Apply"); hcfs.data.Add("Correct"); hcfs.data.Add("Directions"); hcfs.data.Add("Explain"); hcfs.data.Add("Facts"); hcfs.data.Add("Foreshadow"); hcfs.data.Add("GiveInfo"); hcfs.data.Add("Itinerary"); hcfs.data.Add("Meta"); hcfs.data.Add("NewAndOld"); hcfs.data.Add("Praise"); hcfs.data.Add("Procedural"); hcfs.data.Add("Reflect"); hcfs.data.Add("Rephrase"); hcfs.data.Add("Situate"); hcfs.data.Add("Solicit"); hcfs.data.Add("Suggest"); hcfs.data.Add("Summarize"); hcfs.data.Add("ThinkAloud"); hcf.Add(hcfs); //List<int> lCoords = new List<int>() { 2,4,5,6,8}; return(Json(hcf, JsonRequestBehavior.AllowGet)); } else { List <HCFormat> hcf = new List <HCFormat>(); HCFormatInt hcfi = new HCFormatInt(); hcfi.name = "Counts"; hcfi.data = new List <int>(); hcfi.data.Add(3); hcf.Add(hcfi); HCFormatString hcfs = new HCFormatString(); hcfs.name = "CountNames"; hcfs.data = new List <string>(); hcfs.data.Add("None"); hcf.Add(hcfs); //List<int> lCoords = new List<int>() { 2,4,5,6,8}; return(Json(hcf, JsonRequestBehavior.AllowGet)); } }
public void UpdateObservationInformation(ObservationInformationVM oiVM) { int ObservID = 0; if (HttpContext.Current.Session["ObservationID"] != null) { ObservID = (int)HttpContext.Current.Session["ObservationID"]; } CLOBEntities clob = new CLOBEntities(); if (oiVM.ObservationInformationID == 0) { CLOB_ObservationInformation oi = new CLOB_ObservationInformation { ObservationID = ObservID, UserID = HttpContext.Current.Session["UserID"].ToString(), AcknowledgeCount = oiVM.AcknowledgeCount, ApplyCount = oiVM.ApplyCount, ClassActivityCode = oiVM.ClassActivityCode, ClassOrganizationCode = oiVM.ClassOrganizationCode, CorrectCount = oiVM.CorrectCount, DateAdded = DateTime.Now, DirectionsCount = oiVM.DirectionsCount, ExplainCount = oiVM.ExplainCount, FactsCount = oiVM.FactsCount, ForeshadowCount = oiVM.ForeshadowCount, GiveInfoCount = oiVM.GiveInfoCount, ItineraryCount = oiVM.ItineraryCount, MetaCount = oiVM.MetaCount, NewAndOldCount = oiVM.NewAndOldCount, Notes = oiVM.Notes, PraiseCount = oiVM.PraiseCount, ProceduralCount = oiVM.ProceduralCount, ReflectCount = oiVM.ReflectCount, RephraseCount = oiVM.RephraseCount, SituateCount = oiVM.SituateCount, SolicitCount = oiVM.SolicitCount, StudentDisengagementCode = oiVM.StudentDisengagementCode, SuggestCount = oiVM.SuggestCount, SummarizeCount = oiVM.SummarizeCount, ThinkAloudCount = oiVM.ThinkAloudCount }; clob.CLOB_ObservationInformation.Add(oi); clob.SaveChanges(); } else { var result = clob.CLOB_ObservationInformation.Where(ob => ob.ObservationInformationID == oiVM.ObservationInformationID).FirstOrDefault(); result.AcknowledgeCount = oiVM.AcknowledgeCount; result.ApplyCount = oiVM.ApplyCount; result.ClassActivityCode = oiVM.ClassActivityCode; result.ClassOrganizationCode = oiVM.ClassOrganizationCode; result.CorrectCount = oiVM.CorrectCount; result.DateAdded = DateTime.Now; result.DirectionsCount = oiVM.DirectionsCount; result.ExplainCount = oiVM.ExplainCount; result.FactsCount = oiVM.FactsCount; result.ForeshadowCount = oiVM.ForeshadowCount; result.GiveInfoCount = oiVM.GiveInfoCount; result.ItineraryCount = oiVM.ItineraryCount; result.MetaCount = oiVM.MetaCount; result.NewAndOldCount = oiVM.NewAndOldCount; result.Notes = oiVM.Notes; result.PraiseCount = oiVM.PraiseCount; result.ProceduralCount = oiVM.ProceduralCount; result.ReflectCount = oiVM.ReflectCount; result.RephraseCount = oiVM.RephraseCount; result.SituateCount = oiVM.SituateCount; result.SolicitCount = oiVM.SolicitCount; result.StudentDisengagementCode = oiVM.StudentDisengagementCode; result.SuggestCount = oiVM.SuggestCount; result.SummarizeCount = oiVM.SummarizeCount; result.ThinkAloudCount = oiVM.ThinkAloudCount; clob.SaveChanges(); } }