private void Add_Click(object sender, EventArgs e)
        {
            string strAdd = null;

            if (_type == typeof(AuditoriumInfo))
            {
                var add = new AddAuditorium(null, 0, "", 0, "", false);
                if (add.ShowDialog() == DialogResult.OK)
                {
                    EditBase = true;
                    Model.Add.Auditorium(add.number,
                                         add.Capacity, add.NumbComp, add.QualityComp,
                                         add.AvailabilityProjector, (LocationInfo)_added);
                }
            }
            else
            {
                var           a   = new Add(null, _type, null);
                EducationInfo edu = null;
                if (a.ShowDialog() == DialogResult.OK)
                {
                    strAdd = a.strNew;
                    edu    = a.Edu;
                }
                if (strAdd != null)
                {
                    EditBase = true;
                    if (_type == typeof(FacultyInfo))
                    {
                        Model.Add.Faculty(strAdd);
                    }
                    else if (_type == typeof(TeacherInfo))
                    {
                        Model.Add.Teacher(strAdd);
                    }
                    else if (_type == typeof(LocationInfo))
                    {
                        Model.Add.Location(strAdd);
                    }
                    else if (_type == typeof(EducationInfo))
                    {
                        Model.Add.Education(strAdd);
                    }
                    else if (_type == typeof(GroupInfo))
                    {
                        Model.Add.Group(strAdd, (FacultyInfo)_added, edu);
                    }
                    else if (_type == typeof(DisciplineInfo))
                    {
                        Model.Add.Discipline(strAdd, (TeacherInfo)_added);
                    }
                }
            }
            LoadListBox();
        }
 private void Add_Click(object sender, EventArgs e)
 {
     string strAdd = null;
     if (_type == typeof(AuditoriumInfo))
     {
         var add = new AddAuditorium(null, 0, "", 0, "", false);
         if (add.ShowDialog() == DialogResult.OK)
         {
             EditBase = true;
             Model.Add.Auditorium(add.number,
             add.Capacity, add.NumbComp, add.QualityComp,
             add.AvailabilityProjector, (LocationInfo)_added);
         }
     }
     else
     {
         var a = new Add(null, _type, null);
         EducationInfo edu = null;
         if (a.ShowDialog() == DialogResult.OK)
         {
             strAdd = a.strNew;
             edu = a.Edu;
         }
         if (strAdd != null)
         {
             EditBase = true;
             if (_type == typeof(FacultyInfo))
                 Model.Add.Faculty(strAdd);
             else if (_type == typeof(TeacherInfo))
                 Model.Add.Teacher(strAdd);
             else if (_type == typeof(LocationInfo))
                 Model.Add.Location(strAdd);
             else if (_type == typeof(EducationInfo))
                 Model.Add.Education(strAdd);
             else if (_type == typeof(GroupInfo))
                 Model.Add.Group(strAdd, (FacultyInfo)_added, edu);
             else if (_type == typeof(DisciplineInfo))
                 Model.Add.Discipline(strAdd, (TeacherInfo)_added);
         }
     }
     LoadListBox();
 }
 private void Edit_Click(object sender, EventArgs e)
 {
     if (list.SelectedItem == null)
     {
         MessageBox.Show("Элемент не выбран");
     }
     else
     {
         if (_type == typeof(AuditoriumInfo))
         {
             var s = (AuditoriumInfo)list.SelectedItem;
             var au = new AddAuditorium(s.Number, s.Capacity,
                 s.AvailabilityProjector, s.NumbComp, s.QualityComp, true);
             if (au.ShowDialog() == DialogResult.OK)
             {
                 EditBase = true;
                 Model.Edit.Auditorium(s, au.number, au.Capacity, au.NumbComp, au.QualityComp,
                     au.AvailabilityProjector);
             }
         }
         else
         {
             var selected = list.SelectedItem;
             EducationInfo edu = null;
             if (_type == typeof(GroupInfo))
                 edu = Model.GetEducationFromGroup((GroupInfo)selected);
             var a = new Add(selected.ToString(), _type, edu);
             string strAdd = null;
             if (a.ShowDialog() == DialogResult.OK)
             {
                 strAdd = a.strNew;
                 edu = a.Edu;
             }
             if (strAdd != null)
             {
                 EditBase = true;
                 if (_type == typeof(FacultyInfo))
                     Model.Edit.Faculty(((FacultyInfo)selected), strAdd);
                 else if (_type == typeof(TeacherInfo))
                     Model.Edit.Teacher(((TeacherInfo)selected), strAdd);
                 else if (_type == typeof(DisciplineInfo))
                     Model.Edit.Discipline(((DisciplineInfo)selected), strAdd);
                 else if (_type == typeof(EducationInfo))
                     Model.Edit.Education(((EducationInfo)selected), strAdd);
                 else if (_type == typeof(GroupInfo))
                     Model.Edit.Group(((GroupInfo)selected), strAdd, edu);
                 else if (_type == typeof(LocationInfo))
                     Model.Edit.Location(((LocationInfo)selected), strAdd);
             }
         }
         LoadListBox();
     }
 }
 private void Edit_Click(object sender, EventArgs e)
 {
     if (list.SelectedItem == null)
     {
         MessageBox.Show("Элемент не выбран");
     }
     else
     {
         if (_type == typeof(AuditoriumInfo))
         {
             var s  = (AuditoriumInfo)list.SelectedItem;
             var au = new AddAuditorium(s.Number, s.Capacity,
                                        s.AvailabilityProjector, s.NumbComp, s.QualityComp, true);
             if (au.ShowDialog() == DialogResult.OK)
             {
                 EditBase = true;
                 Model.Edit.Auditorium(s, au.number, au.Capacity, au.NumbComp, au.QualityComp,
                                       au.AvailabilityProjector);
             }
         }
         else
         {
             var           selected = list.SelectedItem;
             EducationInfo edu      = null;
             if (_type == typeof(GroupInfo))
             {
                 edu = Model.GetEducationFromGroup((GroupInfo)selected);
             }
             var    a      = new Add(selected.ToString(), _type, edu);
             string strAdd = null;
             if (a.ShowDialog() == DialogResult.OK)
             {
                 strAdd = a.strNew;
                 edu    = a.Edu;
             }
             if (strAdd != null)
             {
                 EditBase = true;
                 if (_type == typeof(FacultyInfo))
                 {
                     Model.Edit.Faculty(((FacultyInfo)selected), strAdd);
                 }
                 else if (_type == typeof(TeacherInfo))
                 {
                     Model.Edit.Teacher(((TeacherInfo)selected), strAdd);
                 }
                 else if (_type == typeof(DisciplineInfo))
                 {
                     Model.Edit.Discipline(((DisciplineInfo)selected), strAdd);
                 }
                 else if (_type == typeof(EducationInfo))
                 {
                     Model.Edit.Education(((EducationInfo)selected), strAdd);
                 }
                 else if (_type == typeof(GroupInfo))
                 {
                     Model.Edit.Group(((GroupInfo)selected), strAdd, edu);
                 }
                 else if (_type == typeof(LocationInfo))
                 {
                     Model.Edit.Location(((LocationInfo)selected), strAdd);
                 }
             }
         }
         LoadListBox();
     }
 }