Esempio n. 1
0
        private void QuantityUpDown_ValueChanged(object sender, EventArgs e)
        {
            TotalPriceTxtLb.Show();
            int    quant      = Convert.ToInt32(QuantityUpDown.Value);
            String UPtxt      = UnitPriceTxtLb.Text.Replace("€", "");
            int    quantprice = Convert.ToInt32(UPtxt);

            TotalPriceTxtLb.Text = (quantprice * quant).ToString() + "€";
        }
Esempio n. 2
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            if (QuantityUpDown.Value != 0)
            {
                bool sameItem = false;

                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    string item = row.Cells[0].Value.ToString();
                    if (item == ItemTxtLb.Text)
                    {
                        sameItem = true;
                    }
                }


                if (sameItem == false)
                {
                    var index = dataGridView1.Rows.Add();

                    dataGridView1.Rows[index].Cells[0].Value = ItemTxtLb.Text;
                    dataGridView1.Rows[index].Cells[1].Value = UnitPriceTxtLb.Text;
                    dataGridView1.Rows[index].Cells[2].Value = QuantityUpDown.Value;
                    dataGridView1.Rows[index].Cells[3].Value = TotalPriceTxtLb.Text;
                    dataGridView1.Rows[index].Cells[4].Value = orderID;

                    dataGridView1.ClearSelection();

                    string TPtxt = TotalPriceTxtLb.Text.Replace("€", "");
                    totalprice  += Convert.ToInt32(TPtxt);
                    ValueLb.Text = totalprice.ToString() + "€";

                    QuantityUpDown.Value = 0;
                    UnitPriceTxtLb.ResetText();
                    TotalPriceTxtLb.ResetText();
                    ItemTxtLb.ResetText();
                    QuantityUpDown.Hide();
                    listBox.ClearSelected();
                }
                else
                {
                    MessageBox.Show("You cant add the same item", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("You cant add 0 items", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 3
0
        private void PlaceOrderUC_Load(object sender, EventArgs e)
        {
            ItemTxtLb.Hide();
            TotalPriceTxtLb.Hide();
            TotalPriceTxtLb.Text = "";
            UnitPriceTxtLb.Hide();
            QuantityUpDown.Hide();



            query = "select distinct category from items";
            DataSet ds = db.getData(query);

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                CategoryBox.Items.Add(ds.Tables[0].Rows[i][0].ToString());
            }
        }
Esempio n. 4
0
        private void listBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            QuantityUpDown.Value = 0;
            TotalPriceTxtLb.ResetText();



            ItemTxtLb.Show();
            UnitPriceTxtLb.Show();
            String text = listBox.GetItemText(listBox.SelectedItem);

            ItemTxtLb.Text = text;
            query          = "select price from items where name = '" + text + "'";

            DataSet ds = db.getData(query);

            try
            {
                UnitPriceTxtLb.Text = ds.Tables[0].Rows[0][0].ToString() + "€";
                QuantityUpDown.Show();
            }
            catch { UnitPriceTxtLb.Hide(); }
        }