Beispiel #1
0
        public List <LmsCompany> GetEnabledForSynchronization(string consumerKey = null)
        {
            LmsCompany               lc  = null;
            LmsCompanySetting        lcs = null;
            OfficeHours              oh  = null;
            IList <LmsCourseMeeting> lcm = null;
            //IList<LmsUserMeetingRole> lumr = null;
            //IList<LmsUser> lu = null;
            //LmsUser u = null;
            var defaultQuery = new DefaultQueryOver <LmsCompany, int>()
                               .GetQueryOver(() => lc)
                               .Where(x => x.IsActive);

            if (!string.IsNullOrEmpty(consumerKey))
            {
                defaultQuery = defaultQuery.Where(x => x.ConsumerKey == consumerKey);
            }
            defaultQuery = defaultQuery
                           .JoinAlias(() => lc.Settings, () => lcs)
                           .Where(() => lcs.Name == LmsLicenseSettingNames.UseSynchronizedUsers && lcs.Value == "True")
                           .JoinAlias(() => lc.LmsCourseMeetings, () => lcm)
                           .JoinAlias(() => lcm.First().OfficeHours, () => oh, JoinType.LeftOuterJoin)
//                .JoinAlias(() => lcm.First().MeetingRoles, () => lumr)
//                .Fetch(x => x.Settings).Eager
                           .Fetch(x => x.LmsCourseMeetings).Eager
                           .Fetch(x => x.LmsCourseMeetings.First().OfficeHours).Eager
//                .Fetch(x => x.LmsCourseMeetings.First().MeetingRoles).Eager
                           .Fetch(x => x.AdminUser).Eager
                           .TransformUsing(Transformers.DistinctRootEntity);
            return(this.Repository.FindAll(defaultQuery).ToList());
        }