Exemplo n.º 1
0
        public int AddStage(Stage stage)
        {
            stage.Created = DateTime.Now;
            stage.Updated = DateTime.Now;

            db.Stages.InsertOnSubmit(stage);
            db.SubmitChanges();

            return stage.Id;
        }
Exemplo n.º 2
0
        public ActionResult Create(int curriculumId, Stage stage)
        {
            try
            {
                stage.Curriculum = Storage.GetCurriculum(curriculumId);

                Storage.AddStage(stage);

                return RedirectToAction("Index");
            }
            catch (Exception e)
            {
                return ErrorView(e);
            }
        }
Exemplo n.º 3
0
        public ActionResult Create(int curriculumId, Stage stage)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    stage.CurriculumRef = curriculumId;
                    Storage.AddStage(stage);

                    return RedirectToAction("Index");
                }
                else
                {
                    return View(stage);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 4
0
        public void UpdateStageTest()
        {
            //Test UpdateStage() with null
            try
            {
                storage.UpdateStage(null);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                Assert.AreEqual(true, true);
            }

            //Test UpdateStage()
            int curriculumId = storage.AddCurriculum(Utils.GetDefaultCurriculum());

            Stage stage = new Stage { Name = "Stage", CurriculumRef = curriculumId };
            int stageId = storage.AddStage(stage);
            stage.Name = "UpdatedStage";
            storage.UpdateStage(stage);

            AdvAssert.AreEqual(stage, storage.GetStage(stageId));

            stage.Name = "SecondlyUpdatedStage";
            Assert.AreNotEqual(stage.Name, storage.GetStage(stageId).Name);
        }
Exemplo n.º 5
0
        public void UpdateStage(Stage stage)
        {
            Stage oldStage = GetStage(stage.Id);

            oldStage.Name = stage.Name;
            oldStage.Updated = DateTime.Now;

            db.SubmitChanges();
        }
Exemplo n.º 6
0
		private void detach_Stages(Stage entity)
		{
			this.SendPropertyChanging();
			entity.Curriculum = null;
		}
Exemplo n.º 7
0
		private void attach_Stages(Stage entity)
		{
			this.SendPropertyChanging();
			entity.Curriculum = this;
		}
Exemplo n.º 8
0
        public void UpdateStage(Stage stage)
        {
            Stage oldStage = GetStage(stage.Id);

            using (var db = new CurriculumManagementDBContext())
            {
                db.Stages.Attach(oldStage);

                oldStage.Name = stage.Name;
                oldStage.Updated = DateTime.Now;

                db.SaveChanges();
            }
        }
Exemplo n.º 9
0
        public int AddStage(Stage stage)
        {
            using (var db = new CurriculumManagementDBContext())
            {
                stage.Created = DateTime.Now;
                stage.Updated = DateTime.Now;
                stage.IsDeleted = false;

                db.Stages.Add(stage);
                db.SaveChanges();

                return stage.Id;
            }
        }
Exemplo n.º 10
0
        public ActionResult Edit(int stageId, Stage stage)
        {
            try
            {
                stage.Id = stageId;
                Storage.UpdateStage(stage);

                return RedirectToRoute("Stages", new { action = "Index", CurriculumId = HttpContext.Application["CurriculumId"] });
            }
            catch (Exception e)
            {
                return ErrorView(e);
            }
        }
Exemplo n.º 11
0
 public void MakeCurriculumInvalid()
 {
     Curriculum curriculum = new Curriculum() { Name = "Curriculum1" };
     Stage stage = new Stage() { Curriculum = curriculum, Name = "Stage1" };
     Theme theme = new Theme() { Name = "Theme1", Stage = stage, ThemeType = _Storage.GetThemeType(1), CourseRef = 1 };
     _Storage.AddCurriculum(curriculum);
     _Storage.AddStage(stage);
     _Storage.AddTheme(theme);
     _Storage.MakeCurriculumInvalid(1);
     _Storage.GetCurriculums().ToList()
         .ForEach(item => Assert.AreEqual(false, item.IsValid));
 }
Exemplo n.º 12
0
        public ActionResult Edit(int stageId, Stage stage)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    stage.Id = stageId;
                    Storage.UpdateStage(stage);

                    return RedirectToRoute("Stages", new { action = "Index", CurriculumId = HttpContext.Session["CurriculumId"] });
                }
                else
                {
                    return View(stage);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 13
0
 partial void DeleteStage(Stage instance);
Exemplo n.º 14
0
 partial void UpdateStage(Stage instance);
Exemplo n.º 15
0
 partial void InsertStage(Stage instance);