예제 #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (uploadProductPhoto.PostedFile != null)
            {
                SaveProductPhoto();

                ShoppingCart k = new ShoppingCart()
                {
                    ProductName        = txtProductName.Text,
                    ProductImage       = "~/ProductImages/" + uploadProductPhoto.FileName,
                    ProductPrice       = txtProductPrice.Text,
                    ProductDescription = txtProductDescription.Text,
                    CategoryID         = Convert.ToInt32(ddlCategory.SelectedValue),
                    TotalProducts      = Convert.ToInt32(txtProductQuantity.Text)
                };

                k.AddNewProduct();
                // Alert.show("Record Saved Successfully");
                ClearText();
                Response.Redirect("~/Admin/AddNewProducts.aspx?alert=success");
            }
            else
            {
                // Alert.Show("Upload Product Photo");
                Response.Write("<script>alert('Please upload photo');</script>");
            }
        }
예제 #2
0
        protected void btnsubmit_Click(object sender, EventArgs e)
        {
            if (uploadproductphoto.PostedFile.ContentLength > 0)
            {
                SaveProductPhoto();

                ShoppingCart SC = new ShoppingCart
                {
                    ProductName        = txtproductname.Text,
                    ProductPrice       = productprice.Text,
                    ProductDescription = txtproductdesription.Text,
                    ProductImage       = "~/ProductImage/" + uploadproductphoto.FileName,
                    categoryID         = Convert.ToInt32(ddlcategory.SelectedValue)
                };

                SC.AddNewProduct();
                string message = "Product Added successfully";
                ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", message);
            }
            else
            {
                string message = "Select the product Image";
                ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", message);
            }
        }
예제 #3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (uploadProductPhoto.PostedFile != null)
            {
                SaveProductPhoto();

                ShoppingCart k = new ShoppingCart
                {
                    ProductName        = txtProductName.Text,
                    ProductImage       = "~/ProductImages/" + uploadProductPhoto.FileName,
                    ProductPrice       = txtProductPrice.Text,
                    ProductDescription = txtProductDescription.Text,
                    CategoryID         = Convert.ToInt32(ddlCategory.SelectedValue)
                };
                k.AddNewProduct();
                ClearText();
            }
            else
            {
            }
        }
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     if (uploadPodutPhoto.PostedFile != null)
     {
         SaveProductPhoto();
         ShoppingCart k = new ShoppingCart()
         {
             ProductName        = txtProductName.Text,
             ProductDescription = txtProductDescription.Text,
             ProductPrice       = txtProductPrice.Text,
             ProductImage       = "~/ProductImages/" + uploadPodutPhoto.FileName,
             CategoryID         = Convert.ToInt32(ddlCatagory.SelectedValue),
             ProductQuantity    = Convert.ToInt32(txtProductQuantity.Text)
         };
         k.AddNewProduct();
         ClearText();
         Response.Redirect("~/Admin/AddNewProducts.aspx?alert=sucess");
     }
     else
     {
         Response.Write("<Script>alert('Please Upload Photo')</Script>");
     }
 }
예제 #5
0
 protected void btnProductSubmit_Click(object sender, EventArgs e)
 {
     if (UploadProductImage.PostedFile != null)
     {
         SaveProductImage();
         ShoppingCart k = new ShoppingCart()
         {
             ProductName        = tbProductName.Text,
             ProductImage       = "~/ProductImages/" + UploadProductImage.FileName,
             ProductPrice       = tbProductPrice.Text,
             ProductDescription = tbProductDescription.Text,
             CategoryId         = Convert.ToInt32(ddlCategory.SelectedValue),
             TotalProducts      = Convert.ToInt32(tbProductQuantity.Text)
         };
         k.AddNewProduct();
         ClearText();
         Response.Redirect("~/Admin/AddProducts.aspx?alert=success");
     }
     else
     {
         Response.Write("<script>alert('Please upload image');</script>");
     }
 }