private List<SVM.Lesson> GetEmptyLessons(int id_department, bool for_internal_groups) { List<SVM.Students_group_load> student_group_loads; List<SVM.Lesson> lessons = new List<SVM.Lesson>(); using (var DB = new SchedulingContext()) { student_group_loads = new List<SVM.Students_group_load>(DB.Students_group_load.Count()); student_group_loads = DB.Students_group_load.Take(16).ToList(); } int weeks_amount = Int32.Parse(ConfigurationManager.AppSettings["WeeksAmount"]); int weeks_count = Int32.Parse(ConfigurationManager.AppSettings["WeeksCount"]); int lesson_amount = Int32.Parse(ConfigurationManager.AppSettings["LessonsAmount"]); int min_hours = weeks_amount * lesson_amount / weeks_count; for (int i = 0; student_group_loads.Count != 0; i++) { if (student_group_loads[i].hours / min_hours == 1) { lessons.Add(new SVM.Lesson { id_students_group_load = student_group_loads[i].id_students_group_load }); student_group_loads.Remove(student_group_loads[i]); } else { lessons.Add(new SVM.Lesson { id_students_group_load = student_group_loads[i].id_students_group_load }); student_group_loads[i].hours -= min_hours; } } return lessons; }
public void Generate() { using (var DB = new SchedulingContext()) { List<Students_Group_Day> sg_day = new List<Students_Group_Day>(); foreach (var sg in DB.Students_group) sg_day.Add(new Students_Group_Day(sg.id_students_group)); List<Teacher_Day> t_day = new List<Teacher_Day>(); foreach (var t in DB.Teacher) t_day.Add(new Teacher_Day(t.id_teacher)); List<Classroom_Day> c_day = new List<Classroom_Day>(); foreach (var c in DB.Classroom) c_day.Add(new Classroom_Day(c.id_classroom)); foreach (var d in DB.Department) { } foreach (var d in DB.Department) { List<SVM.Lesson> empty_lessons = GetEmptyLessons(d.id_department, true); while (empty_lessons.Count > 0) { } } } }
public ActionResult GetDepartments(int id_faculty) { using (var DB = new SchedulingContext()) { ViewBag.departments = DB.Department.Where(d => d.id_faculty == id_faculty).ToList(); return PartialView(); } }
public ActionResult GetSubjects(int id_department) { using (var DB = new SchedulingContext()) { ViewBag.subjects = DB.Subject.Where(s => s.id_department == id_department).ToList(); return PartialView(); } }
public ActionResult GetTeachers(int id_department) { using (var DB = new SchedulingContext()) { ViewBag.teachers = DB.Teacher.Where(t => t.id_department == id_department).ToList(); return PartialView(); } }