Beispiel #1
0
        public override void Search()
        {
            var source = this.Sources?.ToList();

            if (!string.IsNullOrEmpty(base.SelectTeacher?.ID))
            {
                source = source.Where(s => s.Teachers.Any(t => t.ID.Equals(base.SelectTeacher?.ID)))?.ToList();
            }

            if (!string.IsNullOrEmpty(base.SelectCourse?.ID))
            {
                source = source.Where(s => s.CourseID.Equals(base.SelectCourse?.ID))?.ToList();
            }

            if (!string.IsNullOrEmpty(base.SelectClass?.ID))
            {
                source = source.Where(s => s.ClassID.Equals(base.SelectClass?.ID))?.ToList();
            }

            FirstHours  = source;
            SecondHours = source;
            ThirdHours  = source;

            SelectFirstHour  = FirstHours?.FirstOrDefault();
            SelectSecondHour = SecondHours?.FirstOrDefault();

            if (_timeRule == AdministrativeAlgoRuleEnum.ThreeClassHoursGrouped)
            {
                this.SelectThirdHour = SelectThirdHour = ThirdHours?.FirstOrDefault();
            }
        }
        public override void Search()
        {
            var source = this.Sources?.ToList();

            if (!string.IsNullOrEmpty(base.SelectMixedTeacher?.ID))
            {
                source = source.Where(s => s.Teachers.Any(t => t.ID.Equals(base.SelectMixedTeacher?.ID)))?.ToList();
            }

            if (!string.IsNullOrEmpty(base.SelectMixedCourse?.ID))
            {
                source = source.Where(s => s.CourseID.Equals(base.SelectMixedCourse?.ID))?.ToList();
            }

            if (!string.IsNullOrEmpty(base.SelectMixedClass?.ID))
            {
                source = source.Where(s => s.ClassID.Equals(base.SelectMixedClass?.ID))?.ToList();
            }

            if (!string.IsNullOrEmpty(base.SelectMixedTag?.ID))
            {
                source = source.Where(s =>
                {
                    if (s.Tags == null)
                    {
                        return(false);
                    }
                    else
                    {
                        return(s.Tags.Contains(base.SelectMixedTag?.ID));
                    }
                })?.ToList();
            }

            FirstHours  = source;
            SecondHours = source;
            ThirdHours  = source;

            SelectFirstHour  = FirstHours?.FirstOrDefault();
            SelectSecondHour = SecondHours?.FirstOrDefault();

            if (_timeRule == MixedAlgoRuleEnum.ThreeClassHoursGrouped)
            {
                this.SelectThirdHour = SelectThirdHour = ThirdHours?.FirstOrDefault();
            }
        }