private static void Check(DelegGetAll action)
 {
     var temp = action().Where(a => a.ToString().Length > 12);
     if (temp.Count() != 0)
     {
         if (MessageBox.Show(
             "Некоторые элементы будут отображться маленьким шрифтом, вы будете редактировать эти значения?", "Внимание", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             foreach (var info in temp)
             {
                 var type = info.GetType();
                 var a = new Add(info.ToString(), type, null);
                 string strAdd = null;
                 if (a.ShowDialog() == DialogResult.OK)
                 {
                     strAdd = a.strNew;
                 }
                 if (type == typeof(FacultyInfo))
                     Model.Edit.Faculty(((FacultyInfo)info), strAdd);
                 else if (type == typeof(TeacherInfo))
                     Model.Edit.Teacher(((TeacherInfo)info), strAdd);
                 else if (type == typeof(DisciplineInfo))
                     Model.Edit.Discipline(((DisciplineInfo)info), strAdd);
             }
         }
     }
 }
        private static void  Check(DelegGetAll action)
        {
            var temp = action().Where(a => a.ToString().Length > 12);

            if (temp.Count() != 0)
            {
                if (MessageBox.Show(
                        "Некоторые элементы будут отображться маленьким шрифтом, вы будете редактировать эти значения?", "Внимание", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    foreach (var info in temp)
                    {
                        var    type   = info.GetType();
                        var    a      = new Add(info.ToString(), type, null);
                        string strAdd = null;
                        if (a.ShowDialog() == DialogResult.OK)
                        {
                            strAdd = a.strNew;
                        }
                        if (type == typeof(FacultyInfo))
                        {
                            Model.Edit.Faculty(((FacultyInfo)info), strAdd);
                        }
                        else if (type == typeof(TeacherInfo))
                        {
                            Model.Edit.Teacher(((TeacherInfo)info), strAdd);
                        }
                        else if (type == typeof(DisciplineInfo))
                        {
                            Model.Edit.Discipline(((DisciplineInfo)info), strAdd);
                        }
                    }
                }
            }
        }
        private void LoadMenuElements(ToolStripDropDownItem tools, DelegGetAll d, string text, ProgressBar bar)
        {
            Status.Text = text;
            Application.DoEvents();
            tools.DropDownItems.Clear();
            Array t = d();

            if (t.GetType() == typeof(FacultyInfo[]))
            {
                var temp = t as FacultyInfo[];
                Array.Sort(temp, new Model.MyComparerName().Compare);
                t = temp;
            }
            if (t.GetType() == typeof(TeacherInfo[]))
            {
                var temp = t as TeacherInfo[];
                Array.Sort(temp, new Model.MyComparerName().Compare);
                t = temp;
            }
            if (t.GetType() == typeof(LocationInfo[]))
            {
                var temp = t as LocationInfo[];
                Array.Sort(temp, new Model.MyComparerName().Compare);
                t = temp;
            }

            foreach (var fac in t)
            {
                if (bar != null)
                {
                    bar.PerformStep();
                }
                var tool = new ToolStripMenuItem(fac.ToString());
                tool.Click += MenuItem_Click;
                tool.Tag    = fac;
                tools.DropDownItems.Add(tool);
            }
        }
        private void LoadMenuElements(ToolStripDropDownItem tools, DelegGetAll d, string text, ProgressBar bar)
        {
            Status.Text = text;
            Application.DoEvents();
            tools.DropDownItems.Clear();
            Array t = d();
            if (t.GetType() == typeof(FacultyInfo[]))
            {
                var temp = t as FacultyInfo[];
                Array.Sort(temp, new Model.MyComparerName().Compare);
                t = temp;
            }
            if (t.GetType() == typeof(TeacherInfo[]))
            {
                var temp = t as TeacherInfo[];
                Array.Sort(temp, new Model.MyComparerName().Compare);
                t = temp;
            }
            if (t.GetType() == typeof(LocationInfo[]))
            {
                var temp = t as LocationInfo[];
                Array.Sort(temp, new Model.MyComparerName().Compare);
                t = temp;
            }

            foreach (var fac in t)
            {
                if (bar != null)
               		bar.PerformStep();
                var tool = new ToolStripMenuItem(fac.ToString());
                tool.Click += MenuItem_Click;
                tool.Tag = fac;
                tools.DropDownItems.Add(tool);
            }
        }