Пример #1
0
 public ChooseClassRoom(int TimeRows, EntityStorage store, StudentsClass sClass)
 {
     InitializeComponent();
     this.TimeRows = TimeRows;
     this.store = store;
     this.sClass = sClass;
 }
Пример #2
0
        public static void CreateBase(EntityStorage eStorage)
        {
            currentBase = new Base();
            currentBase.EStorage = eStorage;
            currentBase.Factors = new List<FactorSettings>();
            currentBase.Settings = new Dictionary<string, object>();

            currentBase.Settings.Add(FACULTIES, new List<Faculty>());
        }
Пример #3
0
        public static void CreateBase(EntityStorage eStorage)
        {
            currentBase = new Base();
            currentBase.EStorage = eStorage;
            currentBase.Factors = FactorsLoader.GetFactorSettings().ToList();
            currentBase.Settings = new Dictionary<string, object>();
            currentBase.Schedules = new Dictionary<string, Schedule>();

            currentBase.Settings.Add(FACULTIES, new List<Faculty>());
        }
Пример #4
0
 public FullSchedule(FullSchedule schedule)
 {
     this.TempClass = new StudentsClassPosition(schedule.TempClass.Time, schedule.TempClass.ClassRoom);
     this.eStorage = schedule.eStorage;
     this.classesTable = new StudentsClass[schedule.classesTable.GetLength(0), schedule.classesTable.GetLength(1)];
     for (int timeIndex = 0; timeIndex < this.classesTable.GetLength(0); timeIndex++)
     {
         for (int classIndex = 0; classIndex < this.classesTable.GetLength(1); classIndex++)
         {
             this.classesTable[timeIndex, classIndex] = schedule.classesTable[timeIndex, classIndex];
         }
     }
 }
Пример #5
0
 public void Init(string factorName, string factorDescription, string userInstruction, EntityStorage storage, FactorSettings factorSettings)
 {
     this.storage = storage;
     this.factorSettings = factorSettings;
     this.factorDescription = factorDescription;
     this.userInstruction = userInstruction;
     this.factorName = factorName;
     if (this.factorSettings.Data != null)
     {
         settings = (List<FixedClasses>)this.factorSettings.Data;
     }
     else
         settings = new List<FixedClasses>();
 }
Пример #6
0
 public void Init(string factorName, string factorDescription, string userInstruction, EntityStorage storage, FactorSettings factorSettings)
 {
     this.storage = storage;
     this.factorSettings = factorSettings;
     this.factorDescription = factorDescription;
     this.userInstruction = userInstruction;
     this.factorName = factorName;
     if (this.factorSettings.Data != null)
     {
         settings = (Dictionary<Teacher, List<int>>)this.factorSettings.Data;
     }
     else
         settings = new Dictionary<Teacher, List<int>>();
 }
Пример #7
0
 public static StudentsClass[] Sort(EntityStorage eStorage, StudentsClass[] fixedClasses, int sortType = 0, bool returnNewArray = false)
 {
     StudentsClass[] classArray;
     if (returnNewArray)
     {
         classArray = (StudentsClass[])eStorage.Classes.Clone();
     }
     else
     {
         classArray = eStorage.Classes;
     }
     if (fixedClasses != null)
     {
         List<StudentsClass> temp = classArray.ToList<StudentsClass>();
         temp.RemoveAll(c => fixedClasses.Contains(c));
         classArray = temp.ToArray();
     }
     switch (sortType)
     {
         case 0:
             SortByFreedomPositionScore(classArray, eStorage);
             break;
         case 1:
             SortBySubGroupCount(classArray);
             break;
         default:
             SortRandom(classArray);
             break;
     }
     if (fixedClasses != null)
     {
         List<StudentsClass> temp = classArray.ToList<StudentsClass>();
         temp.InsertRange(0, fixedClasses);
         classArray = temp.ToArray();
     }
     return classArray;
 }
