Exemple #1
0
 public CheckingStudenSubGroups(StudentSubGroup Group, Visibility Visible, bool Checking)
 {
     this.Group = Group;
     this.Number = Group.NumberSubGroup;
     this.NameGroup = Group.NameGroup;
     this.Checking = Checking;
     this.Visible = Visible;
     this.Content = this.NameGroup + "." + this.Number;
 }
 public void AddGroup(string facultyName, StudentSubGroup group)
 {
     foreach (var item in CurrentBase.Faculties)
     {
         if (item.Name == facultyName)
         {
             item.Groups.Add(group);
         }
     }
 }
Exemple #3
0
 public StudentSubGroup GetReference(StudentSubGroup extObj)
 {
     foreach (StudentSubGroup item in StudentSubGroups)
     {
         if (((IDomainIdentity<StudentSubGroup>)item).EqualsByParams(extObj) && ((IDomainIdentity<StudentSubGroup>)item).EqualsByID(extObj))
         {
             return item;
         }
     }
     return null;
 }
Exemple #4
0
        public string ExistStudentGroupInFactors(StudentSubGroup group)
        {
            CheckDataInFactors f = new CheckDataInFactors(eStorage);
            List<FactorSettings> factors = f.CheckGroup(group);
            string s = "";
            if (factors.Count == 0) return s;
            else
            {
                foreach (var item in factors)
                {
                    s += item.FactorName + ":" + item.UsersFactorName + "\n";
                }

            }
            return s;
        }
Exemple #5
0
        public int ExistClasses(string name, StudentSubGroup[] group, ClassRoomType[] type, Teacher[] teacher)
        {
            int count = 0;
            foreach (var item in eStorage.Classes.ToList())
            {
                if ((item.Name.ToUpper() == name.ToUpper()) && (item.Teacher == teacher) && (item.RequireForClassRoom == type) && item.SubGroups == group)
                {
                    count++;
                }

            }
            return count;
        }
Exemple #6
0
 public void EditStudenSubGroups(StudentSubGroup group, string name, byte number)
 {
     List<StudentSubGroup> groups = eStorage.StudentSubGroups.ToList();
     int id = (int)((Domain.IDomainIdentity<StudentSubGroup>)group).ID;
     groups.Remove(group);
     groups.Add(new StudentSubGroup(id, name, number));
     eStorage = new Domain.Services.EntityStorage(eStorage.Classes.ToArray(), eStorage.ClassRoomsTypes.ToArray(), groups.ToArray(), eStorage.Teachers.ToArray(), eStorage.ClassRooms.ToArray());
 }
Exemple #7
0
 public void EditClasses(StudentsClass classes, string name, StudentSubGroup[] group, ClassRoomType[] type, Teacher[] teacher)
 {
     List<StudentsClass> Classes = eStorage.Classes.ToList();
     int id = (int)((Domain.IDomainIdentity<StudentsClass>)classes).ID;
     Classes.Remove(classes);
     Classes.Add(new StudentsClass(id, group, teacher, name, type));
     eStorage = new Domain.Services.EntityStorage(Classes.ToArray(), eStorage.ClassRoomsTypes.ToArray(), eStorage.StudentSubGroups.ToArray(), eStorage.Teachers.ToArray(), eStorage.ClassRooms.ToArray());
 }
Exemple #8
0
 public void DelStudentSubGroup(StudentSubGroup group)
 {
     List<StudentSubGroup> groups = eStorage.StudentSubGroups.ToList();
     groups.Remove(group);
     eStorage = new Domain.Services.EntityStorage(eStorage.Classes.ToArray(), eStorage.ClassRoomsTypes.ToArray(), groups.ToArray(), eStorage.Teachers.ToArray(), eStorage.ClassRooms.ToArray());
 }
