예제 #1
0
        private void btnEnter_Click_1(object sender, EventArgs e)
        {
            DBConnect Srch = new DBConnect(); //connect to database

            if (cmbSearch.Text == "Tour Package" && cmbLocation.SelectedIndex != -1)
            {
                dataGVResult.DataSource = Srch.Package(cmbLocation.Text); // result of Package
                dataGVHotel.DataSource  = Srch.Hotel(cmbLocation.Text);   // result of available hotels
                dataGVResult.Visible    = true;
                lblHotel.Visible        = true;
                dataGVHotel.Visible     = true;
            }
            else if (cmbSearch.Text == "Hotel" && cmbLocation.SelectedIndex != -1)
            {
                dataGVResult.DataSource = Srch.HotelRoom(cmbLocation.Text); // result of available hotels
                dataGVResult.Visible    = true;
                lblHotel.Visible        = false;
                dataGVHotel.Visible     = false;
            }
            else if (cmbSearch.SelectedIndex == -1)
            {
                MessageBox.Show("Please choose the type of search", "Invalid Search", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }