Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int classId   = RequestHelper.GetQueryString <int>("classId");
            int productId = RequestHelper.GetQueryString <int>("productId");

            var cls = ProductClassBLL.Read(classId);

            attributeList = ProductTypeAttributeBLL.JoinAttribute(cls.ProductTypeId, productId);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ClearCache();

            int    attributeClassID = RequestHelper.GetQueryString <int>("AttributeClassID");
            int    productID        = RequestHelper.GetQueryString <int>("ProductID");
            string Action           = RequestHelper.GetQueryString <string>("Action");

            if (!string.IsNullOrEmpty(Action))
            {
                int proTypeID = ProductClassBLL.GetProductClassType(attributeClassID);//通过产品分类ID获取所对应的产品类型ID;
                attributeList = ProductTypeAttributeBLL.JoinAttribute(proTypeID, productID);
            }
            else
            {
                attributeList = ProductTypeAttributeBLL.JoinAttribute(attributeClassID, productID);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 页面加载方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindClassBrandAttributeClassStandardType();
                BrandID.Items.Insert(0, new ListItem("请选择", "0"));
                RelationBrandID.Items.Insert(0, new ListItem("请选择", "0"));
                AccessoryBrandID.Items.Insert(0, new ListItem("请选择", "0"));

                string classId = RequestHelper.GetQueryString <string>("classId");
                productID = RequestHelper.GetQueryString <int>("ID");
                _brandId  = RequestHelper.GetQueryString <int>("BrandId");
                //ProductClass.DataSource = ProductClassBLL.ReadUnlimitClassList();
                if (productID <= 0)             //添加商品
                {
                    DraftButton.Visible = true; //添加商品可保存草稿
                    if (string.IsNullOrEmpty(classId))
                    {
                        Response.Redirect("/admin/productaddinit.aspx");
                    }
                    else
                    {
                        LastClassID = ProductClassBLL.GetLastClassID(classId);
                        proTypeID   = ProductClassBLL.GetProductClassType(LastClassID);
                        ProductTypeInfo aci = ProductTypeBLL.Read(proTypeID);
                        if (aci.Id > 0)
                        {
                            string[] strArray = aci.BrandIds.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                            int[]    intArray;

                            intArray         = Array.ConvertAll <string, int>(strArray, s => int.Parse(s));
                            productBrandList = ProductBrandBLL.ReadList(intArray);
                        }

                        if (productBrandList.Count > 0)
                        {
                            BrandID.DataSource     = productBrandList;
                            BrandID.DataTextField  = "Name";
                            BrandID.DataValueField = "ID";
                            BrandID.DataBind();
                            BrandID.Items.Insert(0, new ListItem("请选择", "0"));
                            if (_brandId > 0)
                            {
                                BrandID.Text = _brandId.ToString();
                            }

                            RelationBrandID.DataSource     = productBrandList;
                            RelationBrandID.DataTextField  = "Name";
                            RelationBrandID.DataValueField = "ID";
                            RelationBrandID.DataBind();
                            RelationBrandID.Items.Insert(0, new ListItem("请选择", "0"));

                            AccessoryBrandID.DataSource     = productBrandList;
                            AccessoryBrandID.DataTextField  = "Name";
                            AccessoryBrandID.DataValueField = "ID";
                            AccessoryBrandID.DataBind();
                            AccessoryBrandID.Items.Insert(0, new ListItem("请选择", "0"));
                        }
                        //商品分类对应的属性列表
                        attributeList = ProductTypeAttributeBLL.ReadList(proTypeID);
                        //商品类型对应的规格列表
                        standardList = ProductTypeStandardBLL.ReadList(proTypeID);
                        //添加商品时自动查找所属分类的售后服务
                        Remark.Value = GetProductClassRemark(classId);
                    }
                }
                else//修改商品
                {
                    CheckAdminPower("ReadProduct", PowerCheckType.Single);
                    DraftButton.Visible = false;//修改商品不可保存草稿
                    ProductInfo product = ProductBLL.Read(productID);
                    pageProduct = product;
                    //如果修改了分类则标识isupdate
                    if (!string.IsNullOrEmpty(classId) && product.ClassId != classId)
                    {
                        isUpdate = 1;
                    }

                    YejiRatio.Text = product.YejiRatio;

                    Name.Text      = product.Name;
                    SellPoint.Text = product.SellPoint;
                    Name.Attributes.Add("style", "color:" + product.Color);
                    color              = product.Color;
                    FontStyle.Text     = product.FontStyle;
                    ProductNumber.Text = product.ProductNumber;
                    //ProductClass.ClassID = product.ClassId;
                    Keywords.Text          = product.Keywords;
                    MarketPrice.Text       = product.MarketPrice.ToString();
                    SendPoint.Text         = product.SendPoint.ToString();
                    Photo.Text             = product.Photo;
                    Summary.Text           = product.Summary;
                    Introduction.Value     = product.Introduction1;
                    Weight.Text            = product.Weight.ToString();
                    GroupPrice.Text        = product.GroupPrice.ToString();
                    GroupQuantity.Text     = product.GroupQuantity.ToString();
                    GroupPhoto.Text        = product.GroupPhoto;
                    VirtualOrderCount.Text = product.VirtualOrderCount.ToString();

                    if (Convert.ToBoolean(product.IsSpecial))
                    {
                        IsSpecial.Checked = true;
                    }
                    if (Convert.ToBoolean(product.IsNew))
                    {
                        IsNew.Checked = true;
                    }
                    if (Convert.ToBoolean(product.IsHot))
                    {
                        IsHot.Checked = true;
                    }
                    if (Convert.ToBoolean(product.IsSale))
                    {
                        IsSale.Checked = true;
                    }
                    else
                    {
                        IsSale.Checked = false;
                    }
                    if (Convert.ToBoolean(product.IsTop))
                    {
                        IsTop.Checked = true;
                    }
                    if (Convert.ToBoolean(product.AllowComment))
                    {
                        AllowComment.Checked = true;
                    }
                    else
                    {
                        AllowComment.Checked = false;
                    }
                    TotalStorageCount.Text = product.TotalStorageCount.ToString();

                    LastClassID    = ProductClassBLL.GetLastClassID(product.ClassId);
                    this.proTypeID = ProductClassBLL.GetProductClassType(LastClassID);
                    //商品分类对应的属性列表
                    //attributeList = ProductTypeAttributeBLL.JoinAttribute(ProductClassBLL.Read(ProductClassBLL.GetLastClassID(product.ClassId)).ProductTypeId, productID);
                    attributeList        = ProductTypeAttributeBLL.JoinAttribute(this.proTypeID, productID);
                    Repeater1.DataSource = attributeList;
                    Repeater1.DataBind();
                    //商品类型对应的规格列表
                    standardList       = ProductTypeStandardBLL.ReadList(this.proTypeID);
                    standardRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(product.Id, product.StandardType);
                    if (product.StandardType == 1)
                    {
                        if (standardRecordList.Count > 0)
                        {
                            TotalStorageCount.ReadOnly = true;
                        }
                    }
                    if (string.IsNullOrEmpty(classId))
                    {
                        LastClassID = ProductClassBLL.GetLastClassID(product.ClassId);
                    }
                    else
                    {
                        LastClassID = ProductClassBLL.GetLastClassID(classId);
                    }
                    int             proTypeID = ProductClassBLL.GetProductClassType(LastClassID);
                    ProductTypeInfo aci       = ProductTypeBLL.Read(proTypeID);
                    if (aci.Id > 0)
                    {
                        string[] strArray = aci.BrandIds.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                        int[]    intArray;

                        intArray         = Array.ConvertAll <string, int>(strArray, s => int.Parse(s));
                        productBrandList = ProductBrandBLL.ReadList(intArray);
                    }

                    if (productBrandList.Count > 0)
                    {
                        BrandID.DataSource     = productBrandList;
                        BrandID.DataTextField  = "Name";
                        BrandID.DataValueField = "ID";
                        BrandID.DataBind();
                        BrandID.Items.Insert(0, new ListItem("请选择", "0"));

                        RelationBrandID.DataSource     = productBrandList;
                        RelationBrandID.DataTextField  = "Name";
                        RelationBrandID.DataValueField = "ID";
                        RelationBrandID.DataBind();
                        RelationBrandID.Items.Insert(0, new ListItem("请选择", "0"));

                        AccessoryBrandID.DataSource     = productBrandList;
                        AccessoryBrandID.DataTextField  = "Name";
                        AccessoryBrandID.DataValueField = "ID";
                        AccessoryBrandID.DataBind();
                        AccessoryBrandID.Items.Insert(0, new ListItem("请选择", "0"));
                    }
                    if (_brandId > 0)
                    {
                        BrandID.Text = _brandId.ToString();
                    }
                    else
                    {
                        BrandID.Text = product.BrandId.ToString();
                    }

                    sendCount    = product.SendCount;
                    OrderID.Text = product.OrderId.ToString();

                    SalePrice.Text            = product.SalePrice.ToString();
                    Units.Text                = product.Unit;
                    Introduction_Mobile.Value = product.Introduction1_Mobile;
                    Sub_Title.Text            = product.SubTitle;
                    LowerCount.Text           = product.LowerCount.ToString();

                    Remark.Value = product.Remark;

                    BindRelation(product);
                    productPhotoList = ProductPhotoBLL.ReadList(productID, 0);
                }
                //userGradeList = UserGradeBLL.JoinUserGrade(productID);
            }
        }