Пример #1
0
    protected void RepChildList_ItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        string commandName = e.CommandName;
        string value       = e.CommandArgument.ToStr();

        if (commandName == "delete")
        {
            List <TB_Product_Products> list = new List <TB_Product_Products>();
            foreach (RepeaterItem item in RepChildList.Items)
            {
                string thisIndex = ((HiddenField)item.FindControl("Index")).Value;

                if (value != thisIndex)
                {
                    TB_Product_Products entity = new TB_Product_Products();
                    entity.ProName      = ((TextBox)item.FindControl("ProName")).Text;
                    entity.ProNumber    = ((TextBox)item.FindControl("ProNumber")).Text;
                    entity.Color        = ((TextBox)item.FindControl("Color")).Text;
                    entity.PurchasPrice = ((TextBox)item.FindControl("PurchasPrice")).Text.ToDecimal();
                    entity.MarketPrice  = ((TextBox)item.FindControl("MarketPrice")).Text.ToDecimal();
                    entity.SalesPrice   = ((TextBox)item.FindControl("SalesPrice")).Text.ToDecimal();

                    list.Add(entity);
                }
            }
            RepChildList.DataSource = list;
            RepChildList.DataBind();
        }
    }
Пример #2
0
    //添加子商品
    protected void BtnAddChild_Click(object sender, EventArgs e)
    {
        List <TB_Product_Products> list = new List <TB_Product_Products>();

        TB_Product_Products entity2 = new TB_Product_Products();

        list.Add(entity2);

        foreach (RepeaterItem item in RepChildList.Items)
        {
            TB_Product_Products entity = new TB_Product_Products();
            entity.ID           = ((HiddenField)item.FindControl("ID")).Value.ToInt();
            entity.ProName      = ((TextBox)item.FindControl("ProName")).Text;
            entity.ProNumber    = ((TextBox)item.FindControl("ProNumber")).Text;
            entity.Color        = ((TextBox)item.FindControl("Color")).Text;
            entity.PurchasPrice = ((TextBox)item.FindControl("PurchasPrice")).Text.ToDecimal();
            entity.MarketPrice  = ((TextBox)item.FindControl("MarketPrice")).Text.ToDecimal();
            entity.SalesPrice   = ((TextBox)item.FindControl("SalesPrice")).Text.ToDecimal();

            list.Add(entity);
        }

        RepChildList.DataSource = list;
        RepChildList.DataBind();
    }
Пример #3
0
    //加载
    public void LoadDataBind()
    {
        int ID = CommonClass.ReturnRequestInt("id", 0);

        if (ID > 0)
        {
            TB_Product_Products model = ProductService.ProductsService.Get(ID);
            if (model.ID.ToInt() > 0)
            {
                ViewState["id"] = model.ID;

                TB_Product_Categorys category = ProductService.CategoryService.Get(model.CategoryID);
                DDLOneLevel.SelectedValue = ProductService.CategoryService.Get(category.ParentID).ParentID.ToStr();

                GetTwoCategory();
                DDLTwoLevel.SelectedValue = category.ParentID.ToStr();

                GetThreeCategory();
                DDLThreeLevel.SelectedValue = model.CategoryID.ToStr();

                BindProperties();
                BindBrand(model.CategoryID);

                TbProductName.Text         = model.ProName;
                TbProNumber.Text           = model.ProNumber;
                TbIntroduction.Text        = model.Introduction;
                DDLBrand.SelectedValue     = model.BrandID.ToStr();
                ProPic.Url                 = model.PicUrl;
                ProImg.Url                 = model.ImgUrl;
                TbPurchasPrice.Text        = model.PurchasPrice.ToStr();
                TbMarketPrice.Text         = model.MarketPrice.ToStr();
                TbSalesPrice.Text          = model.SalesPrice.ToStr();
                TbColor.Text               = model.Color;
                FckDesc.Value              = model.ProDesc;
                FckPakingList.Value        = model.PakingList;
                FckSalesService.Value      = model.CustomerService;
                TbOrderBy.Text             = model.OrderBy.ToStr();
                TbKeyWord.Text             = model.KeyWord;
                TbClickCount.Text          = model.ClickCount.ToStr();
                CheckBoxIsHidden.Checked   = model.IsHidden;
                DDLVouchType.SelectedValue = model.VouchType.ToStr();
                TbDate.Text                = model.AddDate.ToString();

                foreach (ListItem li in CheckBoxListMark.Items)
                {
                    if (model.Mark.Contains(li.Value))
                    {
                        li.Selected = true;
                    }
                }

                //绑定子商品
                RepChildList.DataSource = GetChildProducts(model.ID);
                RepChildList.DataBind();
            }
        }
    }