Exemplo n.º 1
0
 public void insertHabitacion(UHabitacion habitE)
 {
     using (var db = new Mapeo())
     {
         db.habitacion.Add(habitE);
         db.SaveChanges();
     }
 }
Exemplo n.º 2
0
    protected void DL_Habitaciones_ItemCommand(object source, DataListCommandEventArgs e)
    {
        UHabitacion habitacioninfo = new UHabitacion();

        habitacioninfo.Id = int.Parse(e.CommandArgument.ToString());

        habitacioninfo = new LPanelHotel().informacion_de_habitacion(habitacioninfo);

        Session["idhabitacion"] = habitacioninfo;
        Response.Redirect("Reserva.aspx");
    }
Exemplo n.º 3
0
 //Agregar habitación en el hotel
 public void actualizarhabiatacion(UHabitacion idE)
 {
     using (var db = new Mapeo())
     {
         UHotel datoanterior = db.hotel.Where(x => x.Idhotel == idE.Idhotel).First();
         var    idanterior   = datoanterior.Numhabitacion;
         datoanterior.Numhabitacion = idanterior + 1;
         var entry = db.Entry(datoanterior);
         entry.State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        UHotel      hotel      = new UHotel();
        UHabitacion habitacion = new UHabitacion();

        try
        {
            hotel.Idhotel = ((UHotel)Session["visitarhotel"]).Idhotel;
            habitacion    = (UHabitacion)Session["idhabitacion"];
        }
        catch
        {
            Response.Redirect("index.aspx");
        }
        URegistro registro = new URegistro();

        registro = (URegistro)Session["usuario"];
        UDatosUsuario datos   = new UDatosUsuario();
        LReserva      reserva = new LReserva();

        datos = reserva.pageload_ingreso_reserva(hotel, habitacion, registro);

        TB_Nombre.Enabled          = datos.Aviso;
        TB_Correo.Enabled          = datos.Aviso;
        TB_Apellido.Enabled        = datos.Aviso;
        TB_CCorreo.Enabled         = datos.Aviso;
        B_ConfirmarReserva.Enabled = datos.Aviso;

        L_NombreHotel.Text          = datos.Hotel.Nombre;
        L_PrecioNoche.Text          = datos.Hotel.Precionoche.ToString();
        L_NumeroDePersonas.Text     = datos.Habitacion.Numpersonas.ToString();
        L_Habitaciondisponible.Text = "Seleccione una fecha";

        if (Session["usuario"] != null)
        {
            L_Nombreusuario.Text        = datos.Registro.Nombre;
            L_MensajeestadoSession.Text = "Si la reserva no se hará a su nombre ingrese los datos de la persona que será responsable de la reserva";
            TB_Apellido.Text            = datos.Registro.Apellido;
            TB_Nombre.Text = datos.Registro.Nombre;
        }
        else
        {
            L_Nombreusuario.Text        = "Cliente";
            L_MensajeestadoSession.Text = "Al parecer no te haz registrado o iniciado sesión, no hay problema igualmente puedes reservar, solo dejanos saber algunos datos.";
        }
    }
Exemplo n.º 5
0
        public UHabitacion agregarHabitacion(int idtipo, UHabitacion habitacion)
        {
            UHabitacion mensaje = new UHabitacion();

            if (habitacion.Tipo != "--Seleccionar--")
            {
                UHotel infohotel = new UHotel();
                infohotel.Idhotel = habitacion.Idhotel;
                infohotel         = new DAOhotel().infohotel(infohotel);
                if (idtipo == 1)//basica
                {
                    habitacion.Precio = infohotel.Precionoche;
                }
                if (idtipo == 2)//doble
                {
                    habitacion.Precio = infohotel.PrecioNocheDoble;
                }
                if (idtipo == 3)//premium
                {
                    habitacion.Precio = infohotel.PrecioNochePremium;
                }
                int cantHabitaciones = new DAOHabitacion().cantidadHabitaciones(habitacion);
                if (cantHabitaciones == 150)
                {
                    mensaje.Mensaje = " Limite de habitaciones alcanzado";
                }
                else
                {
                    new DAOHabitacion().insertHabitacion(habitacion);
                    new DAOhotel().actualizarhabiatacion(habitacion);
                    mensaje.Mensaje          = " Habitacion añadida con exito";
                    mensaje.Tb_NumPersonas   = "";
                    mensaje.Tb_NumBanio      = "";
                    mensaje.Tb_NumeroDeCamas = "";
                }
            }
            else
            {
                mensaje.Mensaje = "Seleccione una opción";
            }

            return(mensaje);
        }
Exemplo n.º 6
0
 public int cantidadHabitaciones(UHabitacion habitE)
 {
     return(new Mapeo().habitacion.Where(x => x.Idhotel == habitE.Idhotel).ToList().Count());
 }
Exemplo n.º 7
0
    protected void B_AgregarHabitacion_Click(object sender, EventArgs e)
    {
        int         idtipo = 0;
        UHabitacion habit  = new UHabitacion();

        habit.Numpersonas = int.Parse(TB_NumPersonas.Text);
        habit.Numbanio    = int.Parse(TB_NumBanio.Text);
        habit.Idhotel     = int.Parse(L_Prueba.Text);
        habit.Tipo        = DDL_Tipo.Text;
        idtipo            = DDL_Tipo.SelectedIndex;
        habit.Numcamas    = int.Parse(TB_NumeroDeCamas.Text);

        LHabitacion logica = new LHabitacion();

        habit = logica.agregarHabitacion(idtipo, habit);
        //TB_NumPersonas.Text = "";
        //TB_NumBanio.Text = "";
        //TB_NumeroDeCamas.Text = "";
        L_Error_habitacion.Text = habit.Mensaje;

        /*
         * int idtipo = 0;
         * Habitacion habit = new Habitacion();
         *
         * habit.Numpersonas = int.Parse(TB_NumPersonas.Text);
         * habit.Numbanio = int.Parse(TB_NumBanio.Text);
         * habit.Idhotel = int.Parse(L_Prueba.Text);
         * habit.Tipo = DDL_Tipo.Text;
         * idtipo = DDL_Tipo.SelectedIndex;
         * habit.Numcamas = int.Parse(TB_NumeroDeCamas.Text);
         *
         * if (DDL_Tipo.Text != "--Seleccionar--")
         * {
         *  Hotel infohotel = new Hotel();
         *  infohotel.Idhotel = habit.Idhotel;
         *  infohotel = new DAOhotel().infohotel(infohotel);
         *  if (idtipo == 1)//basica
         *  {
         *      habit.Precio = infohotel.Precionoche;
         *  }
         *  if (idtipo == 2)//doble
         *  {
         *      habit.Precio = infohotel.PrecioNocheDoble;
         *  }
         *  if (idtipo == 3)//premium
         *  {
         *      habit.Precio = infohotel.PrecioNochePremium;
         *  }
         *  int cantHabitaciones = new DAOHabitacion().cantidadHabitaciones(habit);
         *  if (cantHabitaciones == 150)
         *  {
         *      L_Error_habitacion.Text = " Limite de habitaciones alcanzado";
         *  }
         *  else
         *  {
         *      new DAOHabitacion().insertHabitacion(habit);
         *      new DAOhotel().actualizarhabiatacion(habit);
         *      L_Error_habitacion.Text = " Habitacion añadida con exito";
         *
         *      TB_NumPersonas.Text = "";
         *      TB_NumBanio.Text = "";
         *      //DDL_Tipo.ID = "0";
         *      TB_NumeroDeCamas.Text = "";
         *  }
         * }
         * else
         * {
         *  L_Tipo.Text = "Seleccione una opción";
         * }
         */
    }
Exemplo n.º 8
0
        public UHabitacion informacion_de_habitacion(UHabitacion habitacioninfo)
        {
            habitacioninfo = new DAOHabitacion().infoHabitacion(habitacioninfo.Id);

            return(habitacioninfo);
        }
Exemplo n.º 9
0
        public UDatosUsuario pageload_ingreso_reserva(UHotel hotel_id, UHabitacion infoHabitacion, URegistro infousuario)
        {
            //deshabilitarbotones();
            UDatosUsuario datosUsuario = new UDatosUsuario();

            datosUsuario.Hotel      = new UHotel();
            datosUsuario.Habitacion = new UHabitacion();
            datosUsuario.Registro   = new URegistro();
            datosUsuario.Aviso      = false;
            try
            {
                datosUsuario.Hotel.Idhotel = hotel_id.Idhotel;

                datosUsuario.Hotel        = new DAOhotel().infohotel(datosUsuario.Hotel);
                datosUsuario.Hotel.Nombre = datosUsuario.Hotel.Nombre.ToUpper();
                //L_NombreHotel.Text
                if (infoHabitacion.Tipo.Equals("Básica"))
                {
                    datosUsuario.Hotel.Precionoche = datosUsuario.Hotel.Precionoche;
                    //L_PrecioNoche.Text = hotel.Precionoche.ToString();
                }
                else if (infoHabitacion.Tipo.Equals("Doble"))
                {
                    datosUsuario.Hotel.Precionoche = datosUsuario.Hotel.PrecioNocheDoble;
                    //L_PrecioNoche.Text = hotel.PrecioNocheDoble.ToString();
                }
                else if (infoHabitacion.Tipo.Equals("Premium"))
                {
                    datosUsuario.Hotel.Precionoche = datosUsuario.Hotel.PrecioNochePremium;
                    //L_PrecioNoche.Text = hotel.PrecioNochePremium.ToString();
                }

                datosUsuario.Habitacion.Numpersonas = infoHabitacion.Numpersonas;

                if (infousuario != null)
                {
                    datosUsuario.Registro.Nombre = infousuario.Nombre;

                    datosUsuario.Registro.Apellido = infousuario.Apellido;

                    datosUsuario.Registro.Contrasena = infousuario.Correo;
                    //TB_Correo.Text = ((Registro)Session["usuario"]).Correo;
                }
                else
                {
                    datosUsuario.Registro.Apellido = "";
                    //TB_Apellido.Text = "";
                    datosUsuario.Registro.Nombre = "";
                    //TB_Nombre.Text = "";
                    datosUsuario.Registro.Contrasena = "";
                    //TB_Correo.Text = "";
                    datosUsuario.Mensaje = "Al parecer no te haz registrado o iniciado sesión, no hay problema igualmente puedes reservar, solo dejanos saber algunos datos.";
                    ///////////////////L_Nombreusuario.Text = "Cliente";
                    ////////////////////L_MensajeestadoSession.Text = "Al parecer no te haz registrado o iniciado sesión, no hay problema igualmente puedes reservar, solo dejanos saber algunos datos.";
                }
            }
            catch (Exception ex)
            {
                datosUsuario.Url = "index.aspx";
                //Response.Redirect("index.aspx");
            }
            return(datosUsuario);
        }