Пример #8
0
 public void EditClassRoom(ClassRoom room, List<string> prymaryDescription, List<string> secondDescription)
 {
     int id = (int)((Domain.IDomainIdentity<ClassRoom>)room).ID;
     int housing = room.Housing, number = room.Number;
     List<ClassRoom> classrooms = eStorage.ClassRooms.ToList();
     classrooms.Remove(room);
     BitArray SecondTypesMask = new BitArray(prymaryDescription.Count + secondDescription.Count, false);
     List<ClassRoomType> type = new List<ClassRoomType>();
     int indexMask = 0;
     for (int index = 0; index < eStorage.ClassRoomsTypes.Count(); index++)
     {
         foreach (var item in prymaryDescription)
         {
             if (item == eStorage.ClassRoomsTypes[index].Description)
             {
                 type.Add(eStorage.ClassRoomsTypes[index]);
                 indexMask++;
             }
         }
         foreach (var item in secondDescription)
         {
             if (item == eStorage.ClassRoomsTypes[index].Description)
             {
                 type.Add(eStorage.ClassRoomsTypes[index]);
                 SecondTypesMask[indexMask] = true;
                 indexMask++;
             }
         }
     }
     classrooms.Add(new ClassRoom(id, number, housing, type, SecondTypesMask));
     eStorage = new Domain.Services.EntityStorage(eStorage.Classes.ToArray(), eStorage.ClassRoomsTypes.ToArray(), eStorage.StudentSubGroups.ToArray(), eStorage.Teachers.ToArray(), classrooms);
 }
Пример #9
0
 public void DelType(ClassRoomType delType)
 {
     List<ClassRoomType> type = eStorage.ClassRoomsTypes.ToList();
     type.Remove(delType); eStorage = new Domain.Services.EntityStorage(eStorage.Classes.ToArray(), type.ToArray(), eStorage.StudentSubGroups.ToArray(), eStorage.Teachers.ToArray(), eStorage.ClassRooms.ToArray());
 }
Пример #10
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());
 }
Пример #11
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());
 }
Пример #12
0
 public void DelTeacher(Teacher delTeacher)
 {
     List<Teacher> teachers = eStorage.Teachers.ToList();
     teachers.Remove(delTeacher);
     eStorage = new Domain.Services.EntityStorage(eStorage.Classes.ToArray(), eStorage.ClassRoomsTypes.ToArray(), eStorage.StudentSubGroups.ToArray(), teachers, eStorage.ClassRooms.ToArray());
 }
Пример #13
0
 private List<ClassRoom> GetNotTeacherClassRooms(Teacher teacher, EntityStorage storage)
 {
     List<ClassRoom> notTeacherClassRooms = new List<ClassRoom>();
     if (settings.ContainsKey(teacher))
     {
         foreach (ClassRoom cRoom in storage.ClassRooms)
         {
             if (settings[teacher].Find((c) => c == cRoom) == null)
             {
                 notTeacherClassRooms.Add(cRoom);
             }
         }
     }
     return notTeacherClassRooms;
 }
Пример #14
0
 public void DelClassRoom(ClassRoom classRoom)
 {
     List<ClassRoom> classRooms = eStorage.ClassRooms.ToList();
     classRooms.Remove(classRoom);
     eStorage = new Domain.Services.EntityStorage(eStorage.Classes.ToArray(), eStorage.ClassRoomsTypes.ToArray(), eStorage.StudentSubGroups.ToArray(), eStorage.Teachers.ToArray(), classRooms);
 }
Пример #15
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());
 }
Пример #16
0
 public void EditType(ClassRoomType editType, string Description)
 {
     List<ClassRoomType> type = eStorage.ClassRoomsTypes.ToList();
     int id = (int)((Domain.IDomainIdentity<ClassRoomType>)editType).ID;
     type.Remove(editType);
     type.Add(new ClassRoomType(id, Description));
     eStorage = new Domain.Services.EntityStorage(eStorage.Classes.ToArray(), type.ToArray(), eStorage.StudentSubGroups.ToArray(), eStorage.Teachers.ToArray(), eStorage.ClassRooms.ToArray());
 }
Пример #17
0
 public void ADDStudentSubGroup(string name, byte number)
 {
     List<StudentSubGroup> group = eStorage.StudentSubGroups.ToList();
     group.Add(new StudentSubGroup(IDStudenSubGroups(), name, number));
     eStorage = new Domain.Services.EntityStorage(eStorage.Classes.ToArray(), eStorage.ClassRoomsTypes.ToArray(), group.ToArray(), eStorage.Teachers.ToArray(), eStorage.ClassRooms.ToArray());
 }
