Пример #1
0
        protected void btn_UpdateQuantity_Click(object sender, EventArgs e)
        {
            if (User.IsInRole("admin"))
            {
                int    quantity     = Convert.ToInt32(txtbox_quantity.Text);
                int    oldquantity  = Convert.ToInt32(lbl_ProductInStock.Text);
                string productTitle = lbl_ProductTitle.Text;

                //For debugging
                //System.Diagnostics.Debug.WriteLine("In stock: " + oldquantity);

                I_EshopserviceClient client = new I_EshopserviceClient();
                client.UpdateQuantity(productTitle, quantity, oldquantity);

                Response.Redirect(Request.RawUrl);  //reloads the page
            }
        }
Пример #2
0
        protected void btn_UpdateProducts_Click(object sender, EventArgs e)
        {
            I_EshopserviceClient client = new I_EshopserviceClient();

            foreach (RepeaterItem item in Repeater_OutOfStock.Items)
            {
                TextBox QuantityBox = new TextBox();
                QuantityBox = (TextBox)item.FindControl("txtBox_Quantity");
                int quantity = Convert.ToInt32(QuantityBox.Text);

                Label lbl_ProductTitle = new Label();
                lbl_ProductTitle = (Label)item.FindControl("lbl_ProductTitle");
                string productName = lbl_ProductTitle.Text;

                client.UpdateQuantity(productName, quantity, 0);
            }

            Response.Redirect(Request.RawUrl);
        }