示例#1
0
        private void btnProceed_Click(object sender, EventArgs e)
        {
            decimal value = 0;

            //checks if entered value can be decimal or not
            if (decimal.TryParse(txtBoxAmount.Text, out value))
            {
                txtBoxAmount.Text = String.Format("{0:0.00}", value);
                //setting paid amount
                cashPayment.PaidAmt = value;
            }

            //check if amount fully paid
            if (cashPayment.IsPaid())
            {
                lblError.Hide();
                ReceiptForm receiptPage = new ReceiptForm(user, cartItems, totalAmount, dineOrTakeAway, cashPayment, tax);
                this.Hide();
                receiptPage.ShowDialog();
                this.Close();
            }
            else
            {
                lblError.Show();
            }
            lblError.Text = "Paid amount is less than total amount.";
        }
示例#2
0
        private void btnCreditCard_Click(object sender, EventArgs e)
        {
            CreditCard  cardPayment = new CreditCard(totalAmount);
            ReceiptForm receiptPage = new ReceiptForm(user, cartItems, totalAmount, dineOrTakeAway, cardPayment, tax);

            this.Hide();
            receiptPage.ShowDialog();
            this.Close(); //close previous form
        }