Beispiel #1
0
 public static bool ingresarEntrada(Estadia estadia)
 {
     int codReserva = estadia.CodigoReserva;
     string usr = estadia.Usuario_Ingreso.Usr;
     string inicio = estadia.Fecha_Ingreso;
     return executeProcedure("insertEstadia", codReserva, usr, inicio);
 }
Beispiel #2
0
 public static bool ingresarSalida(Estadia estadia)
 {
     int codReserva = estadia.CodigoReserva;
     string usr = estadia.Usuario_Egreso.Usr;
     string fin = estadia.Fecha_Egreso;
     return executeProcedure("updateEstadia", codReserva, usr, fin);
 }
Beispiel #3
0
        private void botonCheckIn_Click(object sender, EventArgs e)
        {
            if (textHuesped.Text != "")
            {

                if (reserva_seleccionada.Estado == 6) //Osea, ya tiene hecho el checkin
                {
                    showToolTip("La reserva ya posee realizado el checkIn", botonCheckIn, botonCheckIn.Location);
                    return;
                }
                if (!reservaCancelada()) //Y de paso la cancela si no cumple
                {
                    Estadia nueva_estadia = new Estadia();
                    nueva_estadia.CodigoReserva = reserva_seleccionada.CodigoReserva;
                    nueva_estadia.Fecha_Ingreso_struct = Globals.getFechaSistema();
                    nueva_estadia.Usuario_Ingreso = Globals.infoSesion.User;
                    if (!DAOEstadia.ingresarEntrada(nueva_estadia))
                    {
                        MessageBox.Show("Error al ingresar la reserva",
                            "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    //Ponemos que se efectivizo la reserva
                    reserva_seleccionada.Estado = 6;
                    if(!DAOReserva.actualizar(reserva_seleccionada))
                    {
                        MessageBox.Show("Error al ingresar la reserva",
                            "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    MessageBox.Show("Check In realizado correctamente. A continuacion, por favor busque los huespedes en el sistema. Si los mismos no existen, registrelos.",
                        "", MessageBoxButtons.OK);

                    //Ingresamos los huespedes a alojarse
                    new IngresoHuespedes().Show();
                    Globals.deshabilitarAnterior(this);
                }
            }
            else
                showToolTip("Debe ingresar un número de reserva para poder hacer el Check In", textEstadia, textEstadia.Location);

        }
Beispiel #4
0
        private void botonBuscar_Click(object sender, EventArgs e)
        {
            if (textEstadia.Text == "")
            {
                showToolTip("Ingrese un número de estadía.", textEstadia, textEstadia.Location);
                return;
            }
            Factura factura = DAOEstadia.obtenerFactura(Int32.Parse(textEstadia.Text));
            if (factura != null)
            {
                MessageBox.Show("Factura ya generada anteriormente. Por favor, seleccione otra Reserva", "", MessageBoxButtons.OK);
                return;
            }
            estadia = DAOEstadia.obtener(Int32.Parse(textEstadia.Text));
            reserva = DAOReserva.obtener(Int32.Parse(textEstadia.Text));
            if (estadia != null)
            {

                //Buscar y rellenar los valores
                dataGridFacturaEstadia.DataSource = DAOConsumible.obtenerTablaByEstadia(Int32.Parse(textEstadia.Text));
                double precioConsumibles = dataGridFacturaEstadia.Rows.Cast<DataGridViewRow>().Sum(X => Convert.ToInt32(X.Cells[4].Value));

                int cantPersonas_originales = DAOHabitacion.obtenerCantHabitacionesByReserva(reserva.CodigoReserva);
                double precioBase = Globals.obtenerPrecio(reserva.CodigoRegimen, cantPersonas_originales,
                    Globals.infoSesion.Hotel.Recargo);

                mostrarDatos(precioBase, precioConsumibles);

                DateTime eIngreso = (DateTime) estadia.Fecha_Ingreso_struct;
                DateTime eEgreso = (DateTime) estadia.Fecha_Egreso_struct;
                DateTime rIngreso = (DateTime)reserva.Fecha_Inicio_struct;
                DateTime rEgreso = (DateTime)reserva.Fecha_Fin_struct;
                mostrarDatosEstadia(eIngreso, eEgreso, rIngreso, rEgreso);                
                
                datosMostrados = true;
            }
            else
                showToolTip("Ingrese un número de estadía válido.", textEstadia, textEstadia.Location);
        }
Beispiel #5
0
 public static List<Estadia> transductor(DataTable tabla)
 {
     List<Estadia> lista = new List<Estadia>();
     if (tabla != null)
         foreach (DataRow fila in tabla.Rows)
         {
             //Transcribir
             Estadia estadia = new Estadia();
             estadia.CodigoReserva = Convert.ToInt32(fila["codReserva"]);
             estadia.Fecha_Ingreso_struct = Convert.ToDateTime(fila["fecIngreso"]);
             if (!(fila["fecEgreso"] is DBNull))
                 estadia.Fecha_Egreso_struct = Convert.ToDateTime(fila["fecEgreso"]);
             if (!(fila["usrEgreso"] is DBNull))
             {
                 Usuario usrEgreso = DAOUsuario.obtener(Convert.ToString(fila["usrEgreso"]));
                 estadia.Usuario_Egreso = usrEgreso;
             }
             Usuario usrIngreso = DAOUsuario.obtener(Convert.ToString(fila["usrIngreso"]));
             estadia.Usuario_Ingreso = usrIngreso;
             lista.Add(estadia);
         }
     return lista;
 }