protected void Button2_Click(object sender, EventArgs e)
        {
            ProductService.IproductsClient client = new ProductService.IproductsClient();
            ProductService.Product         p      = new ProductService.Product();

            string t1 = TextBox1.Text;
            string t2 = TextBox2.Text;
            string t3 = TextBox3.Text;
            string t4 = TextBox4.Text;
            string t5 = TextBox5.Text;

            if (t1 == "" || (t2 == "" || (t3 == "" || (t4 == "" || t5 == ""))))
            {
                Label1.Text      = "Please fill All details!!";
                Label1.BackColor = System.Drawing.Color.Red;
            }
            else
            {
                p.ProductId    = Convert.ToInt32(t1);
                p.ProductName  = t2;
                p.ProductPrice = Convert.ToInt32(t3);
                p.Quantity     = Convert.ToInt32(t4);
                p.Description  = t5;

                client.UpdateProductDetails(p);
                Label1.Text      = "Product Updated!!";
                Label1.BackColor = System.Drawing.Color.Green;
            }
        }
        protected void Button6_Click(object sender, EventArgs e)
        {
            ProductService.IproductsClient client = new ProductService.IproductsClient();
            ProductService.Bill            b      = new ProductService.Bill();
            b.date  = DateTime.Today;
            b.total = total;
            int id2 = client.StoreBill(b);

            string        connetionString;
            SqlConnection cnn;

            connetionString = @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=ShopDatabase;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";
            cnn             = new SqlConnection(connetionString);
            cnn.Open();

            foreach (var itm1 in lst1)
            {
                int p = client.GetProductPrice(itm1.Key);
                ProductService.Product p1 = client.GetProduct(itm1.Key);
                ProductService.Product p2 = new ProductService.Product();
                p2.ProductId    = p1.ProductId;
                p2.ProductName  = p1.ProductName;
                p2.ProductPrice = p2.ProductPrice;
                p2.Description  = p1.Description;
                p2.Quantity     = itm1.Value;
                client.UpdateProductDetails(p2);

                var sql = "INSERT INTO History(BillNo,Productid,Price,Quantity,Total) VALUES(@billno,@pid,@pprice,@qun,@tot)";
                using (var cmd = new SqlCommand(sql, cnn))
                {
                    cmd.Parameters.AddWithValue("@billno", id2);
                    cmd.Parameters.AddWithValue("@pid", itm1.Key);
                    cmd.Parameters.AddWithValue("@pprice", p);
                    cmd.Parameters.AddWithValue("@qun", itm1.Value);
                    cmd.Parameters.AddWithValue("@tot", p * itm1.Value);

                    cmd.ExecuteNonQuery();
                }
            }


            cnn.Close();



            Label4.Text  = "Wohoo! Purchase is successful!!! and Your Invoice number is:";
            Label4.Text += id2.ToString();
            total        = 0;
            Label5.Text  = total.ToString();
            foreach (ListItem itm3 in ListBox2.Items)
            {
                ListBox1.Items.Add(itm3);
            }
            ListBox2.Items.Clear();
            lst1.Clear();
        }