Пример #1
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="pageIndex">起始页</param>
        /// <param name="pageSize">每页数量</param>
        /// <param name="ids">类别系统号集合</param>
        /// <param name="searchStaus">状态</param>
        /// <param name="searchName">文章标题名称</param>
        /// <param name="count">总条数</param>
        /// <returns>文章列表</returns>
        /// <remarks>2013-06-17 杨晗 创建</remarks>
        public override IList <CBFeArticle> Seach(ParaArticleFilter filter, out int count)
        {
            #region sql条件
            var sqlWhere = "1=1";

            //判断是否绑定所有分销商
            if (!filter.IsBindAllDealer)
            {
                //判断是否绑定分销商
                if (filter.IsBindDealer)
                {
                    sqlWhere += " and d.SysNo = @DealerSysNo";
                }
                else
                {
                    sqlWhere += " and d.CreatedBy = @DealerCreatedBy";
                }
            }
            if (filter.SelectedDealerSysNo != -1)
            {
                sqlWhere += " and d.SysNo = " + filter.SelectedDealerSysNo;
            }
            string sql = @"(@title is null or ft.title like @title1) and (ft.categorysysno in {0})  
                        and (@Status=0 or ft.Status =@Status1) and " + sqlWhere;

            #endregion

            if (!filter.ids.Any())
            {
                filter.ids.Add(0);
            }
            sql   = string.Format(sql, "(" + string.Join(",", filter.ids) + ")");
            count = Context.Select <int>("count(1)")
                    .From("fearticle ft left join DsDealer d on ft.DealerSysNo = d.SysNo")
                    .Where(sql)
                    .Parameter("title", filter.searchName)
                    .Parameter("title1", "%" + filter.searchName + "%")
                    .Parameter("Status", filter.searchStaus)
                    .Parameter("Status1", filter.searchStaus)
                    .Parameter("DealerSysNo", filter.DealerSysNo)
                    .Parameter("DealerCreatedBy", filter.DealerCreatedBy)
                    .QuerySingle();
            //.OrderBy("ft.lastupdatedate desc").QuerySingle();

            var countBuilder =
                Context.Select <CBFeArticle>(
                    "ft.*, (select username from syuser where sysno=ft.createdby) as createdbyname,(select username from syuser where sysno=ft.lastupdateby) as lastupdatebyname,d.DealerName")
                .From("fearticle ft left join DsDealer d on ft.DealerSysNo = d.SysNo")
                .Where(sql)
                .Parameter("title", filter.searchName)
                .Parameter("title1", "%" + filter.searchName + "%")
                .Parameter("Status", filter.searchStaus)
                .Parameter("Status1", filter.searchStaus)
                .Parameter("DealerSysNo", filter.DealerSysNo)
                .Parameter("DealerCreatedBy", filter.DealerCreatedBy)
                .Paging((int)filter.pageIndex, filter.pageSize).OrderBy("ft.lastupdatedate desc").QueryMany();
            return(countBuilder);
        }
Пример #2
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="pageIndex">起始页</param>
        /// <param name="ids">类别系统号集合</param>
        /// <param name="searchStaus">状态</param>
        /// <param name="searchName">文章标题名称</param>
        /// <returns>文章列表</returns>
        /// <remarks>2013-06-17 杨晗 创建</remarks>
        public PagedList <CBFeArticle> Seach(ParaArticleFilter filter)
        {
            filter.pageIndex   = filter.pageIndex ?? 1;
            filter.searchStaus = filter.searchStaus ?? 0;
            var model = new PagedList <CBFeArticle>();

            filter.pageSize = model.PageSize;
            int count;
            var list = IFeArticleDao.Instance.Seach(filter, out count);

            model.TData            = list;
            model.TotalItemCount   = count;
            model.CurrentPageIndex = (int)filter.pageIndex;
            return(model);
        }
Пример #3
0
        public ActionResult CompanyPostSeach(int id)
        {
            var ids = new List <int>();

            ids.Add(3);//Fearticlecategory系统编号

            var filter = new ParaArticleFilter {
                pageIndex = id, ids = ids, searchStaus = (int)ForeStatus.文章状态.已审, searchName = "", SelectedDealerSysNo = -1
            };

            //当前用户对应分销商,2015-12-19 王耀发 创建
            if (CurrentUser.IsBindDealer)
            {
                int DealerSysNo = CurrentUser.Dealer.SysNo;
                filter.DealerSysNo  = DealerSysNo;
                filter.IsBindDealer = CurrentUser.IsBindDealer;
            }
            //是否绑定所有经销商
            filter.IsBindAllDealer = CurrentUser.IsBindAllDealer;
            filter.DealerCreatedBy = CurrentUser.Base.SysNo;
            var model = FeArticleBo.Instance.Seach(filter);

            return(PartialView("_CompanyPost", model));
        }
Пример #4
0
 /// <summary>
 /// 分页查询
 /// </summary>
 /// <param name="pageIndex">起始页</param>
 /// <param name="pageSize">每页数量</param>
 /// <param name="ids">类别系统号集合</param>
 /// <param name="searchStaus">状态</param>
 /// <param name="searchName">文章标题名称</param>
 /// <param name="count">总条数</param>
 /// <returns>文章列表</returns>
 /// <remarks>2013-06-17 杨晗 创建</remarks>
 public abstract IList <CBFeArticle> Seach(ParaArticleFilter filter, out int count);