Exemple #9
0
 public void ADDClasses(string name, StudentSubGroup[] group, ClassRoomType[] type, Teacher[] teacher, int count)
 {
     List<StudentsClass> classes = eStorage.Classes.ToList();
     int id = IdClasses();
     for (int i = 0; i < count; i++)
     {
         classes.Add(new StudentsClass(id, group, teacher, name, type));
         id++;
     }
     eStorage = new Domain.Services.EntityStorage(classes.ToArray(), eStorage.ClassRoomsTypes.ToArray(), eStorage.StudentSubGroups.ToArray(), eStorage.Teachers.ToArray(), eStorage.ClassRooms.ToArray());
 }
Exemple #10
0
 public PartialSchedule GetPartialSchedule(StudentSubGroup subGroup)
 {
     throw new NotImplementedException();
 }
 // Возвращает название факультета
 public string GetFacultyNameByGroup(StudentSubGroup group)
 {
     foreach (Faculty item in CurrentBase.Faculties)
     {
         if (item.Groups.Contains(group))
         {
             return item.Name;
         }
     }
     return null;
 }
 // Возвращает номер курса по группе
 public int GetСourseByGroup(StudentSubGroup group)
 {
     string groupCode = group.NameGroup.Substring(group.NameGroup.Length - 3, 2);
     int YerEnter = 2000 + Convert.ToInt32(groupCode);
     if (DateTime.Now.Month >= 9 && DateTime.Now.Month <= 12)
     {
         return DateTime.Now.Year - YerEnter + 1;
     }
     else
     {
         return DateTime.Now.Year - YerEnter;
     }
 }
