예제 #1
0
 public int GetFineOfAddedClass(ISchedule schedule, EntityStorage eStorage)
 {
     StudentSubGroup[] groups = schedule.GetTempClass().SubGroups;
     int day = Constants.GetDayOfClass(schedule.GetTimeOfTempClass());
     List<StudentsClass[]> groupDaySchedule = new List<StudentsClass[]>();
     int fineResult = 0;
     //Проверка является ли добавленная пара пятой
     for (int groupIndex = 0; groupIndex < groups.Length; groupIndex++)
     {
         groupDaySchedule.Add(schedule.GetPartialSchedule(groups[groupIndex]).GetClassesOfDay(day));
         if (schedule.GetTempClass() != groupDaySchedule[groupIndex][Constants.CLASSES_IN_DAY - 2])
         {
             return 0;
         }
     }
     //Проверка отсутствия первой пары
     for (int groupIndex = 0; groupIndex < groups.Length; groupIndex++)
     {
         if (groupDaySchedule[groupIndex][Constants.CLASSES_IN_DAY - 6] == null)
         {
             if (isBlock)
                 return Constants.BLOCK_FINE;
             else
                 fineResult += fine;
         }
     }
     return fineResult;
 }
예제 #2
0
 public int GetFineOfAddedClass(ISchedule schedule, EntityStorage eStorage)
 {
     int fineResult = 0;
     StudentsClass tempClass = schedule.GetTempClass();
     int classTime = schedule.GetTimeOfTempClass();
     int roomIndex = schedule.GetClassPosition(schedule.GetTempClass()).Value.ClassRoom;
     int weekOfClass = Constants.GetWeekOfClass(classTime);
     if (Array.Find(sClassesList.ToArray(), (c) => c == schedule.GetTempClass()) != null)
     {
         StudentsClass secondClass;
         if (weekOfClass == 0)
             secondClass = schedule.GetClassByRoomAndPosition(roomIndex, classTime + Constants.CLASSES_IN_DAY * Constants.DAYS_IN_WEEK);
         else
             secondClass = schedule.GetClassByRoomAndPosition(roomIndex, classTime - Constants.CLASSES_IN_DAY * Constants.DAYS_IN_WEEK);
         if (secondClass != null)
         {
             int firstClassRow = ClassesInWeek.GetRow(sClasses, tempClass);
             int secondClassRow = ClassesInWeek.GetRow(sClasses, secondClass);
             if (secondClassRow == -1 || secondClassRow != firstClassRow)
             {
                 if (isBlock)
                     return Constants.BLOCK_FINE;
                 else
                     fineResult += fine;
             }
         }
     }
     return fineResult;
 }
예제 #3
0
 public int GetFineOfAddedClass(ISchedule schedule, EntityStorage eStorage)
 {
     int fineResult = 0;
     StudentsClass tClass = schedule.GetTempClass();
     int tTime = schedule.GetClassPosition(tClass).Value.Time;
     if (sClasses.FindAll((c) => c.sClass == tClass).Count() > 0)
     {
         FixedClasses vipClass = sClasses.Find((c) => c.sClass == tClass);
         if (vipClass.Room != schedule.GetClassRoom(tClass) || vipClass.Time != tTime)
         {
             if (isBlock)
                 return Constants.BLOCK_FINE;
             else
                 fineResult += fine;
         }
     }
     else
     {
         if (sClasses.FindAll((c) => c.Time == tTime && StudentsClass.StudentClassContainsEvenOneSubGroup(tClass, c.sClass)).Count() > 0)
         {
             if (isBlock)
                 return Constants.BLOCK_FINE;
             else
                 fineResult += fine;
         }
     }
     return fineResult;
 }
예제 #4
0
 public int GetFineOfAddedClass(ISchedule schedule, EntityStorage eStorage)
 {
     StudentSubGroup[] groups = schedule.GetTempClass().SubGroups;
     int classTime = schedule.GetTimeOfTempClass();
     //Считаем день недели последней добавленной пары
     int dayOfWeek = Constants.GetDayOfClass(classTime);
     //Считаем номер пары в этот день
     int classOfDay = Constants.GetTimeOfClass(classTime);
     int otherWeekDay;
     int fineResult = 0;
     if (dayOfWeek < Constants.DAYS_IN_WEEK)
     {
         otherWeekDay = Constants.DAYS_IN_WEEK;
     }
     else
     {
         otherWeekDay = -Constants.DAYS_IN_WEEK;
     }
     if (dayOfWeek == Constants.DAYS_IN_WEEK - 1)
     {
         foreach (StudentSubGroup subGroup in groups)
         {
             StudentsClass[] classes = schedule.GetPartialSchedule(subGroup).GetClassesOfDay(dayOfWeek + otherWeekDay);
             if (classes[classOfDay] == null)
             {
                 if (isBlock)
                     return Constants.BLOCK_FINE;
                 else
                     fineResult += fine;
             }
         }
     }
     return fineResult;
 }
