public FlutterCategoryModel getProductNew(FlutterCategoryModel productSale = null) { // Khởi tạo hàng mới về var productNews = new FlutterCategoryModel() { name = "Hàng mới về", icon = "/assets/images/categories/new-product.png", description = "Tất cả hàng mới về", filter = new FlutterProductFilterModel() { productSort = (int)ProductSortKind.ProductNew }, children = new List <FlutterCategoryModel>() }; // Hàng có sẵn mới về var productStockInNews = new FlutterCategoryModel() { name = "Hàng có sẵn mới về", icon = "/assets/images/categories/new-product.png", description = "Hàng có sẵn ở kho", filter = new FlutterProductFilterModel() { productBadge = (int)ProductBadge.stockIn, productSort = (int)ProductSortKind.ProductNew } }; if (productStockInNews != null) { productNews.children.Add(productStockInNews); } // Hàng order mới về var productOrderNews = new FlutterCategoryModel() { name = "Hàng order mới về", icon = "/assets/images/categories/order-product.png", description = "Không có sẵn ở kho", filter = new FlutterProductFilterModel() { productBadge = (int)ProductBadge.order, productSort = (int)ProductSortKind.ProductNew } }; if (productOrderNews != null) { productNews.children.Add(productOrderNews); } // Hàng sale if (productSale != null) { productNews.children.Add(productSale); } return(productNews); }
/// <summary> /// Khởi tạo category cho block product /// </summary> /// <param name="slug"></param> /// <returns></returns> public FlutterCategoryModel createCategoryBlockProduct(string slug) { using (var con = new inventorymanagementEntities()) { var parent = con.tbl_Category .Where(x => (!String.IsNullOrEmpty(slug) && x.Slug == slug) || (String.IsNullOrEmpty(slug) && x.CategoryLevel == 0) ) .Select(x => new { id = x.ID, name = x.CategoryName, slug = x.Slug, icon = x.Icon, description = x.CategoryDescription }) .FirstOrDefault(); if (parent != null) { var children = con.tbl_Category .Where(x => x.ParentID == parent.id) .OrderBy(o => o.ID) .Select(x => new FlutterCategoryModel() { name = x.CategoryName, icon = x.Icon, description = x.CategoryDescription, filter = new FlutterProductFilterModel() { categorySlug = x.Slug, productSort = (int)ProductSortKind.ProductNew } }) .ToList(); var result = new FlutterCategoryModel() { name = parent.name, icon = parent.icon, description = parent.description, filter = new FlutterProductFilterModel() { categorySlug = parent.slug, productSort = (int)ProductSortKind.ProductNew }, children = children.Count > 0 ? children : null }; return(result); } return(null); } }
public FlutterCategoryModel getProductSale(FlutterCategoryModel womenClothes = null, FlutterCategoryModel menClothes = null) { if (womenClothes != null) { womenClothes = getWomenClothes(); } if (menClothes != null) { menClothes = getMenClothes(); } var productSale = new FlutterCategoryModel() { name = "Hàng sale", icon = "/assets/images/categories/sale-product.png", description = "Tất cả hàng sale", filter = new FlutterProductFilterModel() { productBadge = (int)ProductBadge.sale, productSort = (int)ProductSortKind.ProductNew }, children = new List <FlutterCategoryModel>() }; // Quần áo nữ sale if (womenClothes != null) { var womenClothesSale = (FlutterCategoryModel)womenClothes.Clone(); womenClothesSale.name = "Hàng nữ sale"; womenClothesSale.icon = "/assets/images/categories/category-18.jpg"; womenClothesSale.description = "Tất cả quần áo nữ sale"; womenClothesSale.filter.productBadge = (int)ProductBadge.sale; productSale.children.Add(womenClothesSale); } // Quần áo nam sale if (menClothes != null) { var menClothesSale = (FlutterCategoryModel)menClothes.Clone(); menClothesSale.name = "Hàng nam sale"; menClothesSale.icon = "/assets/images/categories/category-2.jpg"; menClothesSale.description = "Tất cả quần áo nam sale"; menClothesSale.filter.productBadge = (int)ProductBadge.sale; productSale.children.Add(menClothesSale); } return(productSale); }
/// <summary> /// Khởi tạo một danh mục từ danh sách slug /// </summary> /// <param name="title"></param> /// <param name="slugs"></param> /// <returns></returns> public FlutterCategoryModel createCategoryBySlugs(string title, List <string> slugs) { var result = new FlutterCategoryModel() { name = title, icon = String.Empty, description = String.Empty, filter = new FlutterProductFilterModel() { categorySlugList = slugs, productSort = (int)ProductSortKind.ProductNew }, }; // Tạo category con var children = new List <FlutterCategoryModel>(); foreach (var item in slugs) { var child = createCategoryBlockProduct(item); if (child != null) { children.Add(new FlutterCategoryModel() { name = child.name, icon = child.icon, description = child.description, filter = new FlutterProductFilterModel() { categorySlug = child.filter.categorySlug, productSort = (int)ProductSortKind.ProductNew } }); } } if (children.Count > 0) { result.children = children; } return(result); }
public List <FlutterCategoryModel> getHotKey() { var result = new List <FlutterCategoryModel>(); // Nước rửa tay //var key03 = new FlutterCategoryModel() //{ // name = "nước rửa tay khô", // filter = new FlutterProductFilterModel() // { // productSKU = "XIT", // productSort = (int)ProductSortKind.ProductNew // } //}; //result.Add(key03); // Mỹ phẩm var cosmetic = new FlutterCategoryModel() { name = "mỹ phẩm", filter = new FlutterProductFilterModel() { categorySlug = "my-pham", productSort = (int)ProductSortKind.ProductNew } }; result.Add(cosmetic); // Đồ bộ nữ var key01 = new FlutterCategoryModel() { name = "đồ bộ nữ", filter = new FlutterProductFilterModel() { categorySlug = "do-bo-nu", productSort = (int)ProductSortKind.ProductNew } }; result.Add(key01); // Váy đầm var key02 = new FlutterCategoryModel() { name = "váy đầm", filter = new FlutterProductFilterModel() { categorySlug = "vay-dam", productSort = (int)ProductSortKind.ProductNew } }; result.Add(key02); // Nước hoa var perfume = new FlutterCategoryModel() { name = "nước hoa", filter = new FlutterProductFilterModel() { categorySlug = "nuoc-hoa", productSort = (int)ProductSortKind.ProductNew } }; result.Add(perfume); // Áo thun nam var menTShirt = new FlutterCategoryModel() { name = "áo thun nam", filter = new FlutterProductFilterModel() { categorySlug = "ao-thun-nam", productSort = (int)ProductSortKind.ProductNew } }; result.Add(menTShirt); // Áo thun nữ var womenTShirt = new FlutterCategoryModel() { name = "áo thun nữ", filter = new FlutterProductFilterModel() { categorySlug = "ao-thun-nu", productSort = (int)ProductSortKind.ProductNew } }; result.Add(womenTShirt); // Quần Jean Nam var menJean = new FlutterCategoryModel() { name = "quần jean nam", filter = new FlutterProductFilterModel() { categorySlug = "quan-jeans-nam", productSort = (int)ProductSortKind.ProductNew } }; result.Add(menJean); // Quần áo nữ bigsize var key05 = new FlutterCategoryModel() { name = "đồ nữ big size", filter = new FlutterProductFilterModel() { tagSlug = "quan-ao-nu-big-size", productSort = (int)ProductSortKind.ProductNew } }; result.Add(key05); // kem body mềm chữ A var key07 = new FlutterCategoryModel() { name = "kem body mềm A", filter = new FlutterProductFilterModel() { productSKU = "BDA110", productSort = (int)ProductSortKind.ProductNew } }; result.Add(key07); // kem body x3 var key06 = new FlutterCategoryModel() { name = "kem body collagen x3", filter = new FlutterProductFilterModel() { productSKU = "BODY", productSort = (int)ProductSortKind.ProductNew } }; result.Add(key06); // kích trắng x3 var key09 = new FlutterCategoryModel() { name = "kích trắng x3", filter = new FlutterProductFilterModel() { productSKU = "KICHX3", productSort = (int)ProductSortKind.ProductNew } }; result.Add(key09); // cà phê sâm var key08 = new FlutterCategoryModel() { name = "cà phê sâm", filter = new FlutterProductFilterModel() { productSKU = "CAFE SAM", productSort = (int)ProductSortKind.ProductNew } }; result.Add(key08); // cần tây mật ong var key10 = new FlutterCategoryModel() { name = "cần tây mật ong", filter = new FlutterProductFilterModel() { productSKU = "CTAY125", productSort = (int)ProductSortKind.ProductNew } }; result.Add(key10); return(result); }