Exemple #1
0
        private void botonGuardar_Click(object sender, EventArgs e)
        {
            if (chequearCampos())
            {
                //Probamos en guardar el hotel
                completarEstructura();
                if (!DAOHotel.insertar(hotelNuevo))
                {
                    MessageBox.Show("Error al guardar el hotel en la Base de Datos. Por favor, intente nuevamente.", "Error");
                    //botonLimpiar_Click(null,null);
                    return;
                }
                //Bien! El hotel se guardo, ahora guardemos los regimenes del hotel

                //Como el codHotel es autonumerico, necesitamos obtenerlo
                int codHotel = DAOHotel.obtener(hotelNuevo.Nombre).CodHotel;
                foreach (int index_reg in listaRegimenes.CheckedIndices)
                {
                    if (!DAORegimen.insertarPorHotel(regimenes[index_reg].CodRegimen, codHotel))
                    {
                        //Hacemos un chequeo por si se nos rompe todo y quedamos solo con parte cargados en la DB
                        MessageBox.Show("Error al guardar los regimenes en la Base de Datos. Por favor, agregue los regimenes faltantes en la ventana de modificacion.", "Error");
                        ((HotelBajaMod)Globals.VentanaAnterior).updateGrid();
                        this.Close();
                    }
                }
                //Todo cargado! Salimos y actualizamos la grid de hoteles de Baja/Mod
                ((HotelBajaMod)Globals.VentanaAnterior).updateGrid();
                this.Close();
            }
        }
        public void initDonne()
        {
            loadDGV();

            //Remplire Combobox Hotel
            foreach (Hotel unHotel in DAOHotel.getAllHotels())
            {
                cSHotel.Add(unHotel.IdHotel, unHotel.Name);
            }

            cBoxHotel.DataSource    = new BindingSource(cSHotel, null);
            cBoxHotel.DisplayMember = "Value";
            cBoxHotel.ValueMember   = "Key";


            //Remplire Combobox Participant
            foreach (Participant unParticipant in DAOParticipants.getAllParticipants())
            {
                cSParticipant.Add(unParticipant.IdParticipant, unParticipant.ToStringName());
            }

            cBoxParticipant.DataSource    = new BindingSource(cSParticipant, null);
            cBoxParticipant.DisplayMember = "Value";
            cBoxParticipant.ValueMember   = "Key";
        }
Exemple #3
0
 public HotelMod(int idHotel)
 {
     InitializeComponent();
     hotel         = DAOHotel.obtener(idHotel);
     regimen_hotel = DAORegimen.obtenerByHotel(idHotel);
     regimenes     = DAORegimen.obtenerTodos();
 }
Exemple #4
0
        public UsuarioMod(string usuario)
        {
            InitializeComponent();

            usuarioPedido = usuario;

            usuarioMod   = DAOUsuario.obtener(usuarioPedido);
            rolesUsuario = DAORol.obtenerTodos(usuario);

            ////Se carga el listRol tildando las opciones que el usuario ya tiene
            int item = 0;

            rolesPosibles = DAORol.traerTodosLosRolesPosibles();
            foreach (Rol rol in rolesPosibles)
            {
                listRol.Items.Add(rol.Nombre);
                if (rolesUsuario.Any(x => x.Nombre == rol.Nombre))
                {
                    listRol.SetItemChecked(item, true);
                }
                item++;
            }

            // Carga de listHotel, mismo rezonamiento de arriba
            item            = 0;
            hotelesPosibles = DAOHotel.obtenerTodos();
            hotelesUsuario  = DAOHotel.obtenerTodos(usuario);
            foreach (Hotel hotel in hotelesPosibles)
            {
                listHotel.Items.Add(hotel.Nombre);
                if (hotelesUsuario.Any(x => x.Nombre == hotel.Nombre))
                {
                    listHotel.SetItemChecked(item, true);
                }
                item++;
            }

            //Seteo check de Baja
            if (usuarioMod.CampoBaja)
            {
                checkBoxBajaUsr.Checked = true;
            }
            else
            {
                checkBoxBajaUsr.Checked = false;
            }

            //Llena el resto de los campos con la info que el usuario tiene
            cargarDatos();
        }
Exemple #5
0
        private DataTable FiltrarHotel(string nombre, string pais, string ciudad, int tipoEstrella)
        {
            DataTable tabla_habitacion = DAOHotel.obtenerTabla();
            var       final_rol        = "";
            var       posFiltro        = true;
            var       filtrosBusqueda  = new List <string>();

            if (nombre != "")
            {
                filtrosBusqueda.Add("nombreHotel LIKE '%" + nombre + "%'");
            }
            if (pais != "")
            {
                filtrosBusqueda.Add("pais LIKE '%" + pais + "%'");
            }
            if (ciudad != "")
            {
                filtrosBusqueda.Add("ciudad LIKE '%" + ciudad + "%'");
            }
            if (tipoEstrella != -1)
            {
                filtrosBusqueda.Add("cantEstrellas = " + comboEstrellas.Items[tipoEstrella].ToString());
            }


            foreach (var filtro in filtrosBusqueda)
            {
                if (!posFiltro)
                {
                    final_rol += " AND " + filtro;
                }
                else
                {
                    final_rol += filtro;
                    posFiltro  = false;
                }
            }
            if (tabla_habitacion != null)
            {
                tabla_habitacion.DefaultView.RowFilter = final_rol;
            }
            return(tabla_habitacion);
        }
        public LoginRequisitos()
        {
            InitializeComponent();

            if (usuario.Usr != "GUEST")
            {
                ///Completa combo hoteles
                hotelesDeUsuario = DAOHotel.obtenerTodos(usuario.Usr);
                foreach (Hotel unHotel in hotelesDeUsuario)
                {
                    comboHoteles.Items.Add(unHotel);
                }

                ///Completa combo hoteles
                rolesDeUsuario = DAORol.obtenerTodos(usuario.Usr);
                foreach (Rol unRol in rolesDeUsuario)
                {
                    if (unRol.Estado)
                    {
                        comboRoles.Items.Add(unRol);
                    }
                }
            }
            else
            {
                hotelesDeUsuario = DAOHotel.obtenerTodos();
                foreach (Hotel unHotel in hotelesDeUsuario)
                {
                    comboHoteles.Items.Add(unHotel);
                }
                comboRoles.Items.Add("GUEST");

                comboRoles.Enabled = false;
            }
            if (hotelesDeUsuario.Count > 0)
            {
                comboHoteles.ValueMember   = "Nombre";
                comboHoteles.SelectedIndex = 0;
            }
            comboRoles.ValueMember   = "Nombre";
            comboRoles.SelectedIndex = 0;
        }
