Ejemplo n.º 1
0
        /// <summary>
        /// 首页
        /// </summary>
        /// <returns></returns>
        public ActionResult Catalog(string key, int?page)
        {
            var model = new QrcodeListModel
            {
                Key       = key,
                PageIndex = page.HasValue ? page.Value : 0
            };

            model.Catalogs = GetCatalogs(model);
            return(View(GetViewPath("~/Views/Qrcode/_Catalog.cshtml"), model));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到类目
        /// </summary>
        /// <returns></returns>
        protected virtual IList <CatalogEntity> GetCatalogs(QrcodeListModel model)
        {
            var query = new QueryInfo();

            query.SetPageIndex(model.PageIndex).SetPageSize(model.PageSize).Query <CatalogEntity>().Where(it => it.Site.Id == SiteId).Select(it => new object[] { it.Id, it.Name, it.FileName });
            if (!string.IsNullOrEmpty(model.Key))
            {
                query.Where(string.Format("{0} && Name.Contains(@Name)", query.WhereExp))
                .SetParameter("Name", model.Key);
            }
            return(this.GetEntities <CatalogEntity>(query));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 得到类目
        /// </summary>
        /// <returns></returns>
        protected virtual IList <CommodityEntity> GetCommodities(QrcodeListModel model)
        {
            var query = new QueryInfo {
                IsReturnCount = false
            };

            query.SetPageIndex(model.PageIndex).SetPageSize(model.PageSize).Query <CommodityEntity>()
            .Where(it => it.Site.Id == SiteId && it.Status == CommodityStatusType.Normal)
            .Select(it => new object[] { it.Id, it.Name, it.FileName });
            if (!string.IsNullOrEmpty(model.Key))
            {
                query.Where(string.Format("{0} && (Name.Contains(@Key) || Description.Contains(@Key))", query.WhereExp))
                .SetParameter("Key", model.Key);
            }
            return(this.GetEntities <CommodityEntity>(query));
        }