Пример #1
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        try
        {
            //This is the button where we add a laptop to our cart
            // AddToCart.Service1Client add = new AddToCart.Service1Client();
            AddToCartService.Service1Client add = new AddToCartService.Service1Client();
            int sum      = add.addCart(900);
            int quantity = add.getQuantity(Convert.ToInt32(TextBox3.Text));
            count_laptop = quantity;
            final_sum    = final_sum + (sum * quantity);
            // final_sum += add.addCart(900);
            int    product_id   = add.getProductId(Label3.Text);
            string confirmation = "The item has been successfully added into the cart and the product id is " + product_id;
            Label5.Text   = confirmation;
            TextBox1.Text = Convert.ToString(final_sum);


            /*
             * myCookies["FinalPrice"] = TextBox1.Text;
             * myCookies.Expires = DateTime.Now.AddDays(20);
             * Response.Cookies.Add(myCookies);
             */
        }
        catch (Exception ex)
        {
            Label5.Text = ex.Message;
        }
    }
Пример #2
0
    protected void Button9_Click(object sender, EventArgs e)
    {
        //This is the button where we add a computer to our cart
        // AddToCart.Service1Client add = new AddToCart.Service1Client();
        try{
            AddToCartService.Service1Client add = new AddToCartService.Service1Client();
            int sum      = add.addCart(30);
            int quantity = add.getQuantity(Convert.ToInt32(TextBox5.Text));
            mouse     = quantity;
            final_sum = final_sum + (sum * quantity);
            // final_sum += add.addCart(700);
            int    product_id   = add.getProductId(Label13.Text);
            string confirmation = "The item has been successfully added into the cart and the product id is " + product_id;
            // string confirmation = "The item has been successfully added into the cart";
            Label5.Text   = confirmation;
            TextBox1.Text = Convert.ToString(final_sum);
        }

        catch (Exception ex)
        {
            Label5.Text = ex.Message;
        }
    }