Пример #18
0
 public void ADDClassRoom(int number, int housing, List<string> prymaryDescription, List<string> secondDescription)
 {
     BitArray SecondTypesMask = new BitArray(prymaryDescription.Count + secondDescription.Count, false);
     List<ClassRoomType> type = new List<ClassRoomType>();
     int indexMask = 0;
     for (int index = 0; index < eStorage.ClassRoomsTypes.Count(); index++)
     {
         foreach (var item in prymaryDescription)
         {
             if (item == eStorage.ClassRoomsTypes[index].Description)
             {
                 type.Add(eStorage.ClassRoomsTypes[index]);
                 indexMask++;
             }
         }
         foreach (var item in secondDescription)
         {
             if (item == eStorage.ClassRoomsTypes[index].Description)
             {
                 type.Add(eStorage.ClassRoomsTypes[index]);
                 SecondTypesMask[indexMask] = true;
                 indexMask++;
             }
         }
     }
     List<ClassRoom> classromm = eStorage.ClassRooms.ToList();
     classromm.Add(new ClassRoom(IDClassRoom(), number, housing, type, SecondTypesMask));
     eStorage = new Domain.Services.EntityStorage(eStorage.Classes.ToArray(), eStorage.ClassRoomsTypes.ToArray(), eStorage.StudentSubGroups.ToArray(), eStorage.Teachers.ToArray(), classromm);
 }
Пример #19
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());
 }
Пример #20
0
 public StorageEditor()
 {
     eStorage = Code.CurrentBase.EStorage;
 }
Пример #21
0
 public Schedule(EntityStorage storage)
     : base(storage.ClassRooms.Length, storage)
 {
 }
Пример #22
0
 public void EditTeacher(Teacher editTeacher, string FIO)
 {
     List<Teacher> teacher = eStorage.Teachers.ToList();
     int id = (int)((Domain.IDomainIdentity<Teacher>)editTeacher).ID;
     teacher.Remove(editTeacher);
     teacher.Add(new Teacher(id, FIO));
     eStorage = new Domain.Services.EntityStorage(eStorage.Classes.ToArray(), eStorage.ClassRoomsTypes.ToArray(), eStorage.StudentSubGroups.ToArray(), teacher, eStorage.ClassRooms.ToArray());
 }
Пример #23
0
 public static void CreateSchedule(EntityStorage eStorage)
 {
     currentSchedule = new KeyValuePair<string, Schedule>("", new Schedule(eStorage));
 }
Пример #24
0
 public void ADDTeacher(string FIO)
 {
     List<Teacher> teacher = eStorage.Teachers.ToList();
     teacher.Add(new Teacher(IDTeacher(), FIO));
     eStorage = new Domain.Services.EntityStorage(eStorage.Classes.ToArray(), eStorage.ClassRoomsTypes.ToArray(), eStorage.StudentSubGroups.ToArray(), teacher, eStorage.ClassRooms.ToArray());
 }
Пример #25
0
        StudentsClassPosition TempClass; //временная пара - нужна,

        #endregion Fields

        #region Constructors

        public FullSchedule(int classRoomCount, EntityStorage storage)
        {
            classesTable = new StudentsClass[Constants.WEEKS_IN_SCHEDULE * Constants.DAYS_IN_WEEK * Constants.CLASSES_IN_DAY, classRoomCount];
            eStorage = storage;
        }
