Пример #1
0
 public ActionResult Details(int? id)
 {
     var user = (Session["User"] as Person);
     if (user != null && user.type == "S")
     {
         if (id == null)
         {
             return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
         }
         Schedule schedule = db.Schedules.Find(id);
         if (schedule == null)
         {
             return HttpNotFound();
         }
         var sections = schedule.Sections;
         ViewBag.Sections = sections;
         ViewBag.Section = new SelectList(db.Sections, "SectID", "Display");
         ViewBag.id = id;
         //return View(sPlan);
         ScheduleDisplay display = new ScheduleDisplay(schedule);
         ViewBag.scheduleDisplay = display;
         return View(schedule);
     }
     return RedirectToAction("Index", "Home");
 }
Пример #2
0
 // GET: Sections/Details/5
 public ActionResult Details(int? id)
 {
     var user = (Session["User"] as Person);
     if (user != null && user.type == "S")
     {
         if (id == null)
         {
             return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
         }
         Section section = db.Sections.Find(id);
         if (section == null)
         {
             return HttpNotFound();
         }
         ScheduleDisplay display = new ScheduleDisplay(section.STimes);
         ViewBag.scheduleDisplay = display;
         return View(section);
     } else if (user != null && user.type == "P")
     {
         if (id == null)
         {
             return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
         }
         Section section = db.Sections.Find(id);
         if (section == null)
         {
             return HttpNotFound();
         }
         ScheduleDisplay display = new ScheduleDisplay(section.STimes);
         ViewBag.scheduleDisplay = display;
         ViewBag.id = id;
         return View(section);
     }
     return RedirectToAction("Index", "Home");
 }
Пример #3
0
        public ActionResult ResultStudent([Bind(Include = "TermID,search")] SearchView s)
        {
            ViewBag.Message = "The result page";
            Student student = db.People.Where( st => (st.UserName == s.search)).First().Student ;

            ScheduleDisplay display = new ScheduleDisplay();
            //student.Enrolls
            foreach(Enroll e in student.Enrolls)
            {
                if (e.Section.Term.TermID == s.TermID)
                    display.addTimes(e.Section.STimes);
            }

            ViewBag.scheduleDisplay = display;
            return View();
        }
Пример #4
0
        public ActionResult ResultCourse([Bind(Include = "TermID,search")] SearchView s)
        {
            ViewBag.Message = "The result page";

            Course course = db.Courses.Where(st => ( (st.Department.DepartID + st.CourseNum) == s.search)).First();

            ScheduleDisplay display = new ScheduleDisplay();
            //student.Enrolls
            foreach (Section e in course.Sections)
            {
                if (e.TermID == s.TermID)
                    display.addTimes(e.STimes);
            }
            ViewBag.scheduleDisplay = display;
            return View();
        }
Пример #5
0
 public ActionResult Details([Bind(Include = "SectID,Classroom,Period,WeekDay")] STime addedTime)
 {
     var user = (Session["User"] as Person);
     if (user != null && user.type == "P")
     {
         //Course addedCourse = db.Courses.Where(s => (s.Department.DepartID + s.CourseNum == c.Course)).First() ;
         db.STimes.Add(addedTime);
         db.SaveChanges();
         Section section = db.Sections.Find(addedTime.SectID);
         if (section == null)
         {
             return HttpNotFound();
         }
         ScheduleDisplay display = new ScheduleDisplay(section.STimes);
         ViewBag.scheduleDisplay = display;
         ViewBag.id = addedTime.SectID;
         return View(section);
     }
     return RedirectToAction("Index", "Home");
 }
Пример #6
0
 public ActionResult Details([Bind(Include = "Section,ScheID")] SectionAddedToSchedule s)
 {
     var user = (Session["User"] as Person);
     if (user != null && user.type == "S")
     {
         Schedule schedule = db.Schedules.Find(s.ScheID);
         if (schedule == null)
         {
             return HttpNotFound();
         }
         //Course addedCourse = db.Courses.Where(s => (s.Department.DepartID + s.CourseNum == c.Course)).First() ;
         Section addedSection = db.Sections.Find(s.Section);
         schedule.Sections.Add(addedSection);
         db.SaveChanges();
         var sections = schedule.Sections;
         ViewBag.Sections = sections;
         ViewBag.Section = new SelectList(db.Sections, "SectID", "Display");
         ViewBag.id = s.ScheID;
         ScheduleDisplay display = new ScheduleDisplay(schedule);
         ViewBag.scheduleDisplay = display;
         return View(schedule);
     }
     return RedirectToAction("Index", "Home");
 }