public CourseType(string name, int period, int weekDay, int min, int max, int common)
        {
            Name     = name;
            Period   = period;
            WeekDay  = weekDay;
            Min      = min;
            Max      = max;
            IsCommon = common == 0 ? false : true;

            if (Min == 0 && Max == 0)
            {
                type = CourseTypeEnum.Normal;
            }
            else if (Min == Max)
            {
                type = CourseTypeEnum.Fixed;
            }
            else
            {
                type = CourseTypeEnum.Range;
            }
        }
Пример #2
0
 /// <summary>
 /// This method returns all created course of the given type.
 /// </summary>
 /// <param name="courseType">This is the type of the course.</param>
 /// <returns>course List.</returns>
 public static List <Course> GetAll(CourseTypeEnum courseType)
 {
     return(InMemoryDatabaseSingleton.DatabaseInstance.SelectMany <Course>(
                x => x.CourseType == courseType).OrderByDescending(
                x => x.CreationDate).ToList());
 }
Пример #3
0
 /// <summary>
 /// This method selects the course of given type which is created.
 /// </summary>
 /// <param name="courseType">This is the type of the course.</param>
 /// <returns>A course</returns>
 public static Course Get(CourseTypeEnum courseType)
 {
     return(InMemoryDatabaseSingleton.DatabaseInstance.SelectMany <Course>
                (x => x.CourseType == courseType && x.IsCreated).OrderByDescending(
                x => x.CreationDate).First());
 }