Ejemplo n.º 1
0
        // GET: Aula/Schedule/5
        public ActionResult Schedule(int?ID)
        {
            if (ID == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Classroom classroom = db.Classrooms.Find(ID);

            if (classroom == null)
            {
                return(HttpNotFound());
            }

            var periodo_actual = int.Parse(Request.Cookies["Periodo"].Value);

            var scheduleClassroom = (from aula in db.Classrooms
                                     join grupo_aula in db.GroupClassrooms on aula.ID equals grupo_aula.ClassroomID
                                     join horario in db.Schedules on grupo_aula.ScheduleID equals horario.ID
                                     join sede in db.Sedes on classroom.SedeID equals sede.ID
                                     join grupo in db.Groups on grupo_aula.GroupID equals grupo.ID
                                     join plan_bloque_curso in db.BlocksXPlansXCourses on grupo.BlockXPlanXCourseID equals plan_bloque_curso.ID
                                     join curso in db.Courses on plan_bloque_curso.CourseID equals curso.ID
                                     join periodo in db.Periods on grupo.PeriodID equals periodo.ID
                                     where (aula.ID == ID) && (periodo.ID == periodo_actual) && (horario.StartHour != "700" && horario.StartHour != "900")

                                     select new
            {
                curso.Name,
                grupo.Number,
                horario.StartHour,
                horario.EndHour,
                horario.Day
            }).ToList();

            var data = new ScheduleDataList();

            scheduleClassroom.ForEach(p => data.add(
                                          p.Day,
                                          (p.Name + "\nGrupo: " + p.Number),
                                          DateTime.Parse(p.StartHour),
                                          DateTime.Parse(p.EndHour),
                                          "Curso")
                                      );

            var viewModel = new ScheduleProfessorViewModel()
            {
                Name         = classroom.Code,
                ScheduleData = data.getData()
            };

            return(View(viewModel));
        }
Ejemplo n.º 2
0
        // GET: Professor/Schedule/5
        public ActionResult Schedule(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Professor profesor = db.Professors.Find(id);

            if (profesor == null)
            {
                return(HttpNotFound());
            }

            var actualPeriod = int.Parse(Request.Cookies["Periodo"].Value);
            var data         = new ScheduleDataList();
            var courses      = db.SP_getAllCoursesPerProf(actualPeriod, profesor.Name).ToList();
            var commissions  = db.SP_getAllCommissionsPerProf(actualPeriod, profesor.Name).ToList();
            var projects     = db.SP_getAllProjectsPerProf(actualPeriod, profesor.Name).ToList();

            courses.ForEach(p => data.add(
                                p.Day,
                                (p.Name + "\nGrupo: " + p.Number),
                                DateTime.Parse(p.StartHour),
                                DateTime.Parse(p.EndHour),
                                "Curso")
                            );

            commissions.ForEach(p => data.add(
                                    p.Day,
                                    p.Name,
                                    DateTime.Parse(p.StartHour),
                                    DateTime.Parse(p.EndHour),
                                    "Comisión")
                                );

            projects.ForEach(p => data.add(
                                 p.Day,
                                 p.Name,
                                 DateTime.Parse(p.StartHour),
                                 DateTime.Parse(p.EndHour),
                                 "Proyecto")
                             );

            var viewModel = new ScheduleProfessorViewModel()
            {
                Name         = profesor.Name,
                ScheduleData = data.getData()
            };

            return(View(viewModel));
        }
Ejemplo n.º 3
0
        // GET: Aula/Schedule/5
        public ActionResult Schedule(int? ID)
        {
            if (ID == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Classroom classroom = db.Classrooms.Find(ID);
            if (classroom == null)
            {
                return HttpNotFound();
            }

            var periodo_actual = int.Parse(Request.Cookies["Periodo"].Value);

                var scheduleClassroom = (from aula in db.Classrooms
                                  join grupo_aula in db.GroupClassrooms on aula.ID equals grupo_aula.ClassroomID
                                  join horario in db.Schedules on grupo_aula.ScheduleID equals horario.ID
                                  join sede in db.Sedes on classroom.SedeID equals sede.ID
                                  join grupo in db.Groups on grupo_aula.GroupID equals grupo.ID
                                  join plan_bloque_curso in db.BlocksXPlansXCourses on grupo.BlockXPlanXCourseID equals plan_bloque_curso.ID
                                  join curso in db.Courses on plan_bloque_curso.CourseID equals curso.ID
                                  join periodo in db.Periods on grupo.PeriodID equals periodo.ID
                                  where (aula.ID == ID) && (periodo.ID == periodo_actual) && (horario.StartHour != "700" && horario.StartHour != "900")

                                  select new
                                  {
                                      curso.Name,
                                      grupo.Number,
                                      horario.StartHour,
                                      horario.EndHour,
                                      horario.Day
                                  }).ToList();

                var data = new ScheduleDataList();

                scheduleClassroom.ForEach(p => data.add(
                p.Day,
                (p.Name + "\nGrupo: " + p.Number),
                DateTime.Parse(p.StartHour),
                DateTime.Parse(p.EndHour),
                "Curso")
            );

                var viewModel = new ScheduleProfessorViewModel()
                {
                    Name = classroom.Code,
                    ScheduleData = data.getData()
                };

            return View(viewModel);
        }
        // GET: Professor/Schedule/5
        public ActionResult Schedule(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Professor profesor = db.Professors.Find(id);
            if (profesor == null)
            {
                return HttpNotFound();
            }

            var actualPeriod = int.Parse(Request.Cookies["Periodo"].Value);
            var data = new ScheduleDataList();
            var courses = db.SP_getAllCoursesPerProf(actualPeriod, profesor.Name).ToList();
            var commissions = db.SP_getAllCommissionsPerProf(actualPeriod, profesor.Name).ToList();
            var projects = db.SP_getAllProjectsPerProf(actualPeriod, profesor.Name).ToList();

            courses.ForEach(p => data.add(
                p.Day,
                (p.Name + "\nGrupo: " + p.Number),
                DateTime.Parse(p.StartHour),
                DateTime.Parse(p.EndHour),
                "Curso")
            );

            commissions.ForEach(p => data.add(
                p.Day,
                p.Name,
                DateTime.Parse(p.StartHour),
                DateTime.Parse(p.EndHour),
                "Comisión")
            );

            projects.ForEach(p => data.add(
                p.Day,
                p.Name,
                DateTime.Parse(p.StartHour),
                DateTime.Parse(p.EndHour),
                "Proyecto")
            );

            var viewModel = new ScheduleProfessorViewModel()
            {
                Name = profesor.Name,
                ScheduleData = data.getData()
            };

            return View(viewModel);
        }