Exemple #7
0
        public UsuarioAlta()
        {
            InitializeComponent();

            ////Se carga el listRol
            rolesPosibles = DAORol.traerTodosLosRolesPosibles();
            foreach (Rol unRol in rolesPosibles)
            {
                listRol.Items.Add(unRol.Nombre);
            }

            ////Combobox mostrando una opción y no queda en blanco
            comboTipoDoc.SelectedIndex = 0;

            ////Carga de hoteles
            hotelesPosibles = DAOHotel.obtenerTodos();
            foreach (Hotel unHotel in hotelesPosibles)
            {
                listHotel.Items.Add(unHotel.Nombre);
            }
        }
        public int Grabar(TipoGrabacion myTipo, Hotel myHotel)
        {
            int registrosAfectados = 0;
            var myDao = DAOHotel.CrearDao();

            if (myTipo.Equals(TipoGrabacion.Agregar))
            {
                registrosAfectados = myDao.Agregar(myHotel);
            }
            if (myTipo.Equals(TipoGrabacion.Editar))
            {
                registrosAfectados = myDao.Editar(myHotel);
            }
            if (myTipo.Equals(TipoGrabacion.Inhabilitar))
            {
                registrosAfectados = myDao.Inhabilitar(myHotel);
            }
            if (myTipo.Equals(TipoGrabacion.Habilitar))
            {
                registrosAfectados = myDao.Habilitar(myHotel);
            }
            return(registrosAfectados);
        }
        private void botonGuardar_Click(object sender, EventArgs e)
        {
            if (dateTimeInicio.Value.CompareTo(dateTimeFin.Value) >= 0)
            {
                MessageBox.Show("Rango de Fechas inválido. Intente nuevamente.",
                                "Error Grave", MessageBoxButtons.OK);
                return;
            }
            Inhabilitacion inhab = new Inhabilitacion();

            int respuesta = DAOHotel.estaVacio(hotel, dateTimeInicio.Value, dateTimeFin.Value);

            if (respuesta > 0)
            {
                inhab.Hotel = hotel;
                inhab.Fecha_Inicio_struct = dateTimeInicio.Value;
                inhab.Fecha_Fin_struct    = dateTimeFin.Value;
                inhab.Motivo = (textMotivo.Text != null) ? textMotivo.Text : "";

                DAOHotel.borrar(inhab);

                ((HotelBajaMod)Globals.VentanaAnterior).updateGrid();
                this.Close();
            }
            else
            {
                if (respuesta == -1)
                {
                    MessageBox.Show("Error al conectar con la Base de Datos.",
                                    "Error Grave", MessageBoxButtons.OK);
                    return;
                }
                MessageBox.Show("Hotel con reservas o huespedes alojados para esas fechas. No es posible dar la baja.",
                                "", MessageBoxButtons.OK);
            }
        }
Exemple #10
0
 private void botonGuardar_Click(object sender, EventArgs e)
 {
     if (chequearCampos())
     {
         completarEstructura();
         if (!DAOHotel.actualizar(hotel))
         {
             MessageBox.Show("Error al guardar el hotel en la Base de Datos. Por favor, intente nuevamente.", "Error");
             //botonLimpiar_Click(null,null);
             return;
         }
         bool estaChequeado;
         for (int i = 0; i < listaRegimenes.Items.Count; i++)
         {
             estaChequeado = false;
             foreach (int index in listaRegimenes.CheckedIndices)
             {
                 if (i == index)
                 {
                     estaChequeado = true;
                 }
             }
             if (estaChequeado)
             {
                 DAORegimen.insertarPorHotel(regimenes[i].CodRegimen, hotel.CodHotel);
             }
             else
             {
                 DAORegimen.quitarPorHotel(regimenes[i].CodRegimen, hotel.CodHotel);
             }
         }
         //Todo cargado! Salimos y actualizamos la grid de hoteles de Baja/Mod
         ((HotelBajaMod)Globals.VentanaAnterior).updateGrid();
         this.Close();
     }
 }
Exemple #11
0
 private void BajaHotel(Inhabilitacion bajaInhab)
 {
     DAOHotel.borrar(bajaInhab);
     updateGrid();
 }
 public DataTable ObtenerListadoDeHotel()
 {
     return(DAOHotel.CrearDao().ObtenerListaDeHoteles());
 }