private void LoadTabGroup(FacultyInfo faculty)
        {
            Status.Text = "Загрузка вкладок для групп";
            Application.DoEvents();
            Group.Selected -= Tab_Selected;
            Group.TabPages.Clear();
            Group.Selected += Tab_Selected;
            var list = new List <GroupInfo>(Model.GetGroupFromFaculty(faculty));

            list.Sort(new Model.MyComparerName().Compare);
            ProgressBar.Value   = 0;
            ProgressBar.Maximum = list.Count;
            foreach (var i in list)
            {
                ProgressBar.PerformStep();
                var tabPage = new ExtendedTabPage(i.ToString())
                {
                    Tag  = i,
                    Name = i.Name,
                    UseVisualStyleBackColor = true
                };
                Group.TabPages.Add(tabPage);
            }
            Status.Text       = "Готово";
            ProgressBar.Value = 0;
            Application.DoEvents();
        }
Пример #2
0
        public static string GetGroupIDPartial(string name, FacultyInfo fac)
        {
            var g = (from t in Db.Group
                     where t.Name.ToUpper().StartsWith(name.ToUpper()) && t.ID_Faculty == fac.ID_Faculty
                     select t).FirstOrDefault();

            return(g != null ? g.Name : null);
        }
Пример #3
0
        public static GroupInfo[] GetGroupFromFaculty(FacultyInfo faculy)
        {
            var group = from g in Db.Group
                        where g.ID_Faculty == faculy.ID_Faculty
                        select new GroupInfo(g);

            return(group.ToArray());
        }
Пример #4
0
 public static void Faculty(FacultyInfo faculty)
 {
     foreach (GroupInfo f in GetGroupFromFaculty(faculty))
     {
         Group(f);
     }
     Db.Faculty.RemoveFacultyRow(Db.Faculty.Single(a => a.ID_Faculty == faculty.ID_Faculty));
     Db.AcceptChanges();
 }
Пример #5
0
            public static void Faculty(FacultyInfo faculty, string newValue)
            {
                var fac = (from a in Db.Faculty
                           where a.ID_Faculty == faculty.ID_Faculty
                           select a).Single();

                fac.Name = newValue;
                Db.AcceptChanges();
            }
Пример #6
0
            public static void Group(string str, FacultyInfo faculty, EducationInfo edu)
            {
                var temp = Db.Group.NewGroupRow();

                temp.Name         = str;
                temp.ID_Education = edu.ID_Education;
                temp.ID_Faculty   = faculty.ID_Faculty;
                Db.Group.AddGroupRow(temp);
                Db.AcceptChanges();
            }
Пример #7
0
        public static GroupInfo[] GetGroupFromFacultyAndKurs(FacultyInfo facultyInfo, int kurs)
        {
            GroupInfo[] temp;
            try
            {
                temp = (from a in Db.Group
                        where a.ID_Faculty == facultyInfo.ID_Faculty
                        where Convert.ToInt32(a.Name.Substring(a.Name.Length - 2, 1)) == kurs
                        select new GroupInfo(a)).ToArray();
            }
            catch (Exception)
            {
                return(null);
            }

            return(temp);
        }
 private void LoadTabGroup(FacultyInfo faculty)
 {
     Status.Text = "Загрузка вкладок для групп";
     Application.DoEvents();
     Group.Selected -= Tab_Selected;
     Group.TabPages.Clear();
     Group.Selected += Tab_Selected;
     var list = new List<GroupInfo>(Model.GetGroupFromFaculty(faculty));
     list.Sort(new Model.MyComparerName().Compare);
     ProgressBar.Value = 0;
     ProgressBar.Maximum = list.Count;
     foreach (var i in list)
     {
         ProgressBar.PerformStep();
         var tabPage = new ExtendedTabPage(i.ToString())
         {
             Tag = i,
             Name = i.Name,
             UseVisualStyleBackColor = true
         };
         Group.TabPages.Add(tabPage);
     }
     Status.Text = "Готово";
     ProgressBar.Value = 0;
     Application.DoEvents();
 }
Пример #9
0
 public int Compare(FacultyInfo a, FacultyInfo b)
 {
     return(a.Name.CompareTo(b.Name));
 }