コード例 #1
0
 public static List <CATEGORIES_DTO> GetAllCategories()
 {
     using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities())
     {
         var categoriesList = CategoryCRUD.GetAllCategories(ctx);
         List <CATEGORIES_DTO> categories = new List <CATEGORIES_DTO>();
         foreach (var category in categoriesList)
         {
             categories.Add(CATEGORIES_Casting.CastToDTO(category));
         }
         return(categories);
     }
 }
コード例 #2
0
        public static List <CATEGORIES_DTO> GetAllSubCategory(int id)
        {
            using (HMO_PROGECTEntities ctx = new HMO_PROGECTEntities())
            {
                var categoriesList  = CategoryCRUD.GetAllCategories(ctx);
                var subCategoryList = categoriesList.Where(u => u.parentCategory == id).ToList();
                List <CATEGORIES_DTO> categories = new List <CATEGORIES_DTO>();

                foreach (var category in subCategoryList)
                {
                    categories.Add(CATEGORIES_Casting.CastToDTO(category));
                }
                return(categories);
            }
        }
コード例 #3
0
        public static List <CategoryTreeItem> GetCategoryTree()
        {
            using (var ctx = new checkTestEntities1())
            {
                var categoriesList = CategoryCRUD.GetAllCategories(ctx);
                List <CategoryTreeItem> categoryTreeList = new List <CategoryTreeItem>();
                categoryTreeList.Add(new CategoryTreeItem()
                {
                    id       = 0,
                    name     = "all",
                    children = new List <CategoryTreeItem>()
                });

                GetAllCategortTree(categoriesList, null, categoryTreeList[0]);
                return(categoryTreeList);
            }
        }
コード例 #4
0
        /// <summary>
        ///פונקציה המחזירה עץ המורכב מכל הקטגוריות
        /// </summary>
        /// <returns></returns>
        public static List <CategoryTreeItem> GetCategoryTree()
        {
            using (var ctx = new testitprojectEntities())
            {
                var categoriesList = CategoryCRUD.GetAllCategories(ctx);
                List <CategoryTreeItem> categoryTreeList = new List <CategoryTreeItem>();
                categoryTreeList.Add(new CategoryTreeItem()
                {
                    id       = 0,
                    name     = "all",
                    children = new List <CategoryTreeItem>()
                });

                GetAllCategortTree(categoriesList, null, categoryTreeList[0]);
                if (categoryTreeList[0].children.Count > 0)
                {
                    return(categoryTreeList[0].children);
                }
                return(new List <CategoryTreeItem>());
            }
        }