Esempio n. 1
0
        /// <summary>
        /// 根据首层分类ID获取最底层即第三次分类数据
        /// </summary>
        /// <param name="categoryId"></param>
        /// <param name="maxNum"></param>
        /// <returns></returns>
        public static IList <CategoryInfo> GetThirdCategoriesById(int categoryId, int maxNum = 1000)
        {
            IList <CategoryInfo> list       = new List <CategoryInfo>();
            DataTable            categories = CategoryBrowser.GetCategories();

            DataRow[] array    = categories.Select("CategoryId = " + categoryId);
            int       parentId = 0;

            if (array.Length > 0)
            {
                int.TryParse(array[0]["ParentCategoryId"].ToString(), out parentId);
                if (parentId != 0)
                {
                    DataRow[] array1 = categories.Select("ParentCategoryId = " + parentId);
                    int       num    = 0;
                    while (num < maxNum && num < array1.Length)
                    {
                        if (array1[num]["CategoryId"].ToString() == categoryId.ToString())
                        {
                            num++;
                            continue;
                        }
                        list.Add(DataMapper.ConvertDataRowToProductCategory(array1[num]));
                        num++;
                    }
                }
            }
            return(list);
        }
Esempio n. 2
0
        public static IList <CategoryInfo> GetCategoryiesBySupplierId(int supplierId)
        {
            IList <CategoryInfo> list         = new List <CategoryInfo>();
            DataTable            dtcategories = CategoryBrowser.GetDataCacheCategoriesBySupplierId(supplierId);

            DataRow[] array = dtcategories.Select(" 1 = 1");
            for (int i = 0; i < array.Length; i++)
            {
                list.Add(DataMapper.ConvertDataRowToProductCategory(array[i]));
            }
            return(list);
        }
Esempio n. 3
0
        public static IList <CategoryInfo> GetMainCategories()
        {
            IList <CategoryInfo> list       = new List <CategoryInfo>();
            DataTable            categories = CategoryBrowser.GetCategories(0);

            DataRow[] array = categories.Select("Depth = 1");
            for (int i = 0; i < array.Length; i++)
            {
                list.Add(DataMapper.ConvertDataRowToProductCategory(array[i]));
            }
            return(list);
        }
Esempio n. 4
0
        public static IList <CategoryInfo> GetSequenceCategories()
        {
            IList <CategoryInfo> list           = new List <CategoryInfo>();
            IList <CategoryInfo> mainCategories = CategoryBrowser.GetMainCategories();

            foreach (CategoryInfo current in mainCategories)
            {
                list.Add(current);
                CategoryBrowser.LoadSubCategorys(current.CategoryId, list);
            }
            return(list);
        }
Esempio n. 5
0
        public static IList <CategoryInfo> GetSubCategories(int parentCategoryId)
        {
            IList <CategoryInfo> list  = new List <CategoryInfo>();
            string    filterExpression = "ParentCategoryId = " + parentCategoryId.ToString(CultureInfo.InvariantCulture);
            DataTable categories       = CategoryBrowser.GetCategories(0);

            DataRow[] array = categories.Select(filterExpression);
            for (int i = 0; i < array.Length; i++)
            {
                list.Add(DataMapper.ConvertDataRowToProductCategory(array[i]));
            }
            return(list);
        }
Esempio n. 6
0
        private static void LoadSubCategorys(int parentCategoryId, IList <CategoryInfo> categories)
        {
            IList <CategoryInfo> subCategories = CategoryBrowser.GetSubCategories(parentCategoryId);

            if (subCategories != null && subCategories.Count > 0)
            {
                foreach (CategoryInfo current in subCategories)
                {
                    categories.Add(current);
                    CategoryBrowser.LoadSubCategorys(current.CategoryId, categories);
                }
            }
        }
Esempio n. 7
0
        public static IList <CategoryInfo> GetMaxMainCategories(int maxNum = 1000)
        {
            IList <CategoryInfo> list       = new List <CategoryInfo>();
            DataTable            categories = CategoryBrowser.GetCategories();

            DataRow[] array = categories.Select("Depth = 1");
            int       num   = 0;

            while (num < maxNum && num < array.Length)
            {
                list.Add(DataMapper.ConvertDataRowToProductCategory(array[num]));
                num++;
            }
            return(list);
        }
Esempio n. 8
0
        public static IList <CategoryInfo> GetMaxSubCategories(int parentCategoryId, int isDisable, int maxNum = 1000)
        {
            IList <CategoryInfo> list       = new List <CategoryInfo>();
            DataTable            categories = CategoryBrowser.GetCategories(isDisable);

            DataRow[] array = categories.Select("ParentCategoryId = " + parentCategoryId);
            int       num   = 0;

            while (num < maxNum && num < array.Length)
            {
                list.Add(DataMapper.ConvertDataRowToProductCategory(array[num]));
                num++;
            }
            return(list);
        }