Exemplo n.º 1
0
        private void BindData()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("code");
            dt.Columns.Add("status");

            foreach (int code in Enum.GetValues(typeof(ProductStatus)))
            {
                DataRow row = dt.NewRow();
                row["code"]   = code;
                row["status"] = Enum.GetName(typeof(ProductStatus), code);
                dt.Rows.Add(row);
            }

            drpStatus.DataSource     = dt;
            drpStatus.DataTextField  = "status";
            drpStatus.DataValueField = "code";
            drpStatus.DataBind();

            DropDown_Brand.DataSource     = new BrandCategoryRelationBll().GetCategoryBrandList(CategoryID);
            DropDown_Brand.DataTextField  = "brandname";
            DropDown_Brand.DataValueField = "brandid";
            DropDown_Brand.DataBind();

            Label_CategoryNamePath.Text = new CategoryModelBll().GetCategoryNamePath(CategoryID);
            txtCategoryID.Value         = CategoryID.ToString();


            DropDown_Packing.DataSource     = AddSelectRow(new ProductSpecificationBll().GetList(SpecificationType.包装清单));
            DropDown_Packing.DataTextField  = "title";
            DropDown_Packing.DataValueField = "content";
            DropDown_Packing.DataBind();

            DropDown_Service.DataSource     = AddSelectRow(new ProductSpecificationBll().GetList(SpecificationType.售后服务));
            DropDown_Service.DataTextField  = "title";
            DropDown_Service.DataValueField = "content";
            DropDown_Service.DataBind();

            DropDown_OfferSet.DataSource     = AddSelectRow(new ProductSpecificationBll().GetList(SpecificationType.优惠套装));
            DropDown_OfferSet.DataTextField  = "title";
            DropDown_OfferSet.DataValueField = "content";
            DropDown_OfferSet.DataBind();

            DropDown_Specification.DataSource     = AddSelectRow(new ProductSpecificationBll().GetList(SpecificationType.规格参数));
            DropDown_Specification.DataTextField  = "title";
            DropDown_Specification.DataValueField = "content";
            DropDown_Specification.DataBind();

            txtProductCode.Text = ProductID.ToString();
        }
Exemplo n.º 2
0
        private void BindData()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("code");
            dt.Columns.Add("status");

            foreach (int code in Enum.GetValues(typeof(ProductStatus)))
            {
                DataRow row = dt.NewRow();
                row["code"]   = code;
                row["status"] = Enum.GetName(typeof(ProductStatus), code);
                dt.Rows.Add(row);
            }

            ProductModel product = ProductMainImageRule.GetMainImageUrl(bll.GetModel(ProductID));

            drpStatus.DataSource     = dt;
            drpStatus.DataTextField  = "status";
            drpStatus.DataValueField = "code";
            drpStatus.DataBind();

            DropDown_Brand.DataSource     = new BrandCategoryRelationBll().GetCategoryBrandList(CategoryID == -1 ? product.CateId : CategoryID);
            DropDown_Brand.DataTextField  = "brandname";
            DropDown_Brand.DataValueField = "brandid";
            DropDown_Brand.DataBind();

            DropDown_Specification.DataSource     = AddSelectRow(new ProductSpecificationBll().GetList(SpecificationType.规格参数));
            DropDown_Specification.DataTextField  = "title";
            DropDown_Specification.DataValueField = "content";
            DropDown_Specification.DataBind();

            DropDown_Packing.DataSource     = AddSelectRow(new ProductSpecificationBll().GetList(SpecificationType.包装清单));
            DropDown_Packing.DataTextField  = "title";
            DropDown_Packing.DataValueField = "content";
            DropDown_Packing.DataBind();

            DropDown_Service.DataSource     = AddSelectRow(new ProductSpecificationBll().GetList(SpecificationType.售后服务));
            DropDown_Service.DataTextField  = "title";
            DropDown_Service.DataValueField = "content";
            DropDown_Service.DataBind();

            DropDown_OfferSet.DataSource     = AddSelectRow(new ProductSpecificationBll().GetList(SpecificationType.优惠套装));
            DropDown_OfferSet.DataTextField  = "title";
            DropDown_OfferSet.DataValueField = "content";
            DropDown_OfferSet.DataBind();

            if (product != null)
            {
                txtProductName.Text   = product.ProductName;
                txtProductCode.Text   = product.ProductCode;
                txtTradePrice.Text    = product.TradePrice.ToString();
                txtScore.Text         = product.Score.ToString();
                txtMerchantPrice.Text = product.MerchantPrice.ToString();
                txtReducePrice.Text   = product.ReducePrice.ToString();

                drpStatus.SelectedValue = product.Status.ToString();
                txtKeywords.Text        = product.Keywords;
                TextBox_Brief.Text      = product.Brief;
                imgProduct.ImageUrl     = product.SmallImage;

                TextBox_Specification.Text = product.Specifications;
                TextBox_Packing.Text       = product.PackingList;
                TextBox_Service.Text       = product.AfterSaleService;
                TextBox_OfferSet.Text      = product.OfferSet;

                txtWeight.Text = product.Weight.ToString("0.00");

                SetStockTip(product.StockTip);
                txtRelateProduct.Text = product.RelateProducts;

                ProductNewsModel newsModel = new ProductNewsBll().GetModel(product.ProductId);
                txtNewsID.Text = newsModel == null?"":newsModel.NewsID.ToString();

                if (CategoryID != -1)
                {
                    Label_CategoryNamePath.Text = new CategoryModelBll().GetCategoryNamePath(CategoryID);
                    txtCategoryID.Value         = CategoryID.ToString();
                }
                else
                {
                    txtCategoryID.Value         = product.CateId.ToString();
                    Label_CategoryNamePath.Text = new CategoryModelBll().GetCategoryNamePath(product.CateId);
                }
                DropDown_Brand.SelectedValue = product.BrandID.ToString();

                BindParameterData(product.CateId);
                BindSpecificationData(product.CateId);

                ReselectCategory.HRef = String.Format("CategorySelect.aspx?cid={0}&pid={1}", product.CateId, product.ProductId);
            }
        }