Beispiel #1
0
        private void BindData()
        {
            SecondhandProductModel model = bll.GetModel(SecondhandProductID);

            if (model.Status != (int)SecondhandProductStatus.尚未审核)
            {
                MessageBox.Show(this, "该商品已被审核,禁止编辑!");
                Response.Redirect("List.aspx");
                return;
            }

            DropDown_Usage.DataSource     = DataTableUtil.GetEnumKeyValue(typeof(SecondhandProductUsageCondition));
            DropDown_Usage.DataTextField  = "key";
            DropDown_Usage.DataValueField = "value";
            DropDown_Usage.DataBind();

            CategoryID = model.CateID;
            if (!String.IsNullOrEmpty(Request.QueryString["categoryid"]))
            {
                CategoryID = Convert.ToInt32(Request.QueryString["categoryid"]);
            }

            TextBox_Category.Text        = new MagicCategoryBll().GetModel(CategoryID).CategoryName;
            TextBox_ProductName.Text     = model.SecondhandProductName;
            TextBox_Price.Text           = model.Price.ToString("0.00");
            TextBox_Count.Text           = model.Stock.ToString();
            DropDown_Usage.SelectedValue = model.UsageCondition.ToString();
            TextBox_Brief.Text           = model.Brief;
            TextBox_TrueName.Text        = model.TrueName;
            TextBox_Phone.Text           = model.Phone;
            TextBox_CellPhone.Text       = model.CellPhone;
            TextBox_PostCode.Text        = model.PostCode;
            TextBox_Address.Text         = model.Address;
            ucRegion.PresetRegionInfo(RegionInfo.GetRegionPathByName(model.Region.Split(' ')[model.Region.Split(' ').Length - 1]));
        }
Beispiel #2
0
        protected void BindData()
        {
            if (CategoryID != -1)
            {
                MagicCategoryBll   CategoryBll = new MagicCategoryBll();
                MagicCategoryModel Category    = CategoryBll.GetModel(CategoryID);

                TextBox_Category.Text = Category.CategoryName;

                DropDown_Usage.DataSource     = DataTableUtil.GetEnumKeyValue(typeof(SecondhandProductUsageCondition));
                DropDown_Usage.DataTextField  = "key";
                DropDown_Usage.DataValueField = "value";
                DropDown_Usage.DataBind();
            }
            else
            {
                throw new Exception("未选择分类");
            }
        }