public int AddCurriculumAssignment(CurriculumAssignment curriculumAssignment) { curriculumAssignment.IsDeleted = false; curriculumAssignment.IsValid = true; _Db.CurriculumAssignments.InsertOnSubmit(curriculumAssignment); _Db.SubmitChanges(); //add corresponding ThemeAssignments var themesInCurrentCurriculum = GetThemesByCurriculumId(curriculumAssignment.CurriculumRef) .Where(item => item.ThemeTypeRef == (int)Enums.ThemeType.Test); foreach (var theme in themesInCurrentCurriculum) { ThemeAssignment newThemeAssingment = new ThemeAssignment() { CurriculumAssignmentRef = curriculumAssignment.Id, ThemeRef = theme.Id, MaxScore = Constants.DefaultThemeMaxScore }; AddThemeAssignment(newThemeAssingment); } return(curriculumAssignment.Id); }
public int AddCurriculumAssignment(CurriculumAssignment curriculumAssignment) { using (var db = new CurriculumManagementDBContext()) { curriculumAssignment.IsDeleted = false; db.CurriculumAssignments.Add(curriculumAssignment); db.SaveChanges(); } //add corresponding ThemeAssignments var themesInCurrentCurriculum = GetThemesByCurriculumId(curriculumAssignment.CurriculumRef) .Where(item => item.ThemeTypeRef == (int)IUDICO.CurriculumManagement.Models.Enums.ThemeType.Test); foreach (var theme in themesInCurrentCurriculum) { ThemeAssignment newThemeAssingment = new ThemeAssignment() { CurriculumAssignmentRef = curriculumAssignment.Id, ThemeRef = theme.Id, MaxScore = Constants.DefaultThemeMaxScore }; AddThemeAssignment(newThemeAssingment); } return(curriculumAssignment.Id); }
public int AddThemeAssignment(ThemeAssignment themeAssignment) { _Db.ThemeAssignments.InsertOnSubmit(themeAssignment); _Db.SubmitChanges(); return(themeAssignment.Id); }
public void UpdateThemeAssignment(ThemeAssignment themeAssignment) { var oldThemeAssignment = GetThemeAssignment(themeAssignment.Id); oldThemeAssignment.MaxScore = themeAssignment.MaxScore; _Db.SubmitChanges(); }
public static void AreEqual(ThemeAssignment actual, ThemeAssignment expected) { Assert.AreEqual(expected.ThemeRef, actual.ThemeRef); Assert.AreEqual(expected.Id, actual.Id); Assert.AreEqual(expected.IsDeleted, actual.IsDeleted); Assert.AreEqual(expected.CurriculumAssignmentRef, actual.CurriculumAssignmentRef); Assert.AreEqual(expected.MaxScore, actual.MaxScore); }
public void UpdateThemeAssignment(ThemeAssignment themeAssignment) { var db = GetDbContext(); var oldThemeAssignment = GetThemeAssignment(db, themeAssignment.Id); oldThemeAssignment.MaxScore = themeAssignment.MaxScore; db.SubmitChanges(); }
public int AddThemeAssignment(ThemeAssignment themeAssignment) { var db = GetDbContext(); db.ThemeAssignments.InsertOnSubmit(themeAssignment); db.SubmitChanges(); return(themeAssignment.Id); }
public int AddThemeAssignment(ThemeAssignment themeAssignment) { using (var db = new CurriculumManagementDBContext()) { db.ThemeAssignments.Add(themeAssignment); db.SaveChanges(); } return(themeAssignment.Id); }
public void UpdateThemeAssignment(ThemeAssignment themeAssignment) { using (var db = new CurriculumManagementDBContext()) { db.ThemeAssignments.Attach(themeAssignment); themeAssignment.MaxScore = themeAssignment.MaxScore; db.SaveChanges(); } }
/// <summary> /// Adds theme assignments for theme. /// </summary> /// <param name="theme">The theme.</param> private void AddThemeAssignments(Theme theme) { var curriculumAssignments = GetCurriculumAssignmnetsByCurriculumId(theme.Stage.CurriculumRef); foreach (CurriculumAssignment curriculumAssignment in curriculumAssignments) { ThemeAssignment newThemeAssignment = new ThemeAssignment() { CurriculumAssignmentRef = curriculumAssignment.Id, ThemeRef = theme.Id, MaxScore = Constants.DefaultThemeMaxScore }; AddThemeAssignment(newThemeAssignment); } }
public static void AreEqual(IList <ThemeAssignment> expected, IList <ThemeAssignment> actual) { Assert.AreEqual(expected.Count, actual.Count); foreach (ThemeAssignment expectedItem in expected) { ThemeAssignment actualItem = actual.SingleOrDefault(item => item.Id == expectedItem.Id); if (actualItem != null) { AreEqual(expectedItem, actualItem); } else { Assert.Fail(String.Format("Item with id={0} doesn't exist in actual collection, but expected in expected collection", expectedItem.Id)); } } }
public ActionResult Edit(int themeAssignmentId, ThemeAssignment themeAssignment) { try { if (ModelState.IsValid) { themeAssignment.Id = themeAssignmentId; Storage.UpdateThemeAssignment(themeAssignment); return(RedirectToRoute("ThemeAssignments", new { action = "Index", CurriculumAssignmentId = Session["CurriculumAssignmentId"] })); } else { return(RedirectToAction("Edit")); } } catch (Exception e) { throw e; } }
public ActionResult Edit(int themeAssignmentId, ThemeAssignment themeAssignment) { try { if (ModelState.IsValid) { themeAssignment.Id = themeAssignmentId; Storage.UpdateThemeAssignment(themeAssignment); return RedirectToRoute("ThemeAssignments", new { action = "Index", CurriculumAssignmentId = Session["CurriculumAssignmentId"] }); } else { return RedirectToAction("Edit"); } } catch (Exception e) { throw e; } }
public ActionResult Edit(int themeAssignmentId) { try { ThemeAssignment themeAssignment = Storage.GetThemeAssignment(themeAssignmentId); CurriculumAssignment curriculumAssignment = Storage.GetCurriculumAssignment(themeAssignment.CurriculumAssignmentRef); Curriculum curriculum = Storage.GetCurriculum(curriculumAssignment.CurriculumRef); Theme theme = Storage.GetTheme(themeAssignment.ThemeRef); Group group = Storage.GetGroup(curriculumAssignment.UserGroupRef); Session["CurriculumAssignmentId"] = themeAssignment.CurriculumAssignmentRef; ViewData["GroupName"] = group.Name; ViewData["CurriculumName"] = curriculum.Name; ViewData["StageName"] = theme.Name; return(View(themeAssignment)); } catch (Exception e) { throw e; } }
public int AddCurriculumAssignment(CurriculumAssignment curriculumAssignment) { var db = GetDbContext(); curriculumAssignment.IsDeleted = false; curriculumAssignment.IsValid = true; db.CurriculumAssignments.InsertOnSubmit(curriculumAssignment); db.SubmitChanges(); //add corresponding ThemeAssignments var themesInCurrentCurriculum = GetThemesByCurriculumId(curriculumAssignment.CurriculumRef) .Where(item => item.ThemeTypeRef == (int)Enums.ThemeType.Test || item.ThemeTypeRef == (int)Enums.ThemeType.TestWithoutCourse); foreach (var theme in themesInCurrentCurriculum) { ThemeAssignment newThemeAssingment = new ThemeAssignment() { CurriculumAssignmentRef = curriculumAssignment.Id, ThemeRef = theme.Id, MaxScore = Constants.DefaultThemeMaxScore }; AddThemeAssignment(newThemeAssingment); } return curriculumAssignment.Id; }
public int AddThemeAssignment(ThemeAssignment themeAssignment) { _Db.ThemeAssignments.InsertOnSubmit(themeAssignment); _Db.SubmitChanges(); return themeAssignment.Id; }
public int AddThemeAssignment(ThemeAssignment themeAssignment) { var db = GetDbContext(); db.ThemeAssignments.InsertOnSubmit(themeAssignment); db.SubmitChanges(); return themeAssignment.Id; }