Ejemplo n.º 1
0
        /// <summary>
        /// The get all paged.
        /// </summary>
        /// <param name="pageIndex">
        /// The page index.
        /// </param>
        /// <param name="pageSize">
        /// The page items.
        /// </param>
        /// <param name="totalCount">
        /// The total Count.
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable{Distractor}"/>.
        /// </returns>
        public IEnumerable <Distractor> GetAllPaged(int pageIndex, int pageSize, out int totalCount)
        {
            var queryOver     = new DefaultQueryOver <Distractor, int>().GetQueryOver();
            var rowCountQuery = queryOver.ToRowCountQuery();

            totalCount = this.Repository.FindOne <int>(rowCountQuery).Value;
            var pagedQuery = queryOver.Fetch(x => x.Image).Eager.Fetch(x => x.LeftImage).Eager.Fetch(x => x.RightImage).Eager.Take(pageSize).Skip((pageIndex - 1) * pageSize);

            return(this.Repository.FindAll(pagedQuery));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The get all paged.
        /// </summary>
        /// <param name="pageIndex">
        /// The page index.
        /// </param>
        /// <param name="pageSize">
        /// The page items.
        /// </param>
        /// <param name="totalCount">
        /// The total Count.
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable{SubModuleItem}"/>.
        /// </returns>
        public IEnumerable <SubModuleItem> GetAllPaged(int pageIndex, int pageSize, out int totalCount)
        {
            var queryOver     = new DefaultQueryOver <SubModuleItem, int>().GetQueryOver();
            var rowCountQuery = queryOver.ToRowCountQuery();

            totalCount = this.Repository.FindOne <int>(rowCountQuery).Value;
            var pagedQuery = queryOver.Fetch(x => x.SubModuleCategory).Eager.Take(pageSize).Skip((pageIndex - 1) * pageSize);

            return(this.Repository.FindAll(pagedQuery));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// The get all paged.
        /// </summary>
        /// <param name="pageIndex">
        /// The page index.
        /// </param>
        /// <param name="pageSize">
        /// The page items.
        /// </param>
        /// <param name="totalCount">
        /// The total Count.
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable{Question}"/>.
        /// </returns>
        public IEnumerable <Question> GetAllPaged(int pageIndex, int pageSize, out int totalCount)
        {
            var queryOver     = new DefaultQueryOver <Question, int>().GetQueryOver().Where(x => x.IsActive == true);
            var rowCountQuery = queryOver.ToRowCountQuery();

            totalCount = this.Repository.FindOne <int>(rowCountQuery).Value;
            var pagedQuery = queryOver.Fetch(x => x.Image).Eager.Take(pageSize).Skip((pageIndex - 1) * pageSize);

            return(this.Repository.FindAll(pagedQuery));
        }
Ejemplo n.º 4
0
        ///// <summary>
        ///// Gets one by domain
        ///// </summary>
        ///// <param name="domain">
        ///// The domain
        ///// </param>
        ///// <returns>
        ///// The canvas ac meeting
        ///// </returns>
        //public IFutureValue<LmsCompany> GetOneByDomain(string domain)
        //{
        //    var defaultQuery = new DefaultQueryOver<LmsCompany, int>().GetQueryOver()
        //        .Where(x => x.LmsDomain == domain).Take(1);
        //    return this.Repository.FindOne(defaultQuery);
        //}

        //public IFutureValue<LmsCompany> GetOneByAcDomain(string adobeConnectDomain)
        //{
        //    if (adobeConnectDomain.EndsWith("/"))
        //    {
        //        adobeConnectDomain = adobeConnectDomain.Remove(adobeConnectDomain.Length - 1);
        //    }
        //    var defaultQuery = new DefaultQueryOver<LmsCompany, int>().GetQueryOver()
        //        .WhereRestrictionOn(x => x.AcServer).IsInsensitiveLike(adobeConnectDomain, MatchMode.Start)
        //        .Take(1);
        //    return this.Repository.FindOne(defaultQuery);
        //}

        //public IFutureValue<LmsCompany> GetOneByProviderAndConsumerKey(int lmsProviderId, string consumerKey)
        //{
        //    var defaultQuery = new DefaultQueryOver<LmsCompany, int>().GetQueryOver()
        //        .Fetch(x => x.Settings).Eager
        //        .Where(x => (x.ConsumerKey == consumerKey && x.LmsProviderId == lmsProviderId));
        //    return this.Repository.FindOne(defaultQuery);
        //}

        public IFutureValue <LmsCompany> GetOneByConsumerKey(string consumerKey, bool includeSettings = false)
        {
            var defaultQuery = new DefaultQueryOver <LmsCompany, int>().GetQueryOver();

            if (includeSettings)
            {
                defaultQuery = defaultQuery.Fetch(x => x.Settings).Eager;
            }
            defaultQuery = defaultQuery.Where(x => (x.ConsumerKey == consumerKey));
            return(this.Repository.FindOne(defaultQuery));
        }