티스토리 뷰

728x90
반응형

 IList<DiscountCategoryEntity> IDiscountMall.DiscountCategoryList(string area)

        {

            Dictionary<string, string> param = new Dictionary<string, string>();

            param.Add("area", area);


            List<DiscountCategoryEntity> discountCategory = new List<DiscountCategoryEntity>();

            IList<DiscountCategoryEntityL> discountCategoryList = this.totooutdoor.QueryForList<DiscountCategoryEntityL>("up_st_tto_t_goods_recom_discountCategoryList_select", param);


            foreach (DiscountCategoryEntityL item in discountCategoryList)

            {

                int categoryIndex = discountCategory.FindIndex(

                    delegate(DiscountCategoryEntity discountCategoryEntity) { if (discountCategoryEntity.CategoryNameDepth1 == item.top_name) { return true; } else { return false; } }

                );


                if (categoryIndex == -1)

                {

                    discountCategory.Add(

                        new DiscountCategoryEntity() { CategoryNameDepth1 = item.top_name }

                    );

                }


                categoryIndex = discountCategory.FindIndex(

                    delegate(DiscountCategoryEntity discountCategoryEntity) { if (discountCategoryEntity.CategoryNameDepth1 == item.top_name) { return true; } else { return false; } }

                );


                if (categoryIndex != -1)

                {

                    List<DiscountCategoryDetailEntityR> temp = discountCategory[categoryIndex].DicountCategoryDetail;

                    if (temp == null) { temp = new List<DiscountCategoryDetailEntityR>(); }


                    temp.Add(new DiscountCategoryDetailEntityR() { CategoryName = item.catecode_name, CategoryCodeDepth2 = item.catecode });

                    discountCategory[categoryIndex].DicountCategoryDetail = temp;

                }

            }


            return discountCategory;

        }

728x90
반응형