Beispiel #1
0
        public List <string> GetCourseTCListForTotalSection(int sectionId)
        {
            var sectionIds = _.List(sectionId)
                             .AddFluent(SectionService.GetChildren(sectionId).Select(x => x.Section_ID));

            return(CourseService.GetCourseTCListForSections(sectionIds));
        }
Beispiel #2
0
        private IEnumerable <Grouping <Section, string> > GetSectionWithCourses()
        {
            var rootSections =
                SectionService.GetSectionsTree();

            return(rootSections.Select(s => Grouping.New(s,
                                                         CourseService.GetCourseTCListForSections(_.List(s.Section_ID)
                                                                                                  .AddFluent(s.SubSections.Select(x => x.Section_ID))))));
        }
Beispiel #3
0
        public GroupListVM GetAllGroups(GroupFilter filter, int pageIndex)
        {
            var cityTC         = UserSettingsService.CityTC;
            var leftBeginDate  = filter.BeginDate;
            var rightBeginDate = filter.EndDate;
            var courseTCs      = new List <string>();

            if (!filter.CourseTC.IsEmpty())
            {
                courseTCs.Add(filter.CourseTC);
            }
            else
            {
                if (filter.SectionId.HasValue)
                {
                    var mainSection =
                        SectionService.GetSectionsTree()
                        .FirstOrDefault(x => x.Section_ID
                                        == filter.SectionId.Value);
                    var sectionIds = new List <int>();
                    if (mainSection != null && mainSection.SubSections.Any())
                    {
                        sectionIds = mainSection.SubSections.Select(x => x.Section_ID).ToList();
                    }
                    else
                    {
                        sectionIds.Add(filter.SectionId.Value);
                    }
                    courseTCs.AddRange(CourseService.GetCourseTCListForSections(sectionIds));
                }
            }
            var groupQuery = GroupService.GetGroupsForCourse(courseTCs,
                                                             cityTC, leftBeginDate, rightBeginDate, filter.DayShiftTC, filter.ComplexTC,
                                                             filter.DaySequenceTC);

            switch (filter.StudyTypeId)
            {
            case GroupFilter.StudyType.Intramural:
                groupQuery = groupQuery.Where(x => !x.ForWebinarOnly);
                break;

            case GroupFilter.StudyType.Webinar:
                groupQuery = groupQuery.Where(x => x.WebinarExists);
                break;

            case GroupFilter.StudyType.OpenLearning:
                groupQuery = groupQuery.Where(x => x.MegaGroup_ID != null);
                break;

            case GroupFilter.StudyType.IntraExtra:
                groupQuery = groupQuery.Where(x => x.IsIntraExtramural);
                break;
            }
            if (!filter.EmployeeTC.IsEmpty())
            {
                groupQuery = groupQuery.Where(x => x.Teacher_TC == filter.EmployeeTC);
            }
            groupQuery = groupQuery.NotSpecial();
            var groups = groupQuery.ToPagedList(pageIndex);
            var result =
                new GroupListVM {
                Groups = groups,
                Filter = filter,
            };

            if (!filter.CourseTC.IsEmpty())
            {
                var course = CourseService.GetByPK(filter.CourseTC);
                filter.CourseName = course.GetOrDefault(x => x.Name);
                result.Course     = course;
            }


            return(result);
        }