public AddParaGroup(GroupInfo teacherInfo, IEnumerable<ScheduleInfo> scheduleInfos, int para, int dayWeek, int idPeriod, string text, bool edit)
        {
            InitializeComponent();
            Text = text;
            IDGroup = teacherInfo.ID_Group;
            Para = para;
            DayWeek = dayWeek;
            IDPeriod = idPeriod;
            if (IDPeriod != 1 && IDPeriod != 2)
            {
                checkBox2.Visible = false;
                Size = new Size(431, 231);
            }
            Sched = edit ? new List<ScheduleInfo>(scheduleInfos) : new List<ScheduleInfo>();
            if (edit)
            {
                switch (scheduleInfos.Count())
                {
                    case 1:
                        {
                            Teacher2.Items.AddRange(Model.GetFreeTeachers(IDPeriod, Para, DayWeek));
                            var teacher = Model.GetFreeTeachersAndCurrent(
                                IDPeriod, Para, DayWeek, Sched[0].ID_Teacher);
                            Teacher1.Items.AddRange(teacher);
                            var t = (from info in teacher
                                     where info.ID_Teacher == Sched[0].ID_Teacher
                                     select info).Single();
                            Teacher1.SelectedItem = t;
                            var loc = Model.GetAll.Location();
                            Location1.Items.AddRange(loc);
                            Location2.Items.AddRange(loc);
                            var l = (from a in loc
                                     where a.ID_Location == Sched[0].ID_Location
                                     select a).Single();
                            Location1.SelectedItem = l;
                            var aud = Model.GetAuditoriumsFromLocation(l);
                            Aud1.Items.Clear();
                            Aud1.Items.AddRange(aud);
                            var au = (from info in aud
                                      where info.ID_Auditorium == Sched[0].ID_Auditorium
                                      select info).Single();
                            Aud1.SelectedItem = au;
                            var disp = Model.GetDisciplinesFromTeacher((TeacherInfo)Teacher1.SelectedItem);
                            Disp.Items.Clear();
                            Disp.Items.AddRange(disp);
                            var d = (from a in disp
                                     where a.ID_Discipline == Sched[0].ID_Discipline
                                     select a).Single();
                            Disp.SelectedItem = d;
                        }
                        break;
                    case 2:
                        {
                            var teacher = Model.GetFreeTeachersAndCurrent(
                                IDPeriod, Para, DayWeek, Sched[0].ID_Teacher);
                            Teacher1.Items.AddRange(teacher);
                            var t = (from info in teacher
                                     where info.ID_Teacher == Sched[0].ID_Teacher
                                     select info).Single();
                            Teacher1.SelectedItem = t;
                            var loc = Model.GetAll.Location();
                            Location1.Items.AddRange(loc);
                            var l = (from a in loc
                                     where a.ID_Location == Sched[0].ID_Location
                                     select a).Single();
                            Location1.SelectedItem = l;
                            var aud = Model.GetAuditoriumsFromLocation(l);
                            Aud1.Items.AddRange(aud);
                            var au = (from info in aud
                                      where info.ID_Auditorium == Sched[0].ID_Auditorium
                                      select info).Single();
                            Aud1.SelectedItem = au;
                            var disp = Model.GetDisciplinesFromTeacher((TeacherInfo)Teacher1.SelectedItem);
                            Disp.Items.Clear();
                            Disp.Items.AddRange(disp);
                            var d = (from a in disp
                                     where a.ID_Discipline == Sched[0].ID_Discipline
                                     select a).Single();
                            Disp.SelectedItem = d;
                            teacher = Model.GetFreeTeachersAndCurrent(
                                IDPeriod, Para, DayWeek, Sched[1].ID_Teacher);
                            Teacher2.Items.AddRange(teacher);
                            t = (from info in teacher
                                 where info.ID_Teacher == Sched[1].ID_Teacher
                                 select info).Single();
                            Teacher2.SelectedItem = t;
                            loc = Model.GetAll.Location();
                            Location2.Items.AddRange(loc);
                            l = (from a in loc
                                 where a.ID_Location == Sched[1].ID_Location
                                 select a).Single();
                            Location2.SelectedItem = l;
                            aud = Model.GetAuditoriumsFromLocation(l);
                            Aud2.Items.AddRange(aud);
                            au = (from info in aud
                                  where info.ID_Auditorium == Sched[1].ID_Auditorium
                                  select info).Single();
                            Aud2.SelectedItem = au;
                            disp = Model.GetDisciplinesFromTeacher((TeacherInfo)Teacher1.SelectedItem);
                            Disp.Items.Clear();
                            Disp.Items.AddRange(disp);
                            d = (from a in disp
                                 where a.ID_Discipline == Sched[1].ID_Discipline
                                 select a).Single();
                            Disp.SelectedItem = d;
                            checkBox1.Checked = true;
                            Teacher2.Enabled = true;
                            Location2.Enabled = true;
                        }
                        break;
                }
            }
            else
            {
                var loc = Model.GetAll.Location();
                Location1.Items.AddRange(loc);
                Location2.Items.AddRange(loc);
                if (loc.Count() == 1)
                {
                    Location1.SelectedItem = loc[0];
                    Location2.SelectedItem = loc[0];
                }

                var teacher = Model.GetFreeTeachers(IDPeriod, Para, DayWeek);
                Teacher1.Items.AddRange(teacher);
                Teacher2.Items.AddRange(teacher);
                if (teacher.Count() == 1)
                {
                    Teacher1.SelectedIndex = 0;
                    Teacher2.SelectedIndex = 0;
                }
            }
        }