示例#1
0
 public void AddToCart(int quantity)
 {
     Quantity.Clear();
     Quantity.SendKeys("" + quantity);
     AddToCartButton.Click();
     Thread.Sleep(1000);
 }
示例#2
0
        private void Refresh_Click(object sender, EventArgs e)
        {
            Product.Items.Clear();
            Quantity.Clear();
            Products_lb.Items.Clear();
            Description.Clear();
            string        query = "select p.Make + ' ' + p.model from products p, order_details od, orders o where o.ordersID =" + OrderID.Text.ToString() + "and o.ordersID = od.orders_ordersID and od.products_productID = p.productID";
            SqlCommand    cmd   = new SqlCommand(query, con);
            SqlDataReader rd    = cmd.ExecuteReader();

            while (rd.Read() == true)
            {
                Product.Items.Add(rd[0]);
            }
            rd.Close();
            if (Product.Items.ToString() != null)
            {
                Quantity.Enabled       = false;
                Return_Replace.Enabled = false;
                Products_gb.Enabled    = true;
            }
            else
            {
                MessageBox.Show("Invalid Order ID");
            }
        }
示例#3
0
        private void Add_Click(object sender, EventArgs e)
        {
            using (SqlConnection Conect = new SqlConnection(@"Data Source=DESKTOP-78L61PQ\SQLEXPRESS;
            Initial Catalog=Sistema de Prestamos; Integrated Security=True;"))
            {
                int    Id;
                int    Quant;
                double Interest;
                int    Quotes;

                Id       = int.Parse(ClientId.Text);
                Quant    = int.Parse(Quantity.Text);
                Interest = int.Parse(InterestRate.Text);
                Quotes   = int.Parse(Quote.Text);


                Conect.Open();
                SqlCommand cmd = new SqlCommand("GenerateLoans", Conect);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@ClientId", Id);
                cmd.Parameters.AddWithValue("@Amount", Quant);
                cmd.Parameters.AddWithValue("@InterestRate", Interest);
                cmd.Parameters.AddWithValue("@feesamount", Quotes);
                cmd.ExecuteNonQuery();
                ClientId.Clear();
                Quantity.Clear();
                InterestRate.Clear();
                Quote.Clear();
                this.Hide();
            }
        }
示例#4
0
 private void RESET_Click(object sender, EventArgs e)
 {
     i++;
     Counter.Text = "Order Number: " + Convert.ToString(i);
     x            = 0; y = 0; sum = 0;
     Quantity.Clear();
     Item.Clear();
     tempcosttxtbox.Clear();
     listBox1.Items.Clear();
     listBox2.Items.Clear();
     listBox3.Items.Clear();
     listBox4.Items.Clear();
     barcodetxtbox.Clear();
 }
 private void button3_Click(object sender, EventArgs e)
 {
     textBox1.Text = "";
     item_name.Clear();
     Quantity.Clear();
     itemModel.Clear();
     itemPrice.Clear();
     itemSize.Clear();
     itemtotalprice.Clear();
     itemColor.Clear();
     purchaceprice.Clear();
     itemsaleprice.Clear();
     autoidgenerate();
 }
        private void Add_Click(object sender, EventArgs e)
        {
            if (ProductID.Text == "" || Quantity.Text == "" || ProductName.Text == "")
            {
                MessageBox.Show("Please provide all the details", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                Connect connectObj = new Connect();

                con = connectObj.connect();

                SqlCommand cmd = new SqlCommand("Insert into STOCK (PID,QUANTITY) values(@pID,@quantity);", con);

                cmd.Parameters.AddWithValue("@pid", ProductID.Text);
                cmd.Parameters.AddWithValue("@quantity", Quantity.Text);
                int i = cmd.ExecuteNonQuery();
                //If count is equal to 1, than show frmMain form
                if (i != 0)
                {
                    MessageBox.Show("Stock Insertion Successful!", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Stock Insertion Failed", "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                con.Close();
                //Clear all the fields
                ProductID.Clear();
                Quantity.Clear();
                ProductName.Clear();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Captions", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (con != null)
                {
                    con.Close();
                }
            }
        }
示例#7
0
        private void AddToCart_Click(object sender, EventArgs e)
        {
            int value;

            if (ProductName.Text == "")
            {
                MessageBox.Show(" Please Choose a Product", "Invaild Input", MessageBoxButtons.OK);
            }

            else if (int.TryParse(Quantity.Text, out value) == false || string.IsNullOrWhiteSpace(Quantity.Text) || Int32.Parse(Quantity.Text) <= 0 || (Get_Pro_QU() - Int32.Parse(Quantity.Text)) < 0)
            {
                MessageBox.Show(" Please enter Valid Quantity", "Invaild Input", MessageBoxButtons.OK);
            }
            else
            {
                string data    = string.Empty;
                bool   isExist = false;
                foreach (DataGridViewRow row in dataGridView1.Rows)    ///check if already exists - only 1 from each product
                {
                    data = Convert.ToString(row.Cells[1].Value);
                    if (Equals(ProductName.SelectedValue, data) == true)
                    {
                        isExist = true;
                    }
                }


                if (isExist == false)
                {
                    dataGridView1.Rows.Add(Category.Text, ProductName.Text, Quantity.Text, Product_Price() * (Int32.Parse(Quantity.Text)));
                    Total_Price     = Total_Price + (Product_Price() * (Int32.Parse(Quantity.Text)));
                    TotalPrice.Text = Convert.ToString(Total_Price);
                    Quantity.Clear();
                    ProductName.SelectedIndex = -1;
                }
                else
                {
                    MessageBox.Show(" You already ordered this product!", "Invaild Input", MessageBoxButtons.OK);
                }
            }
        }
示例#8
0
 private void clear_Click(object sender, EventArgs e)
 {
     ProductID.Clear();
     Productname.Clear();
     Quantity.Clear();
 }