Exemplo n.º 1
0
 private void btnCreateCustomer1_Click(object sender, EventArgs e)
 {
     isClicked                 = true;
     myCustomer.customerID     = txtGuestID.Text;
     myCustomer.bookedIDFK     = txtBookingIDFK.Text;
     myCustomer.firstName      = txtFname.Text;
     myCustomer.lastName       = txtLname.Text;
     myCustomer.address        = txtAddress.Text;
     myCustomer.phone          = txtPhone.Text;
     myCustomer.licence        = txtDriverLicense.Text;
     myCustomer.gender         = txtGender.Text;
     myCustomer.city           = txtCity.Text;
     myCustomer.country        = txtCountry.Text;
     myCustomer.bookedFromDate = AllBookings.bookedFrom;
     myCustomer.bookedToDate   = AllBookings.bookedTo;
     myCustomer.balance        = AllBookings.BookingCost(AllBookings.roomType);
     myCustomer.InsertCustomer();
     MessageBox.Show("CustomerID " + txtGuestID.Text + " is added.");
 }
Exemplo n.º 2
0
        private void btnCreateReservation_Click(object sender, EventArgs e)
        {
            Boolean           insertedSuccess;
            string            message = "Please create new customer first!";
            string            caption = "Reservation Failed";
            MessageBoxButtons button  = MessageBoxButtons.OK;

            if (AllBookings.isbtnCreateCustomerClicked == true)
            {
                //AllBookings.roomType = Convert.ToString(cmbRoomTypes.SelectedItem);
                AllBookings.bookedFrom = dateTPBookFrom.Value;
                AllBookings.bookedTo   = dateTPBookTo.Value;
                AllBookings.roomCost   = AllBookings.BookingCost(room_Type);
                insertedSuccess        = AllBookings.InsertBooking();
                if (insertedSuccess == true)
                {
                    AllBookings.isbtnCreateCustomerClicked = false; // Reset button create customer to false
                    txtBookingReference.Text  = "";
                    txtNumOfGuest.Text        = "";
                    txtNumOfFreeRooms.Text    = "";
                    cmbRoomTypes.SelectedItem = "";
                    MessageBox.Show("Booking Reference " + txtBookingReference.Text + " is added.");
                }
                else
                {
                    AllBookings.isbtnCreateCustomerClicked = false; // Reset button create customer to false
                    txtBookingReference.Text  = "";
                    txtNumOfGuest.Text        = "";
                    txtNumOfFreeRooms.Text    = "";
                    cmbRoomTypes.SelectedItem = "";
                    MessageBox.Show("Insert booking failed");
                }
            }
            else
            {
                MessageBox.Show(message, caption, button);
            }
        }