private void BtnBuscar_Click(object sender, RoutedEventArgs e) { if (rbCancelarReserva.IsChecked == true) { ReservasBLL resBLL = new ReservasBLL(); int rutCliente = Int32.Parse(txtrut.Text); dtgReservas.ItemsSource = resBLL.GetReservasByRut(rutCliente).DefaultView; if (dtgReservas.Items.Count == 0) { MessageBox.Show("El cliente no tiene reservas Registradas"); } else { } dtgReservas.IsEnabled = true; dtgReservas.IsReadOnly = true; } else if (rbNuevaReserva.IsChecked == true) { ClienteBLL cliBLL = new ClienteBLL(); int rut = int.Parse(txtrut.Text); clienteexiste = cliBLL.getCliente(rut); if (clienteexiste) { dtpFecha.IsEnabled = true; cbHora.IsEnabled = true; cbMinuto.IsEnabled = true; lbApellido.Visibility = Visibility.Hidden; lbNom.Visibility = Visibility.Hidden; lbEmail.Visibility = Visibility.Hidden; txtApe.Visibility = Visibility.Hidden; txtNom.Visibility = Visibility.Hidden; txtEmail.Visibility = Visibility.Hidden; } else { lbApellido.Visibility = Visibility.Visible; lbNom.Visibility = Visibility.Visible; lbEmail.Visibility = Visibility.Visible; txtApe.Visibility = Visibility.Visible; txtNom.Visibility = Visibility.Visible; txtEmail.Visibility = Visibility.Visible; } dtgReservas.IsEnabled = true; dtgReservas.IsReadOnly = true; } }
private void Checkoutbutton_Click(object sender, EventArgs e) { int id; int.TryParse(IdnumericUpDown.Text, out id); Limpiar(); if (ReservasBLL.checkout(id)) { MessageBox.Show("Habitacion disponible"); } else { MyErrorProvider.SetError(IdnumericUpDown, "No existe."); } }
private void Eliminarbutton_Click(object sender, EventArgs e) { MyErrorProvider.Clear(); int id; int.TryParse(IdnumericUpDown.Text, out id); Limpiar(); if (ReservasBLL.Eliminar(id)) { MessageBox.Show("Eliminado"); } else { MyErrorProvider.SetError(IdnumericUpDown, "No existe."); } }
private void Checkinbutton_Click(object sender, EventArgs e) { Reservas r = new Reservas(); bool paso; if (!ExisteEnLaBaseDeDatos()) { paso = false; } paso = ReservasBLL.checkins(); if (paso) { MessageBox.Show("Habitacion Reservas", "Hotel Software", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se reservo esta ocupada", "Hotel Software", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Guardarbutton_Click(object sender, EventArgs e) { Reservas v = new Reservas(); bool paso = false; if (!Validar()) { return; } v = LlenaClase(); if (IdnumericUpDown.Value == 0) { paso = ReservasBLL.Guardar(v); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se puede guardar.", "Hotel Software", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = ReservasBLL.Modificar(v); } if (paso) { MessageBox.Show("Guardado", "Hotel Software", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No fue posible guardar", "Hotel Software", MessageBoxButtons.OK, MessageBoxIcon.Error); } Limpiar(); }
private void Button_Click(object sender, RoutedEventArgs e) { if (rbNuevaReserva.IsChecked == true) { DateTime?fecha = dtpFecha.SelectedDate; if (fecha.HasValue) { bool createcli = false; if (clienteexiste == false && txtNom.Text.Length > 0 && txtApe.Text.Length > 0 && txtEmail.Text.Length > 0) { usuarioBLL usrBLL = new usuarioBLL(); createcli = usrBLL.CreateCliente(Int32.Parse(txtrut.Text), txtNom.Text, txtApe.Text, txtEmail.Text); if (createcli) { clienteexiste = true; } } if (clienteexiste == true && cbHora.SelectedIndex != 0 && cbMinuto.SelectedIndex > 0) { string formatted = fecha.Value.ToString("dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); string hora = cbHora.Text; string minuto = cbMinuto.Text; formatted += " " + hora + ":" + minuto + ":00"; DateTime fechahora = DateTime.Parse(formatted); int numMesa = int.Parse(txtIdReserva.Text); ReservasBLL resBLL = new ReservasBLL(); int rut = int.Parse(txtrut.Text); bool stado = resBLL.InsertReserva(rut, fechahora, numMesa); if (stado) { MessageBox.Show("Reserva Ingresada Correctamente"); } else { MessageBox.Show("Ocurrio un error al Ingresar la Reserva"); } } } else { MessageBox.Show("ingrese un valor para la fecha"); } } else if (rbCancelarReserva.IsChecked == true) { if (txtIdReserva.Text.Length > 0) { int idreserva = Int32.Parse(txtIdReserva.Text); ReservasBLL resBLL = new ReservasBLL(); if (resBLL.DeleteReserva(idreserva)) { MessageBox.Show("Reserva Eliminada Correctamente"); } else { MessageBox.Show("Ocurrio un error al eliminar la resevra"); } } } }