Ejemplo n.º 1
0
        public ActionResult SizeGuid(string ProductGuid, string SectionGuid, string SizeGuid)
        {
            if (string.IsNullOrWhiteSpace(SectionGuid) || string.IsNullOrEmpty(SectionGuid))
            {
                shSectionService _section = new shSectionService();

                IEnumerable <shProductSet> ds = _section.DanhSachSection_TheoProductGuid_ParentNull(ProductGuid);

                if (ds != null && ds.Count() > 0)
                {
                    SectionGuid = ds.FirstOrDefault().SectionGuid;
                }
            }

            shSizeService           _size  = new shSizeService();
            IEnumerable <shSetSize> dsSize = _size.DanhSachSize_BySectionGuid(SectionGuid, ProductGuid, null);

            foreach (var size in dsSize)
            {
                size.SizeName += " - " + Format.FormatDecimalToString(size.PriceCurrent.GetValueOrDefault(0)).Replace(',', '.');
            }
            SelectList select = new SelectList(dsSize, "SizeGuid", "SizeName", SizeGuid);

            return(PartialView("SizeGuid", select));
        }
Ejemplo n.º 2
0
        public PartialViewResult DsSection(string ProductGuid)
        {
            shSectionService _section = new shSectionService();

            IEnumerable <shProductSet> dsSection = _section.DanhSachSection_TheoProductGuid_ParentNull(ProductGuid);

            return(PartialView("DsSection", dsSection));
        }
Ejemplo n.º 3
0
        public ActionResult SectionGuid(string ProductGuid, string SectionGuid)
        {
            shSectionService _section = new shSectionService();

            //IEnumerable<shSection> ds = _section.DanhSachSection_TheoProductGuid(ProductGuid);
            IEnumerable <shProductSet> ds = _section.DanhSachSection_TheoProductGuid_ParentNull(ProductGuid);

            SelectList select = new SelectList(ds, "SectionGuid", "SectionName", SectionGuid);

            return(PartialView("SectionGuid", select));
        }
Ejemplo n.º 4
0
        public ActionResult Details(int?id)
        {
            shProductService _product = new shProductService();

            shProduct product = _product.FindList().Where(x => x.ProductId == id).FirstOrDefault();

            shProductImageService        _productImage = new shProductImageService();
            IEnumerable <shProductImage> dsImage       = _productImage.DanhSachProductImage_ByProductGuid(product.ProductGuid);

            ViewBag.dsImageMauMa    = dsImage.Where(x => x.ProductImageCategory == Config.ProductImageCategory_Design);
            ViewBag.dsImageChatLieu = dsImage.Where(x => x.ProductImageCategory == Config.ProductImageCategory_Material);


            shSectionService           _section  = new shSectionService();
            IEnumerable <shProductSet> dsSection = _section.DanhSachSection_TheoProductGuid_ParentNull(product.ProductGuid);


            shProductSet section = new shProductSet();

            if (dsSection != null && dsSection.Count() > 0)
            {
                section = dsSection.FirstOrDefault();
            }

            shSizeService           _size  = new shSizeService();
            IEnumerable <shSetSize> dsSize = _size.DanhSachSize_BySectionGuid(section.SectionGuid, product.ProductGuid, null);


            ViewBag.ProductSize = section.SectionName + " --- " +
                                  CommonHelper.TinhToanKichThuocMaxMin(dsSize.FirstOrDefault(), dsSize.LastOrDefault());
            ViewBag.ProductPrice = CommonHelper.TinhToanGiaTienMaxMin(dsSize.FirstOrDefault(), dsSize.LastOrDefault());

            // Tính toán số tiền sau khuyến mại
            string productSale = CommonHelper.TinhToanGiaTienSauKhiGiam(dsSize.FirstOrDefault(), dsSize.LastOrDefault());

            if (!string.IsNullOrEmpty(productSale) && !string.IsNullOrWhiteSpace(productSale))
            {
                ViewBag.ProductSale = Format.FormatDecimalToString(Convert.ToDecimal(productSale));
            }


            ViewBag.ListSection = dsSection;

            return(View(product));
        }
Ejemplo n.º 5
0
        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()));
        }