示例#1
0
 protected virtual decimal PutOneLessonOnOneOrTwoWeek(List <Position> freePositions, decimal Load, LoadItem item)
 {
     foreach (Position position in freePositions)
     {
         ScheduleDay day = Shedule.GetDay(position.Time);
         if (day.LimitLessonsNotExceeded(item.Groups, day.Week, day.Day, 1))
         {
             Load = PutLesson(item, position.Time, position.Room, Load);
             if (Load > 0 && CanPutToPosition(GetTimeAfterTwoWeek(position.Time), position.Room, item))
             {
                 Load = PutLesson(item, GetTimeAfterTwoWeek(position.Time), position.Room, Load);
             }
         }
         if (Load == 0)
         {
             break;
         }
     }
     return(Load);
 }
示例#2
0
        private decimal PutTwoLessonOnWeek(List <Position> Adding, decimal Load, LoadItem item)
        {
            for (int counter = 0; counter < Adding.Count - 1 && Load > 0; counter++)
            {
                Position curr = Adding[counter];
                Position next = Adding[counter + 1];

                ScheduleDay day = Shedule.GetDay(curr.Time);
                if (!IsHoursNear(curr.Time, next.Time) || !day.LimitLessonsNotExceeded(item.Groups, day.Week, day.Day, 2))
                {
                    continue;
                }

                if (CanPutToPosition(curr.Time, curr.Room, item) && CanPutToPosition(next.Time, next.Room, item))
                {
                    Load = PutLesson(item, curr.Time, curr.Room, Load);
                    Load = PutLesson(item, next.Time, next.Room, Load);
                }
            }

            return(Load);
        }
示例#3
0
        private decimal PutTwoLessonOnTwoWeek(List <Position> freePositions, decimal Load, LoadItem item)
        {
            for (int counter = 0; counter < freePositions.Count - 1 && Load > 0; counter++)
            {
                Position curr = freePositions[counter];
                Position next = freePositions[counter + 1];

                if (curr.Time.WeekNumber > 2 || next.Time.WeekNumber > 2)
                {
                    continue;
                }

                ScheduleTime CurrAfterTwoWeek = GetTimeAfterTwoWeek(curr.Time);
                ScheduleTime NextAfterTwoWeek = GetTimeAfterTwoWeek(next.Time);

                ScheduleDay currDay = Shedule.GetDay(curr.Time);
                ScheduleDay nextDay = Shedule.GetDay(CurrAfterTwoWeek);

                if (!IsHoursNear(curr.Time, next.Time) || !currDay.LimitLessonsNotExceeded(item.Groups, currDay.Week, currDay.Day, 2) ||
                    !nextDay.LimitLessonsNotExceeded(item.Groups, CurrAfterTwoWeek.Week, CurrAfterTwoWeek.Day, 2))
                {
                    continue;
                }

                if (CanPutToPosition(curr.Time, curr.Room, item) && CanPutToPosition(next.Time, next.Room, item) &&
                    CanPutToPosition(CurrAfterTwoWeek, curr.Room, item) && CanPutToPosition(NextAfterTwoWeek, next.Room, item))
                {
                    Load = PutLesson(item, curr.Time, curr.Room, Load);
                    Load = PutLesson(item, next.Time, next.Room, Load);
                    Load = PutLesson(item, CurrAfterTwoWeek, curr.Room, Load);
                    Load = PutLesson(item, NextAfterTwoWeek, next.Room, Load);
                    counter++;
                    return(Load);
                }
            }

            return(Load);
        }
示例#4
0
 public IEnumerable <ScheduleLesson> GetLessonsOfDay(ScheduleDay day)
 {
     return(GetLessonsOfDay(day.Week, day.Day));
 }