예제 #1
0
        /// <summary>
        /// 页面加载方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int productBrandID = RequestHelper.GetQueryString <int>("ID");

                if (productBrandID != int.MinValue)
                {
                    CheckAdminPower("ReadProductBrand", PowerCheckType.Single);
                    productBrand     = ProductBrandBLL.Read(productBrandID);
                    Name.Text        = productBrand.Name;
                    Logo.Text        = productBrand.ImageUrl;
                    Url.Text         = productBrand.LinkUrl;
                    Description.Text = productBrand.Remark;
                    OrderID.Text     = productBrand.OrderId.ToString();

                    if (Convert.ToBoolean(productBrand.IsTop))
                    {
                        IsTop.Checked = true;
                    }
                    Spell.Visible = true;
                    Spelling.Text = productBrand.Spelling;
                }
            }
        }
예제 #2
0
        protected string GetBrandList(string ids)
        {
            string brandStr = string.Empty;

            string[] idArr = ids.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string id in idArr)
            {
                ProductBrandInfo brand = ProductBrandBLL.Read(Convert.ToInt32(id));
                brandStr += brand.Name + ";";
            }
            return(brandStr);
        }
예제 #3
0
        protected override void PageLoad()
        {
            base.PageLoad();

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

            product = ProductBLL.Read(id);
            if (product.IsSale == (int)BoolType.False)
            {
                ScriptHelper.AlertFront("该产品未上市,不能查看");
            }
            //如果为移动端单独设置了内容,则取移动端内容
            if (!string.IsNullOrEmpty(product.Introduction1_Mobile))
            {
                product.Introduction1 = product.Introduction1_Mobile;
            }
            if (!string.IsNullOrEmpty(product.Introduction2_Mobile))
            {
                product.Introduction2 = product.Introduction2_Mobile;
            }
            if (!string.IsNullOrEmpty(product.Introduction3_Mobile))
            {
                product.Introduction3 = product.Introduction3_Mobile;
            }

            //更新查看数量
            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);
            }
            productPhotoList = ProductPhotoBLL.ReadList(id, 0);
            attributeRecords = ProductTypeAttributeRecordBLL.ReadList(id);
            standardRecords  = ProductTypeStandardRecordBLL.ReadList(id);

            //搜索优化
            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;
        }
예제 #4
0
        /// <summary>
        /// 提交按钮点击方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            ProductBrandInfo productBrand = new ProductBrandInfo();

            productBrand.Id   = RequestHelper.GetQueryString <int>("ID");
            productBrand.Name = Name.Text;
            var _brand = ProductBrandBLL.Read(productBrand.Name);

            if ((productBrand.Id > 0 && _brand.Id > 0 && _brand.Id != productBrand.Id) || (productBrand.Id <= 0 && _brand.Id > 0))
            {
                ScriptHelper.Alert("该品牌已存在,请重新输入", RequestHelper.RawUrl);
            }
            else
            {
                productBrand.ImageUrl = Logo.Text;
                productBrand.LinkUrl  = Url.Text;
                productBrand.Remark   = Description.Text;
                productBrand.IsTop    = Convert.ToInt32(IsTop.Checked);
                productBrand.OrderId  = Convert.ToInt32(OrderID.Text);

                string alertMessage = ShopLanguage.ReadLanguage("AddOK");
                if (productBrand.Id == int.MinValue)
                {
                    CheckAdminPower("AddProductBrand", PowerCheckType.Single);
                    productBrand.Spelling = ChineseCharacterHelper.GetChineseSpell(Name.Text.Trim());
                    int id = ProductBrandBLL.Add(productBrand);
                    AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("ProductBrand"), id);
                }
                else
                {
                    CheckAdminPower("UpdateProductBrand", PowerCheckType.Single);
                    productBrand.Spelling = Spelling.Text;
                    ProductBrandBLL.Update(productBrand);
                    AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("ProductBrand"), productBrand.Id);
                    alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
                }
                ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl);
            }
        }
예제 #5
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;
        }