private void MenuItem_Click(object send, EventArgs e)
        {
            EditElements edit   = null;
            var          sender = (ToolStripMenuItem)send;

            if (sender.Tag == null)
            {
                var dict = new Dictionary <string, Type> {
                    { "Преподаватели", typeof(TeacherInfo) }, { "Факультеты", typeof(FacultyInfo) },
                    { "Корпуса", typeof(LocationInfo) }, { "Форму образования", typeof(EducationInfo) }
                };
                edit = new EditElements(dict[sender.Text], null);
            }
            else
            {
                if (sender.Tag is FacultyInfo)
                {
                    edit = new EditElements(typeof(GroupInfo), sender.Tag);
                }
                else if (sender.Tag is TeacherInfo)
                {
                    edit = new EditElements(typeof(DisciplineInfo), sender.Tag);
                }
                else if (sender.Tag is LocationInfo)
                {
                    edit = new EditElements(typeof(AuditoriumInfo), sender.Tag);
                }
            }
            edit.ShowDialog();
            if (edit.EditBase)
            {
                LoadMenu();
            }
            Main_SelectedIndexChanged(send, e);
        }
 private void MenuItem_Click(object send, EventArgs e)
 {
     EditElements edit = null;
     var sender = (ToolStripMenuItem)send;
     if (sender.Tag == null)
     {
         var dict = new Dictionary<string, Type> {
         { "Преподаватели", typeof(TeacherInfo) }, {"Факультеты", typeof(FacultyInfo)},
         {"Корпуса", typeof(LocationInfo)}, {"Форму образования", typeof(EducationInfo)}
         };
         edit = new EditElements(dict[sender.Text], null);
     }
     else
     {
         if (sender.Tag is FacultyInfo)
             edit = new EditElements(typeof(GroupInfo), sender.Tag);
         else if (sender.Tag is TeacherInfo)
             edit = new EditElements(typeof(DisciplineInfo), sender.Tag);
         else if (sender.Tag is LocationInfo)
             edit = new EditElements(typeof(AuditoriumInfo), sender.Tag);
     }
     edit.ShowDialog();
     if (edit.EditBase)
         LoadMenu();
     Main_SelectedIndexChanged(send, e);
 }