Exemple #1
0
        /// <summary>
        /// 列表
        /// </summary>
        /// <param name="searchSetting"></param>
        /// <returns></returns>
        public static IPageOfList <CompanyProductInfo> List(CompanyProductSearchSetting searchSetting)
        {
            FastPaging fp = new FastPaging();

            fp.OverOrderBy = " CP.PublishDateTime DESC";
            fp.PageIndex   = searchSetting.PageIndex;
            fp.PageSize    = searchSetting.PageSize;
            fp.QueryFields = "*";
            fp.TableName   = "CompanyProducts";
            fp.PrimaryKey  = "Id";
            fp.TableReName = "CP";
            fp.WithOptions = " WITH(NOLOCK)";
            fp.Condition   = " IsDeleted = 0 ";
            if (searchSetting.CompanyId > 0)
            {
                fp.Condition += string.Format(" AND CompanyId = {0}", searchSetting.CompanyId);
            }
            if (searchSetting.CategoryId > 0)
            {
                fp.Condition += string.Format(" AND CategoryId = {0}", searchSetting.CategoryId);
            }
            if (searchSetting.SystemCategoryId > 0)
            {
                fp.Condition += string.Format(" AND SystemCategoryId = {0}", searchSetting.SystemCategoryId);
            }

            IList <CompanyProductInfo> list  = new List <CompanyProductInfo>();
            CompanyProductInfo         model = null;
            DataTable dt = SQLPlus.ExecuteDataTable(CommandType.Text, fp.Build2005());

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    model = GetByDataRow(dr);
                    if (model != null)
                    {
                        list.Add(model);
                    }
                }
            }
            int count = Convert.ToInt32(SQLPlus.ExecuteScalar(CommandType.Text, fp.BuildCountSQL()));

            return(new PageOfList <CompanyProductInfo>(list, searchSetting.PageIndex, searchSetting.PageSize, count));
        }
Exemple #2
0
 /// <summary>
 /// 产品列表
 /// </summary>
 /// <param name="searchSetting"></param>
 /// <returns></returns>
 public static IPageOfList <CompanyProductInfo> List(CompanyProductSearchSetting searchSetting)
 {
     return(CompanyProductManage.List(searchSetting));
 }