Exemple #13
0
        public void LoadPartScheduleExcel(StudentSubGroup[] Groups)
        {
            if (pathToFile == null)
                return;
            ObjExcel = new Application();
            string path = pathToFile;
            ObjWorkBook = ObjExcel.Workbooks.Add();
            ObjWorkSheet = (Worksheet)ObjWorkBook.Sheets[1];
            CreatTemplate(ObjExcel, ObjWorkBook, ObjWorkSheet);
            int k = 3;
            Range exelcells;
            foreach (StudentSubGroup groop in Groups)
            {
                PartialSchedule partSchedule;
                //partSchedule = schedule.GetPartialSchedule(FacultiesAndGroups.GetClassGroupStorage(groop, eStorage));WTF???
                partSchedule = schedule.GetPartialSchedule(groop);
                StudentsClass[] sched;
                ClassRoom clas;
                sched = partSchedule.GetClasses();
                int ifor1 = 0, ifor2 = 32;
                ((Range)ObjWorkSheet.Cells[1, k]).Value2 = groop.NameGroup;
                ((Range)ObjWorkSheet.Cells[1, k]).Borders.Weight = XlBorderWeight.xlMedium;
                ((Range)ObjWorkSheet.Cells[2, k]).Value2 = groop.NumberSubGroup;
                ((Range)ObjWorkSheet.Cells[2, k]).Borders.Weight = XlBorderWeight.xlMedium;
                ((Range)ObjWorkSheet.Cells[1, k]).HorizontalAlignment = Microsoft.Office.Interop.Excel.Constants.xlCenter;
                ((Range)ObjWorkSheet.Cells[1, k]).VerticalAlignment = Microsoft.Office.Interop.Excel.Constants.xlCenter;
                ((Range)ObjWorkSheet.Cells[2, k]).HorizontalAlignment = Microsoft.Office.Interop.Excel.Constants.xlCenter;
                ((Range)ObjWorkSheet.Cells[2, k]).VerticalAlignment = Microsoft.Office.Interop.Excel.Constants.xlCenter;
                ((Range)ObjWorkSheet.Cells[1, k]).Font.Bold = true;
                ((Range)ObjWorkSheet.Cells[1, k]).Borders.ColorIndex = 1;
                ((Range)ObjWorkSheet.Cells[2, k]).Borders.ColorIndex = 1;
                for (int i = 0; i < (Domain.Services.Constants.CLASSES_IN_DAY * Domain.Services.Constants.DAYS_IN_WEEK * Domain.Services.Constants.WEEKS_IN_SCHEDULE); i++)
                {
                    ((Range)ObjWorkSheet.Cells[(i + 3), k]).Borders.ColorIndex = 1;
                    ((Range)ObjWorkSheet.Cells[(i + 3), k]).HorizontalAlignment = Microsoft.Office.Interop.Excel.Constants.xlCenter;
                    ((Range)ObjWorkSheet.Cells[(i + 3), k]).VerticalAlignment = Microsoft.Office.Interop.Excel.Constants.xlCenter;
                    if((i +1)% 12==0)
                        ((Range)ObjWorkSheet.Cells[(i + 3), k]).Borders[XlBordersIndex.xlEdgeBottom].Weight = XlBorderWeight.xlMedium;
                    if (sched[i] != null && i >= 0 && i <= 35)
                    {
                        string str;
                        clas = schedule.GetClassRoom(sched[i]);
                        str = sched[i].Name + " (" + clas.Housing + " а." + clas.Number + " )";
                        for (int n = 0; n < sched[i].Teacher.Length; n++)
                        {
                            str = str + " " + sched[i].Teacher[n].Name;
                        }

                        ((Range)ObjWorkSheet.Cells[(i + 3 + ifor1), k]).ColumnWidth = 30;
                        ((Range)ObjWorkSheet.Cells[(i + 3 + ifor1), k]).Value2 = str;

                    }
                    if (sched[i] != null && i >= 36 && i <= 71)
                    {
                        string str;
                        clas = schedule.GetClassRoom(sched[i]);
                        str = sched[i].Name + " (" + clas.Housing + " а." + clas.Number + " )";
                        for (int n = 0; n < sched[i].Teacher.Length; n++)
                        {
                            str = str + " " + sched[i].Teacher[n].Name;
                        }

                        ((Range)ObjWorkSheet.Cells[(i - ifor2), k]).ColumnWidth = 30;
                        ((Range)ObjWorkSheet.Cells[(i - ifor2), k]).Value2 = str;

                    }
                    if (i >= 0 && i <= 35) ifor1++;
                    if (i >= 36 && i <= 71) ifor2--;
                }
                k++;

            }
            //ANALYSING
            //------------------------------------------------------------------------------------

            string[,] grstr = new string[74, (k - 3)];
            for (int i = 0; i < (k - 3); i++)
            {
                for (int zed = 0; zed < 74; zed++)
                {
                    if (((Range)ObjWorkSheet.Cells[zed + 1, i + 3]).Value2 != null)
                    {
                        grstr[zed, i] = ((Range)ObjWorkSheet.Cells[zed + 1, i + 3]).Value2.ToString();
                    }
                }
            }

            //Horizantal
            for (int zed = 0; zed < 74; zed++)
            {
                if (zed != 1)
                {
                    for (int i = 0; i < (k - 4); i++)
                    {
                        if (grstr[zed, i] != null && grstr[zed, i] == grstr[zed, i + 1])
                        {
                            exelcells = ObjWorkSheet.Range[ObjWorkSheet.Cells[zed + 1, i + 3], ObjWorkSheet.Cells[zed + 1, i + 4]];
                            ((Range)ObjWorkSheet.Cells[zed + 1, i + 4]).Clear();
                            exelcells.Merge(Type.Missing);
                        }
                    }
                }
            }
            //Vertical
            for (int i = 0; i < (k - 3); i++)
            {
                for (int zed = 0; zed < 73; zed += 2)
                {
                    if (grstr[zed, i] == grstr[zed + 1, i])
                    {
                        exelcells = ObjWorkSheet.Range[ObjWorkSheet.Cells[zed + 1, i + 3], ObjWorkSheet.Cells[zed + 2, i + 3]];
                        ((Range)ObjWorkSheet.Cells[zed + 2, i + 3]).Value2 = "";
                        exelcells.Merge(Type.Missing);
                    }
                }
            }
            //------------------------------------------------------------------------------------

            ObjWorkBook.SaveAs(path);
            ObjWorkBook.Close();
            ObjExcel.Quit();
            ObjWorkSheet = null;
            ObjWorkBook = null;
            ObjExcel = null;
        }
