Ejemplo n.º 1
0
        //Completes the payment, checkout
        private void btnCheckOut_Click(object sender, EventArgs e)
        {
            //Price * count + VAT calculation is happening here
            order.TotalCost = order.CalculateTotalPrice() + os.CalculateVAT(order);

            //If the input is not a number, it goes as 0 to the DB
            if (!System.Text.RegularExpressions.Regex.IsMatch(txtBoxTip.Text, @"^-?(([1-9]\d*)|0)(.0*[1-9](0*[1-9])*)?$"))
            {
                order.Tip = 0;
            }
            else
            {
                order.Tip = decimal.Parse(txtBoxTip.Text);
            }

            //Saves the comment
            order.Feedback = txtBoxComment.Text;

            os.CompleteOrder(order);

            //Shows Payment was successfull message
            MessageBox.Show("Payment was succesfully completed.", "Payment Succesful!", MessageBoxButtons.OK, MessageBoxIcon.Information);

            Overview overview = new Overview(employee);

            overview.Show();
            this.Close();
        }