Beispiel #1
0
        private void quantity_KeyPress(object sender, KeyPressEventArgs e)
        {
            //error handler for numeric quantity
            bool result = error.checkNum(quantity.Text);
            //searching through data
            bool found = pos.orderExist(pointOfSale.Transactionlbl.Text, pointOfSale.pcode.ToString());

            if ((e.KeyChar == 13) && (quantity.Text != string.Empty))
            {
                if (pointOfSale.qty < int.Parse(quantity.Text))
                {
                    MessageBox.Show("Unable to proceed", "warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                double total = Convert.ToDouble(quantity.Text) * pointOfSale.price;
                //if quantity is numeric execute if not throw an error message
                if (result == true)
                {
                    //Search through the data if product exist during transaction
                    if (found == true)
                    {
                        //if qty is lessthan from input qty show error
                        if (pointOfSale.qty < (int.Parse(quantity.Text)) + pointOfSale.cart_qty)
                        {
                            MessageBox.Show("Unable to proceed!", "warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }

                        //adding quantity if already exist
                        pos.updateOrder(pointOfSale.pcode.ToString(), quantity.Text, total);
                        this.Hide();
                        pointOfSale.tableShow();
                        pointOfSale.textBox6.Clear();
                    }
                    else
                    {
                        //execute if product is not duplicated during transaction
                        pos.insertTransact(pointOfSale.pcode.ToString(),
                                           pointOfSale.Transactionlbl.Text,
                                           quantity.Text, total, pointOfSale.label1.Text);

                        this.Hide();
                        pointOfSale.tableShow();
                        //pointOfSale.transactionNo();
                        pointOfSale.textBox6.Clear();
                    }
                }
                else
                {
                    MessageBox.Show("Quantity should be numeric!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
 private void submit_Click(object sender, EventArgs e)
 {
     //MessageBox.Show(totalPrice.ToString());
     pos.discount(id.Text, discountAmount.Text, txtDiscount.Text, this, totalPrice);
     pointOfSale.tableShow();
 }