예제 #5
0
 public static bool ClassAtTheSameTimeOnOtherWeek(ISchedule schedule, StudentsClass[] sClasses, int dayOfWeek, int classOfDay)
 {
     StudentsClass tempClass = schedule.GetTempClass();
     if (dayOfWeek < Constants.DAYS_IN_WEEK)
     {
         foreach (StudentSubGroup subGroup in tempClass.SubGroups)
         {
             StudentsClass secondClass = schedule.GetPartialSchedule(subGroup).GetClassesOfDay(dayOfWeek + Constants.DAYS_IN_WEEK)[classOfDay];
             if (!IsSameClassesAtTheSameTimeOnOtherWeek(sClasses, tempClass, secondClass))
             {
                 return false;
             }
         }
     }
     else
     {
         foreach (StudentSubGroup subGroup in tempClass.SubGroups)
         {
             StudentsClass secondClass = schedule.GetPartialSchedule(subGroup).GetClassesOfDay(dayOfWeek - Constants.DAYS_IN_WEEK)[classOfDay];
             if (!IsSameClassesAtTheSameTimeOnOtherWeek(sClasses, tempClass, secondClass))
             {
                 return false;
             }
         }
     }
     return true;
 }
예제 #6
0
 public int GetFineOfAddedClass(ISchedule schedule, EntityStorage eStorage)
 {
     StudentSubGroup[] groups = schedule.GetTempClass().SubGroups;
     int fineResult = 0;
     if (IsSaturday(Constants.GetDayOfClass(schedule.GetTimeOfTempClass())))
     {
         for (int groupIndex = 0; groupIndex < groups.Length; groupIndex++)
         {
             PartialSchedule groupSchedule = schedule.GetPartialSchedule(groups[groupIndex]);
             int day = Constants.GetDayOfClass(schedule.GetTimeOfTempClass());
             if (Array.FindAll<StudentsClass>(groupSchedule.GetClassesOfDay(day), (c) => c != null).Count() > 0)
             {
                 if (isBlock)
                     return Constants.BLOCK_FINE;
                 else
                     fineResult += fine;
             }
         }
     }
     else
     {
         return 0;
     }
     return fineResult;
 }
예제 #7
0
 public int GetFineOfAddedClass(ISchedule schedule, EntityStorage eStorage)
 {
     int fineCount = 0;
     if (lClasses == null)
     { return fineCount; }
     int classTime = schedule.GetTimeOfTempClass();
     int dayOfWeek = Constants.GetDayOfClass(classTime);
     int lectureCount = 0;
     foreach (StudentSubGroup subGroup in schedule.GetTempClass().SubGroups)
     {
         lectureCount = CountLectureClassesInDay(schedule.GetPartialSchedule(subGroup).GetClassesOfDay(dayOfWeek), lClasses);
         if (lectureCount > 3)
         {
             fineCount++;
         }
     }
     if (fineCount != 0)
     {
         if (isBlock)
             return Constants.BLOCK_FINE;
         else
             return fineCount * fine;
     }
     return fineCount;
 }
예제 #8
0
 public int GetFineOfAddedClass(ISchedule schedule, EntityStorage eStorage)
 {
     if (ClassesInWeek.LotOfClassesInWeek(3, sClasses, schedule, schedule.GetTempClass()))
     {
         if (isBlock)
             return Constants.BLOCK_FINE;
         else
             return fine;
     }
     return 0;
 }
예제 #9
0
 public int GetFineOfAddedClass(ISchedule schedule, EntityStorage eStorage)
 {
     int classRow = -1;
     if ((classRow = ClassesInWeek.GetRow(sClasses, schedule.GetTempClass())) != -1)
     {
         if (!SameClasses.ClassesAtSameTime(schedule, classRow, sClasses))
         {
             if (isBlock)
                 return Constants.BLOCK_FINE;
             else
                 return fine;
         }
     }
     return 0;
 }
