private void Alta_Load(object sender, EventArgs e) { //FormHandler.listarHoteles(comboBoxHotel); FormHandler.listarTipoHabitacion(comboBoxTipoHabitacion); FormHandler.listarTipoUbicacion(comboBoxUbicacion); //comboBoxHotel.SelectedIndex = -1; comboBoxTipoHabitacion.SelectedIndex = -1; comboBoxUbicacion.SelectedIndex = -1; if (Login.Login.LoggedUserSessionHotelID == -1) { var result = new AbmHotel.Listado().ShowDialog(); if (result == System.Windows.Forms.DialogResult.Abort) {// FALLO LA OBTENCION! MessageBox.Show("Fallo en la obtención de un Hotel", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } else if (result == System.Windows.Forms.DialogResult.Cancel) // USUARIO CERRO LA VENTANA! { MessageBox.Show("Se ha cerrado la ventana sin seleccionar un Hotel", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } } try { var nombreHotel = new QueryBuilder(QueryBuilder.QueryBuilderType.SELECT). Fields("nombre").Table("MATOTA.Hotel").AddEquals("idHotel", Login.Login.LoggedUserSessionHotelID.ToString()); textBoxHotel.Text = DBHandler.Query(nombreHotel.Build()).First()["nombre"].ToString(); } catch (Exception) { MessageBox.Show("Ocurrió un error al agregar el nombre del hotel.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void buttonBuscarHotel_Click(object sender, EventArgs e) { var selector = new AbmHotel.Listado(false); if (selector.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { hotel = selector.SelectedHotel; textBoxHotel.Text = hotel.nombre; } }
private void seleccionarHotelBtn_Click(object sender, EventArgs e) { var abmHotel = new AbmHotel.Listado(true); abmHotel.ShowDialog(); if (abmHotel.DialogResult == DialogResult.OK) { Hotel = abmHotel.ObjetoResultado; this.hotelInput.Text = Hotel.Nombre; } }
public Listado() { InitializeComponent(); habitaciones = new List <string>(); if (Login.Login.LoggedUsedID == -1) { textBoxHotel.Hide(); FormHandler.setHotelesHabilitados(comboBoxHotel); comboBoxHotel.SelectedIndex = -1; } else { comboBoxHotel.Hide(); try { var nombreHotel = new QueryBuilder(QueryBuilder.QueryBuilderType.SELECT). Fields("nombre").Table("MATOTA.Hotel").AddEquals("idHotel", Login.Login.LoggedUserSessionHotelID.ToString()); textBoxHotel.Text = DBHandler.Query(nombreHotel.Build()).First().Values.First().ToString(); } catch (Exception) { MessageBox.Show("Seleccione un hotel en el que quiera realizar la reserva.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); var result = new AbmHotel.Listado().ShowDialog(); idHotel = Login.Login.LoggedUserSessionHotelID.ToString(); if (result == System.Windows.Forms.DialogResult.Cancel) { MessageBox.Show("Se ha cerrado la ventana sin seleccionar un Hotel", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Load += cerrarFormEnConstructor; } else { var nombreHotel = new QueryBuilder(QueryBuilder.QueryBuilderType.SELECT). Fields("nombre").Table("MATOTA.Hotel").AddEquals("idHotel", Login.Login.LoggedUserSessionHotelID.ToString()); try { textBoxHotel.Text = DBHandler.Query(nombreHotel.Build()).First().Values.First().ToString(); } catch (Exception) { MessageBox.Show("Error al obtener nombre de hotel.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } } } }
private void buttonAgregarHotel_Click(object sender, EventArgs e) { var selector = new AbmHotel.Listado(false); if (selector.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { AbmHotel.Hotel hotel = selector.SelectedHotel; if (!estaSeleccionadoHotel(hotel)) { this.dataGridViewHoteles.Rows.Add(hotel.idHotel.ToString(), hotel.nombre.ToString(), "Remover"); } else { MessageBox.Show("Ya elegiste ese hotel.\n\nElija un hotel distinto por favor.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }