public JsonResult ProductTreeview(bool?IsSection, string ProductGuid) { shProductService _product = new shProductService(); shProduct product = _product.FindByKey(ProductGuid); if (!IsSection.HasValue) { IsSection = false; } if (product == null) { product = new shProduct(); } TreeView tongthe = new TreeView(); tongthe.name = product.ProductName; tongthe.id = product.ProductGuid; tongthe.pId = null; tongthe.open = true; tongthe.isParent = true; tongthe.click = "shProduct('" + product.ProductGuid + "', '', '', '0')"; tongthe.children = GetProductTreeview(IsSection.Value, ProductGuid); return(Json(tongthe, JsonRequestBehavior.AllowGet)); }
public ActionResult dsProduct(string ProductAdd) { List <shProduct> ds = new List <shProduct>(); shProduct product = new shProduct(); shProductService _product = new shProductService(); if (!string.IsNullOrEmpty(ProductAdd) || !string.IsNullOrWhiteSpace(ProductAdd)) { string[] dsProduct = ProductAdd.Split(';'); if (dsProduct != null) { foreach (var child in dsProduct) { product = _product.FindByKey(child); if (product != null) { ds.Add(product); } } } } ViewBag.ProductAdd = ProductAdd; return(PartialView("dsProduct", ds)); }
public ActionResult Create(string id) { Session[Config.DesignImage] = new List <ProductMultiUpload>(); Session[Config.MaterialImage] = new List <ProductMultiUpload>(); if (!string.IsNullOrWhiteSpace(id)) { shProductService _product = new shProductService(); shProduct product = _product.FindByKey(id); if (product != null) { shCategoryService _category = new shCategoryService(); ViewBag.citySel = _category.CategoryName(product.CategoryGuid); ViewBag.ProductGuid = product.ProductGuid; #region Image shProductImageService _productImage = new shProductImageService(); IEnumerable <shProductImage> DsDesignImage = _productImage.DanhSachProductImage_ByCategory(product.ProductGuid, Config.ProductImageCategory_Design); IEnumerable <shProductImage> DsMaterialImage = _productImage.DanhSachProductImage_ByCategory(product.ProductGuid, Config.ProductImageCategory_Material); ViewBag.DsDesignImage = DsDesignImage; ViewBag.DsMaterialImage = DsMaterialImage; #endregion return(View(product)); } else { return(View(new shProduct())); } } if (TempData["ERROR"] != null) { ModelState.AddModelError("", TempData["ERROR"].ToString()); shCategoryService _category = new shCategoryService(); if (TempData["CategoryGuid"] != null) { ViewBag.citySel = _category.CategoryName(TempData["CategoryGuid"].ToString()); } ViewBag.CategoryGuid = TempData["CategoryGuid"]; ViewBag.ProductGuid = TempData["ProductGuid"]; ViewBag.ProductName = TempData["ProductName"]; ViewBag.Description = TempData["Description"]; ViewBag.Details = TempData["Details"]; TempData["ERROR"] = null; } return(View(new shProduct())); }
public ActionResult DialogHighLight(string ProductGuid) { shProductService _product = new shProductService(); shProduct product = _product.FindByKey(ProductGuid); if (product == null) { product = new shProduct(); } return(PartialView("DialogHighLight", product)); }
public static MvcHtmlString ProductLink(this HtmlHelper helper, string ProductGuid) { string html = string.Empty; if (!string.IsNullOrEmpty(ProductGuid) || !string.IsNullOrWhiteSpace(ProductGuid)) { shProductService _product = new shProductService(); shProduct product = _product.FindByKey(ProductGuid); html = " <a href='" + product.MetaTitle + "-" + product.ProductId + "' target='_blank'>" + product.ProductName + "</a>"; } return(new MvcHtmlString(html)); }
public static MvcHtmlString ProductName(this HtmlHelper helper, string ProductGuid) { string html = string.Empty; if (!string.IsNullOrEmpty(ProductGuid) || !string.IsNullOrWhiteSpace(ProductGuid)) { shProductService _product = new shProductService(); shProduct product = _product.FindByKey(ProductGuid); html = product.ProductName; } return(new MvcHtmlString(html)); }
public ActionResult AddItem(string ProductGuid, int Quantity, string SectionGuid, string SizeGuid) { var cart = Session[CartSession]; shProductService _product = new shProductService(); shProduct product = _product.FindByKey(ProductGuid); if (cart != null) { var list = (List <CartItem>)cart; if (list.Exists(x => (x.Product.ProductGuid == ProductGuid) && (x.SectionGuid == SectionGuid) && (x.SizeGuid == SizeGuid))) { foreach (var item in list) { if ((item.Product.ProductGuid == ProductGuid) && (item.SectionGuid == SectionGuid) && (item.SizeGuid == SizeGuid)) { item.Quantity += Quantity; } } } else { var item = new CartItem(); item.Product = product; item.Quantity = Quantity; item.SectionGuid = SectionGuid; item.SizeGuid = SizeGuid; list.Add(item); } Session[CartSession] = list; } else { var item = new CartItem(); item.Product = product; item.Quantity = Quantity; item.SectionGuid = SectionGuid; item.SizeGuid = SizeGuid; var listCart = new List <CartItem>(); listCart.Add(item); Session[CartSession] = listCart; } if (Request.IsAjaxRequest()) { return(Json("OK", JsonRequestBehavior.AllowGet)); } return(RedirectToAction("trang-chu")); }
public ActionResult Section(string id) { if (!string.IsNullOrWhiteSpace(id)) { shProductService _product = new shProductService(); shProduct product = _product.FindByKey(id); if (product != null) { shCategoryService _category = new shCategoryService(); return(View(product)); } else { return(View(new shProduct())); } } return(View()); }
public ActionResult Preview(string ProductGuid) { shProductService _product = new shProductService(); shProduct product = _product.FindByKey(ProductGuid); if (product != null) { #region Image shProductImageService _productImage = new shProductImageService(); IEnumerable <shProductImage> DsDesignImage = _productImage.DanhSachProductImage_ByCategory(product.ProductGuid, Config.ProductImageCategory_Design); IEnumerable <shProductImage> DsMaterialImage = _productImage.DanhSachProductImage_ByCategory(product.ProductGuid, Config.ProductImageCategory_Material); ViewBag.DsDesignImage = DsDesignImage; ViewBag.DsMaterialImage = DsMaterialImage; #endregion shSectionService _section = new shSectionService(); IEnumerable <shProductSet> dsSection = _section.DanhSachSection_TheoProductGuid_ParentNull(product.ProductGuid); ViewBag.Section = dsSection; return(PartialView("Preview", product)); } return(PartialView("Preview", new shProduct())); }
public IEnumerable <TimKiemNangCao> TimKiemNangCao(string keyword) { List <TimKiemNangCao> ds = new List <TimKiemNangCao>(); TimKiemNangCao timkiem = new TimKiemNangCao(); // 1. Tìm kiếm trong bảng sản phẩm shProductService _product = new shProductService(); IEnumerable <shProduct> dsProduct = _product.FindList().Where(x => TypeHelper.CompareString(x.ProductName, keyword)); foreach (var product in dsProduct) { timkiem = new TimKiemNangCao(); timkiem.CategoryId = TheLoaiTimKiemNangCao.SanPham.GetHashCode(); timkiem.Category = "Sản phẩm"; timkiem.Name = product.ProductName; timkiem.MetaTitle = product.MetaTitle + "-" + product.ProductId; timkiem.keyword = keyword; timkiem.CreatedDate = product.CreateDate; timkiem.Description = " Bộ sản phẩm có kết cấu và giá sản phẩm: Kích ..."; timkiem.ProductGuid = product.ProductGuid; ds.Add(timkiem); } // 3. Tìm kiếm trong bảng set sản phẩm shSectionService _section = new shSectionService(); IEnumerable <shProductSet> dsSet = _section.FindList().Where(x => TypeHelper.CompareString(x.SectionName, keyword)); foreach (var set in dsSet) { shProduct product = _product.FindByKey(set.ProductGuid); timkiem = new TimKiemNangCao(); timkiem.CategoryId = TheLoaiTimKiemNangCao.SetSanPham.GetHashCode(); timkiem.Category = "Sản phẩm"; timkiem.Name = product.ProductName + "- Set " + set.SectionName + keyword; timkiem.MetaTitle = product.MetaTitle + "-" + product.ProductId; timkiem.keyword = keyword; timkiem.CreatedDate = set.CreateDate; timkiem.Description = " Bộ sản phẩm có kết cấu và giá sản phẩm: Kích ..."; timkiem.ProductGuid = product.ProductGuid; ds.Add(timkiem); } // 4. Tìm kiếm trong bảng kích thước theo set shSizeService _size = new shSizeService(); IEnumerable <shSetSize> dsSize = _size.FindList().Where(x => TypeHelper.CompareString(x.SizeName, keyword)); foreach (var size in dsSize) { shProduct product = _product.FindByKey(size.ProductGuid); timkiem = new TimKiemNangCao(); timkiem.CategoryId = TheLoaiTimKiemNangCao.SetSanPham.GetHashCode(); timkiem.Category = "Sản phẩm"; timkiem.Name = product.ProductName + " - Kích thước: " + size.SizeName; timkiem.MetaTitle = product.MetaTitle + "-" + product.ProductId; timkiem.keyword = keyword; timkiem.CreatedDate = size.CreateDate; timkiem.Description = " Bộ sản phẩm có kết cấu và giá sản phẩm: Kích ..."; timkiem.ProductGuid = product.ProductGuid; ds.Add(timkiem); } // 2. Tìm kiếm trong bảng tin tức shNewService _new = new shNewService(); IEnumerable <shNew> dsNew = _new.FindList().Where(x => TypeHelper.CompareString(x.TitleNew, keyword)); foreach (var news in dsNew) { timkiem = new TimKiemNangCao(); timkiem.CategoryId = TheLoaiTimKiemNangCao.TinTuc.GetHashCode(); timkiem.Category = "Tin Tức"; timkiem.Name = news.TitleNew; timkiem.MetaTitle = news.MetaTitle + "-" + news.NewId; timkiem.keyword = keyword; timkiem.CreatedDate = news.CreatedDate; timkiem.Description = news.Summary; ds.Add(timkiem); } return(ds); }