Exemple #14
0
 bool StudentsBusy(StudentSubGroup[] students, int Time)
 {
     for (int classRoomIndex = 0; classRoomIndex < classesTable.GetLength(1); classRoomIndex++)
     {
         for (int groupIndex = 0; groupIndex < students.Length; groupIndex++)
         {
             if (classesTable[Time, classRoomIndex] != null && classesTable[Time, classRoomIndex].SubGroups.Contains(students[groupIndex]))
                 return true;
         }
     }
     return false;
 }
Exemple #15
0
 public PartialSchedule GetPartialSchedule(StudentSubGroup subGroup)
 {
     StudentsClass[] partSchedule = new StudentsClass[Constants.WEEKS_IN_SCHEDULE * Constants.DAYS_IN_WEEK * Constants.CLASSES_IN_DAY];
     for (int timeIndex = 0; timeIndex < classesTable.GetLength(0); timeIndex++)
     {
         for (int classRoomIndex = 0; classRoomIndex < classesTable.GetLength(1); classRoomIndex++)
         {
             if (classesTable[timeIndex, classRoomIndex] != null)
             {
                 if (classesTable[timeIndex, classRoomIndex].SubGroups.Contains(subGroup))
                 {
                     partSchedule[timeIndex] = classesTable[timeIndex, classRoomIndex];
                     break;
                 }
             }
         }
     }
     return new PartialSchedule(partSchedule);
 }
Exemple #16
0
 public int ExistStudentGroupsInClasses(StudentSubGroup group)
 {
     int count = 0;
     foreach (var item in eStorage.Classes.ToList())
     {
         foreach (var groups in item.SubGroups.ToList())
             if (groups == group) count++;
     }
     return count;
 }
        void CreateGroupHeader(StudentSubGroup[] groups)
        {
            int columnIndex = COLUMN_HEADER;
            foreach (StudentSubGroup group in groups)
            {
                Label groupLabel = new Label();

                groupLabel.Content = group.NameGroup + "/" + group.NumberSubGroup;
                groupLabel.Height = CELL_HEIGHT;
                groupLabel.Width = CELL_WIDTH;
                groupLabel.BorderBrush = new SolidColorBrush(Color.FromRgb(255, 140, 0));
                groupLabel.BorderThickness = new Thickness(1);
                groupLabel.SetValue(Grid.RowProperty, ROW_HEADER - 1);
                groupLabel.SetValue(Grid.ColumnProperty, columnIndex);
                groupLabel.FontSize = 12;
                groupLabel.HorizontalContentAlignment = HorizontalAlignment.Center;
                columnIndex++;
                gdData.Children.Add(groupLabel);
            }
        }
        public List<FactorSettings> CheckGroup(StudentSubGroup group)
        {
            this.Group = group;
            List<FactorSettings> usedFactors = new List<FactorSettings>();
            Factors = FactorsEditors.GetUsersFactors(CurrentBase.Factors);
            foreach (FactorSettings factor in Factors)
            {
                if (factor.Data != null && factor.Data.GetType() == typeof(Dictionary<StudentsClass, List<ClassRoom>>))
                {
                    Dictionary<StudentsClass, List<ClassRoom>> data = (Dictionary<StudentsClass, List<ClassRoom>>)factor.Data;
                    data = (Dictionary<StudentsClass, List<ClassRoom>>)FactorsEditors.RestoreLinks(data, store);
                    foreach (StudentsClass sClass in data.Keys)
                    {
                        if (sClass.SubGroups.Contains(group))
                        {
                            usedFactors.Add(factor);
                            break;
                        }

                    }
                }
                if (factor.Data != null && factor.Data.GetType() == typeof(List<FixedClasses>))
                {
                    List<FixedClasses> data = (List<FixedClasses>)factor.Data;
                    data =(List<FixedClasses>)FactorsEditors.RestoreLinks(data, store);
                    foreach (FixedClasses fixedClass in data)
                    {
                        if (fixedClass.sClass.SubGroups.Contains(group))
                        {
                            usedFactors.Add(factor);
                            break;
                        }

                    }
                }
            }
            return usedFactors;
        }