Ejemplo n.º 1
0
        private bool IsValidDate(SemSchoolYear semschoolyear)
        {
            var db = DAL.DbContext.Create();

            var date1 = Convert.ToDateTime(semschoolyear.EnrollmentDateStart);
            var date2 = Convert.ToDateTime(semschoolyear.SemesterDateEnd);

            if (date1 >= date2)
            {
                ModelState.AddModelError("", "Unable to save changes. Semester Date End needs to be greater than Enrollment Date Start.");
                return(false);
            }
            return(true);
        }
Ejemplo n.º 2
0
        private bool ValidateEnrollmentDate(Student student, SemSchoolYear semschoolyear)
        {
            var db = DAL.DbContext.Create();

            DateTime?a = student.EnrollmentDate;
            DateTime?b = semschoolyear.EnrollmentDateStart;
            DateTime?c = semschoolyear.SemesterDateEnd;

            if (a >= b && a <= c)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 3
0
        // GET: Semschoolyear/Details/5
        public ActionResult Details(int id)
        {
            var db = DAL.DbContext.Create();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SemSchoolYear semschoolyear = db.SemSchoolYears.Get(id);

            if (semschoolyear == null)
            {
                return(HttpNotFound());
            }
            return(View(semschoolyear));
        }
Ejemplo n.º 4
0
        public ActionResult Create(SemSchoolYear semschoolyear)
        {
            var db = DAL.DbContext.Create();

            if (ModelState.IsValid)
            {
                if (IsValidDate(semschoolyear))
                {
                    db.SemSchoolYears.Insert(semschoolyear);
                    return(RedirectToAction("Index"));
                }
            }

            ViewBag.SchoolYearID = new SelectList(db.SchoolYears.All(), "Id", "SchoolYearRange", semschoolyear.SchoolYearID);
            ViewBag.SemesterID   = new SelectList(db.Semesters.All(), "Id", "SemesterName", semschoolyear.SemesterID);
            return(View(semschoolyear));
        }
Ejemplo n.º 5
0
        public ActionResult EditPost(SemSchoolYear semschoolyear)
        {
            var db = DAL.DbContext.Create();

            if (ModelState.IsValid)
            {
                var date1 = Convert.ToDateTime(semschoolyear.EnrollmentDateStart);
                var date2 = Convert.ToDateTime(semschoolyear.SemesterDateEnd);

                if (date1 >= date2)
                {
                    ModelState.AddModelError("", "Unable to save changes. Semester Date End needs to be greater than Enrollment Date Start.");
                }

                db.SemSchoolYears.Update(semschoolyear.Id, semschoolyear);
                return(RedirectToAction("Index"));
            }
            ViewBag.SchoolYearID = new SelectList(db.SchoolYears.All(), "Id", "SchoolYearRange", semschoolyear.SchoolYearID);
            ViewBag.SemesterID   = new SelectList(db.Semesters.All(), "Id", "SemesterName", semschoolyear.SemesterID);
            return(View(semschoolyear));
        }