Пример #26
0
 static void SortByFreedomPositionScore(StudentsClass[] classes, EntityStorage eStorage)
 {
     List<StudentClassScores> sClasses = new List<StudentClassScores>();
     double[] a = new double[classes.Length];
     double[] g = new double[classes.Length];
     double[] p = new double[classes.Length];
     for (int classIndex = 0; classIndex < classes.Length; classIndex++)
     {
         a[classIndex] = 0;
         g[classIndex] = 0;
         p[classIndex] = 0;
         //Определяем количество подходящих аудиторий для каждой пары
         for (int requireClassRoomIndex = 0; requireClassRoomIndex < classes[classIndex].RequireForClassRoom.Length; requireClassRoomIndex++)
         {
             foreach (ClassRoom cRoom in eStorage.ClassRooms)
             {
                 foreach (ClassRoomType cRoomType in cRoom.Types)
                 {
                     ClassRoomType cr = cRoomType;
                     if (cRoomType.Description.Equals(classes[classIndex].RequireForClassRoom[requireClassRoomIndex].Description))
                     {
                         a[classIndex]++;
                     }
                 }
             }
         }
         //Определяем количество пар занятий для преподавателя и подгруппы
         for (int secondClassIndex = 0; secondClassIndex < classes.Length; secondClassIndex++)
         {
             if (StudentsClass.StudentClassEqualsTeachers(classes[classIndex], classes[secondClassIndex]))
             {
                 p[classIndex]++;
             }
             if (StudentsClass.StudentClassEqualsSubGroups(classes[classIndex], classes[secondClassIndex]))
             {
                 g[classIndex]++;
             }
         }
         sClasses.Add(new StudentClassScores(classes[classIndex], a[classIndex] / (g[classIndex] * p[classIndex])));
     }
     List<StudentClassPair> pairClasses = GetGroupSameClassesMoreTwoInTwoWeeks(classes);
     sClasses.Sort((s1, s2) =>
     {
         int result;
         if ((pairClasses.Find((c) => c.c1 == s1.sClass || c.c2 == s1.sClass) != null &&
             pairClasses.Find((c) => c.c1 == s2.sClass || c.c2 == s2.sClass) != null) ||
             (pairClasses.Find((c) => c.c1 == s1.sClass || c.c2 == s1.sClass) == null &&
             pairClasses.Find((c) => c.c1 == s2.sClass || c.c2 == s2.sClass) == null))
         {
             result = 0;
         }
         else if (pairClasses.Find((c) => c.c1 == s1.sClass || c.c2 == s1.sClass) != null &&
                 pairClasses.Find((c) => c.c1 == s2.sClass || c.c2 == s2.sClass) == null)
         {
             result = -1;
         }
         else
             result = 1;
         if (result == 0)
         {
             bool sOne = false, sTwo = false;
             foreach (ClassRoomType cRoomType in s1.sClass.RequireForClassRoom)
             {
                 if (cRoomType.Description.Contains("Лекция") || cRoomType.Description.Contains("СпортЗал"))
                 {
                     sOne = true;
                 }
             }
             foreach (ClassRoomType cRoomType in s2.sClass.RequireForClassRoom)
             {
                 if (cRoomType.Description.Contains("Лекция") || cRoomType.Description.Contains("СпортЗал"))
                 {
                     sTwo = true;
                 }
             }
             if ((sOne && sTwo) || (!sOne && !sTwo))
             {
                 result = 0;
             }
             else if (sOne && !sTwo)
             {
                 result = -1;
             }
             else
                 result = 1;
             if (result == 0)
             {
                 result = s1.fPosScore.CompareTo(s2.fPosScore);
                 if (result == 0)
                 {
                     result = -s1.sClass.SubGroups.Length.CompareTo(s2.sClass.SubGroups.Length);
                     if (result == 0)
                     {
                         result = s1.sClass.SubGroups[0].NameGroup.CompareTo(s2.sClass.SubGroups[0].NameGroup);
                         if (result == 0)
                         {
                             result = s1.sClass.SubGroups[0].NumberSubGroup.CompareTo(s2.sClass.SubGroups[0].NumberSubGroup);
                             if (result == 0)
                             {
                                 result = s1.sClass.Name.CompareTo(s2.sClass.Name);
                             }
                         }
                     }
                 }
             }
         }
         return result;
     });
     for (int i = 0; i < classes.Length; i++)
     {
         classes[i] = sClasses[i].sClass;
     }
 }
Пример #27
0
 public void AddType(string Description)
 {
     List<ClassRoomType> type = eStorage.ClassRoomsTypes.ToList();
     type.Add(new ClassRoomType(IDTypes(), Description));
     eStorage = new Domain.Services.EntityStorage(eStorage.Classes.ToArray(), type.ToArray(), eStorage.StudentSubGroups.ToArray(), eStorage.Teachers.ToArray(), eStorage.ClassRooms.ToArray());
 }
Пример #28
0
 public void DelClasses(StudentsClass classes)
 {
     List<StudentsClass> Classes = eStorage.Classes.ToList(); ;
     Classes.Remove(classes);
     eStorage = new Domain.Services.EntityStorage(Classes.ToArray(), eStorage.ClassRoomsTypes.ToArray(), eStorage.StudentSubGroups.ToArray(), eStorage.Teachers.ToArray(), eStorage.ClassRooms.ToArray());
 }
Пример #29
0
 public CheckDataInFactors(EntityStorage storage)
 {
     this.store = storage;
 }