Beispiel #1
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.Hide();
            ReservaBusqueda reserva_busqueda = new ReservaBusqueda();

            reserva_busqueda.codigo_reserva = "";
            reserva_busqueda.hotel_id       = codigo_hotel;
            reserva_busqueda.StartPosition  = FormStartPosition.CenterScreen;
            reserva_busqueda.Show();
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBoxReserva.Text.Length == 0)
            {
                MessageBox.Show("Primero debes elegir una opción.");
            }
            else if (comboBoxReserva.Text == "Modificar Reserva" && textBoxCodigoReserva.Text.Length == 0)
            {
                MessageBox.Show("Primero debes ingresar un código de reserva valido.");
            }
            else if (comboBoxReserva.Text == "Generar Reserva" && comboBoxHotel.Text.Length == 0 && Variables.tipo_usuario == "Guest")
            {
                MessageBox.Show("Primero debes seleccionar un hotel.");
            }
            else if (comboBoxReserva.Text == "Generar Reserva")
            {
                //CREAR RESERVA
                this.Hide();
                ReservaBusqueda busqueda_reserva = new ReservaBusqueda();
                if (Variables.tipo_usuario == "Guest")
                {
                    busqueda_reserva.hotel_id = lista_codigos_hoteles[comboBoxHotel.SelectedIndex].ToString();
                }
                else
                {
                    busqueda_reserva.hotel_id = Variables.hotel_id.ToString();
                }
                busqueda_reserva.codigo_reserva = "";
                busqueda_reserva.StartPosition  = FormStartPosition.CenterScreen;
                busqueda_reserva.ShowDialog();
            }
            else
            {
                //EDITAR RESERVA
                try
                {
                    string query = "select * from GITAR_HEROES.Reserva where codigo = " + textBoxCodigoReserva.Text;
                    command            = new SqlCommand(query);
                    command.Connection = connection;
                    adapter            = new SqlDataAdapter(command);
                    dataTable          = new DataTable();
                    adapter.Fill(dataTable);

                    if (dataTable.Rows.Count > 0)
                    {
                        this.Hide();
                        EditarReserva editar_reserva = new EditarReserva();
                        editar_reserva.codigo_reserva = textBoxCodigoReserva.Text;
                        editar_reserva.hotel_id       = dataTable.Rows[0]["codigo_hotel"].ToString();
                        editar_reserva.StartPosition  = FormStartPosition.CenterScreen;
                        editar_reserva.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("Error: No existe ningun código de reserva con ese número.");
                    }
                }
                catch (Exception exc)
                {
                    MessageBox.Show("Error: " + exc);
                }
            }
        }