Ejemplo n.º 1
0
        protected override void PageLoad()
        {
            base.PageLoad();

            string action = RequestHelper.GetQueryString <string>("Action");

            switch (action)
            {
            case "GetStandardPrice":
                GetStandardPrice();
                break;

            case "Like":
                Like();
                break;

            case "Collect":
                Collect();
                break;
            }

            int id = RequestHelper.GetQueryString <int>("id");

            product = ProductBLL.Read(id);
            if (product.IsSale == (int)BoolType.False)
            {
                ScriptHelper.AlertFront("该产品未上市,不能查看");
            }

            //更新查看数量
            Dictionary <string, object> dict = new Dictionary <string, object>();

            dict.Add("ViewCount", product.ViewCount + 1);
            ProductBLL.UpdatePart(ProductInfo.TABLENAME, dict, id);

            if (product.BrandId > 0)
            {
                productBrand = ProductBrandBLL.Read(product.BrandId);
            }
            if (product.ShopId > 0)
            {
                shop = UserBLL.Read(product.ShopId);
            }
            productPhotoList = ProductPhotoBLL.ReadList(id, 0);
            attributeRecords = ProductTypeAttributeRecordBLL.ReadList(id);
            standardRecords  = ProductTypeStandardRecordBLL.ReadList(id);
            //导航路径
            listPaths = ProductClassBLL.ReadNavigationPath(product.ClassId);
            listPaths.ForEach(k => paths += string.Format(k[0], k[1], k[2]));

            //排行榜
            //按销量倒序
            int count = 0;

            topProductList = ProductBLL.SearchList(1, 6, new ProductSearchInfo {
                ClassId = product.ClassId, IsSale = (int)BoolType.True, ProductOrderType = "SendCount", OrderType = OrderType.Desc
            }, ref count);

            //同类推荐
            classProductList = ProductBLL.SearchList(1, 3, new ProductSearchInfo {
                ClassId = product.ClassId, IsSale = (int)BoolType.True, IsTop = (int)BoolType.True
            }, ref count);

            //搜索优化
            Title       = product.Name;
            Keywords    = string.IsNullOrEmpty(product.Keywords) ? product.Name : product.Keywords;
            Description = string.IsNullOrEmpty(product.Summary) ? StringHelper.Substring(StringHelper.KillHTML(product.Introduction1), 200) : product.Summary;
        }