예제 #10
0
        public int GetFineOfAddedClass(ISchedule schedule, EntityStorage eStorage)
        {
            Teacher[] teachers = schedule.GetTempClass().Teacher;
            for (int teacherIndex = 0; teacherIndex < teachers.Length; teacherIndex++)
            {
                PartialSchedule teacherSchedule = schedule.GetPartialSchedule(teachers[teacherIndex]);
                if (Math.Abs(GetCountClassesOnFirstWeek(teacherSchedule) - GetCountClassesOnSecondWeek(teacherSchedule)) > DIFFERENCE)
                {
                    if (isBlock)
                        return Constants.BLOCK_FINE;
                    else
                        return fine;
                }
            }

            return 0;
        }
예제 #11
0
 public int GetFineOfAddedClass(ISchedule schedule, EntityStorage eStorage)
 {
     StudentSubGroup[] groups = schedule.GetTempClass().SubGroups;
     int fineResult = 0;
     for (int groupIndex = 0; groupIndex < groups.Length; groupIndex++)
     {
         PartialSchedule groupSchedule = schedule.GetPartialSchedule(groups[groupIndex]);
         int day = Constants.GetDayOfClass(schedule.GetTimeOfTempClass());
         if (GetCountClassesInRow(groupSchedule.GetClassesOfDay(day)) == 5)
         {
             if (isBlock)
                 return Constants.BLOCK_FINE;
             else
                 fineResult += fine;
         }
     }
     return fineResult;
 }
예제 #12
0
 public int GetFineOfAddedClass(ISchedule schedule, EntityStorage eStorage)
 {
     int fineResult = 0;
     foreach (Teacher teacher in schedule.GetTempClass().Teacher)
     {
         if (favClassRooms.ContainsKey(teacher))
         {
             if (favClassRooms[teacher].Find((c) => c == schedule.GetTempClassRooom()) == null)
             {
                 if (isBlock)
                     return Constants.BLOCK_FINE;
                 else
                     fineResult += fine;
             }
         }
     }
     return fineResult;
 }
 public int GetFineOfAddedClass(ISchedule schedule, EntityStorage eStorage)
 {
     int fineResult = 0;
     if (favClassRooms == null)
     { return fineResult; }
     StudentsClass tempClass = schedule.GetTempClass();
     if (favClassRooms.ContainsKey(tempClass))
     {
         if (favClassRooms[tempClass].Find((c) => c == schedule.GetTempClassRooom()) == null)
         {
             if (isBlock)
                 return Constants.BLOCK_FINE;
             else
                 fineResult += fine;
         }
     }
     return fineResult;
 }
예제 #14
0
 public int GetFineOfAddedClass(ISchedule schedule, EntityStorage eStorage)
 {
     int fineResult = 0;
     if (favBuildings == null)
     { return fineResult; }
     foreach (Teacher teacher in schedule.GetTempClass().Teacher)
     {
         if (favBuildings.ContainsKey(teacher))
         {
             if (favBuildings[teacher].IndexOf(schedule.GetTempClassRooom().Housing) == -1)
             {
                 if (isBlock)
                     return Constants.BLOCK_FINE;
                 else
                     fineResult += fine;
             }
         }
     }
     return fineResult;
 }
예제 #15
0
 public int GetFineOfAddedClass(ISchedule schedule, EntityStorage eStorage)
 {
     int fineResult = 0;
     int classTime = schedule.GetTimeOfTempClass();
     //Считаем день недели последней добавленной пары
     int dayOfWeek = Constants.GetDayOfClass(classTime);
     //Считаем номер пары в этот день
     int classOfDay = Constants.GetTimeOfClass(classTime);
     foreach (StudentSubGroup subGroup in schedule.GetTempClass().SubGroups)
     {
         int windowsCount = Classes.CountUpTwoWindowsOfAddedClass(schedule.GetPartialSchedule(subGroup).GetClassesOfDay(dayOfWeek), classOfDay);
         if (windowsCount > 0)
         {
             if (isBlock)
                 return Constants.BLOCK_FINE;
             else
                 fineResult += windowsCount * fine;
         }
     }
     return fineResult;
 }