public virtual void ButtonAdd_OnClick(ControlEventArgs e)
 {
     if (Click != null)
     {
         Click(this, e);
     }
 }
        protected void ButtonAdd_Click(object sender, EventArgs e)
        {
            string name = TextBoxName.Text;
            float price;
            float.TryParse(TextBoxPrice.Text, out price);
            bool isDiscount = CheckBox1.Checked;
            int discount;
            int.TryParse(TextBoxDiscount.Text, out discount);
            byte[] image = null;
            byte[] miniImage = null;

            if (FileUploadImage.HasFile)
            {
                image = FileUploadImage.FileBytes;
            }

            if (FileUploadMiniImage.HasFile)
            {
                miniImage = FileUploadMiniImage.FileBytes;
            }

            var goods = new Goods();
            goods.Name = name;
            goods.Price = price;
            goods.IsDiscount = isDiscount;

            if (discount > 0 && CheckBox1.Checked)
            {
                goods.Discount = discount;
            }
            else
            {
                goods.Discount = null;
            }

            var goodsImages = new GoodsImages();
            goodsImages.Image = image;
            goodsImages.MiniImage = miniImage;

            var args = new ControlEventArgs(name, price, isDiscount, discount, image, miniImage);
            GoodsActions goodsActions = new GoodsActions();
            goodsActions.SaveEditGoods(goods, goodsImages, goodsID);
            Response.Redirect("~/Administrator/GoodsPreview.aspx");        

            ButtonAdd_OnClick(args);
        }
Esempio n. 3
0
 void GoodsEditControl1_Click(object sender, ControlEventArgs e)
 {
         
 }