コード例 #1
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     ClearAll();
     if (txtBookingNo.Text.Equals(string.Empty))
     { //Check if the text box is empty or not
         MessageBox.Show("Please enter the booking NO", "Invalid Booking No", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         // Check if the booking No is exists in the booking list
         DBConnect Check   = new DBConnect();
         bool      success = Check.CheckBooking(txtBookingNo.Text);
         if (success == true)
         {                              //Set the booking values on the fields and comboboxes
             string status = FieldsValues(txtBookingNo.Text);
             if (status == "Cancelled") //checking if the booking has cancelled before or not
             {
                 MessageBox.Show("The entered booking No had been cancelled before", "Invalid Booking No", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             else if (status == "Successful")
             {
                 MessageBox.Show("The entered booking No was already paid the whole amount", "Invalid Booking No", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             else
             {
                 gBoxDetails.Visible = true;
             }
         }
         else
         {
             MessageBox.Show("Booking No not exist in the booking list", "Invalid Booking NO", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
コード例 #2
0
        private void btnCheck_Click(object sender, EventArgs e)
        {// Check if the booking No is exists in the booking list in database
            DBConnect Check   = new DBConnect();
            bool      success = Check.CheckBooking(txtBookingNo.Text);

            if (success == true)
            { // Show the booking details to make sure that it is the correct booking to cancel it
                gropboxDetails.Visible = true;
                FieldsValues(txtBookingNo.Text);
            }
            else
            {
                MessageBox.Show("Booking No not exist in the booking list", "Invalid Booking NO", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }