Example #1
0
        private void BtnHReservar_Click(object sender, RoutedEventArgs e)
        {
            ServiceCliente cli = new ServiceCliente();
            Cliente        c   = new Cliente();
            ServiceReserva res = new ServiceReserva();
            Reserva        r   = new Reserva();

            try
            {
                c.RutCliente = txtRutClienteBook.Text;
                rutCliente   = c.RutCliente;
                c.Nombre     = txtNombreBook.Text;
                c.Apellidos  = txtApellidosBook.Text;
                c.Email      = txtEmailBook.Text;
                c.Direccion  = txtDireccionBook.Text;
                c.Telefono   = txtTelefonoBook.Text;

                cli.AgregarEntidad(c);
            }
            catch (Exception)
            {
                MessageBox.Show("Cliente ya existe en la base de datos");
            }


            try
            {
                r.IdReserva      = DateTime.Now.ToString("yyyyMMddHHmm");
                r.RutCliente     = rutCliente;
                r.FechaIngreso   = dpLlegadaBook.Text;
                r.FechaSalida    = dpSalidaBook.Text;
                r.TipoHabitacion = comboTipoHabitacionBook.Text;
                r.CantHuespedes  = comboCantPersonasBook.SelectedIndex;
                NumReserva       = r.IdReserva;
                res.AgregarEntidad(r);
                MessageBox.Show("Reserva exitosa\n" + "Numero Reserva :" + NumReserva, "Hotel Harmann");
                LimpiarVentanaReserva();
                tabControl.SelectedIndex = 0;
            }
            catch (Exception)
            {
                MessageBox.Show("Reserva ya existe en la base de datos");
            }
        }