示例#1
0
        private void btnCheckIfExists_Click(object sender, EventArgs e)
        {
            if (txtID.Text == "")
            {
                MessageBox.Show("Please fill in missing ID/Passport");
            }
            else
            {
                aGuest = guestController.Find(txtID.Text.Trim());
                int index = guestController.FindIndex(aGuest);
                if (aGuest.IdPassport != txtID.Text)
                {
                    MessageBox.Show("Guest Does not exist. Please create new record.");
                    switchToGuestDetailsPanel();
                }
                else
                {
                    if (guestController.myownfindmethod(txtID.Text) == true)
                    {
                        MessageBox.Show("Guest found.");
                        viewRetrievedGuestDetails(index);
                        switchToGuestDetailsPanel();

                        // add id/passport attribute to reservation
                        reservationController.Reservation.IdPassport = txtID.Text;

                        // show payment form

                        PaymentForm paymentForm = new PaymentForm(restEasy, reservationController, aGuest);
                        paymentForm.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Guest Does not exist. Please create new record.");
                        switchToGuestDetailsPanel();
                    }
                }
            }
        }