Example #1
0
 protected virtual void ButtonAdd_OnClick(ButtonSubmitEventArgs e)
 {
     if (Submit != null)
     {
         Submit(this, e);
     }
 }
Example #2
0
 protected virtual void ButtonAdd_OnClick(ButtonSubmitEventArgs e)
 {
     if (Submit != null)
     {
         Submit(this, e);
     }
 }
Example #3
0
        public 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 args = new ButtonSubmitEventArgs(name, price, isDiscount, discount,
                                                 image, miniImage);


            ButtonAdd_OnClick(args);

            var goods = new Goods();

            goods.Name       = name;
            goods.Price      = price;
            goods.IsDiscount = isDiscount;

            if (discount > 0)
            {
                goods.Discount = discount;
            }

            goods.AdditionDate = DateTime.Now;

            var goodsImages = new GoodsImages();

            goodsImages.Image     = image;
            goodsImages.MiniImage = miniImage;

            GoodsActions goodsActions = new GoodsActions();

            goodsActions.AddGoods(goods, goodsImages, goodsID);
            Response.Redirect("~/Administrator/GoodsPreview.aspx");
        }
Example #4
0
        public 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 args = new ButtonSubmitEventArgs(name, price, isDiscount, discount,
                image, miniImage);


            ButtonAdd_OnClick(args);

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

            if (discount > 0)
            {
                goods.Discount = discount;    
            }
            
            goods.AdditionDate = DateTime.Now;

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

            GoodsActions goodsActions = new GoodsActions();
            goodsActions.AddGoods(goods, goodsImages, goodsID);
            Response.Redirect("~/Administrator/GoodsPreview.aspx");   
        }