Beispiel #1
0
 private void btnModificar_Click(object sender, EventArgs e)
 {
     try
     {
         Huespedes hp = new Huespedes();
         hp.idHuesped       = txtid.Text;
         hp.documento       = txtci.Text;
         hp.nombre          = txtnombre.Text;
         hp.paterno         = txtpaterno.Text;
         hp.materno         = txtmaterno.Text;
         hp.pais            = cbpais.Text;
         hp.fechaNacimiento = Convert.ToDateTime(dtfechanac.Text).Date;
         MessageBox.Show("Huesped Modificado ");
         using (var contexto = new SistemaHotelWaraEntitiesV1())
         {
             contexto.Entry(hp).State = System.Data.Entity.EntityState.Modified;
             contexto.SaveChanges();
             Limpiar();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #2
0
        private void btnConfirmar_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Esta seguro que desea facturar esta reserva?", "Mensaje de Confirmacion", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                try
                {
                    int i = int.Parse(dgvReservas.Rows[dgvReservas.CurrentRow.Index].Cells[0].Value.ToString());
                    using (var DB = new SistemaHotelWaraEntitiesV1())
                    {
                        Reservas nuevo = DB.Reservas.Find(i);
                        nuevo.estado          = cbEstadoNuevo.SelectedItem.ToString();
                        DB.Entry(nuevo).State = System.Data.Entity.EntityState.Modified;
                        DB.SaveChanges();
                        FacturaReporte facturaReporte = new FacturaReporte(lblIdReserva.Text);
                        facturaReporte.ShowDialog();
                        MessageBox.Show("FACTURA ACTUALIZADA!");
                        incializar();
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("SELECCIONE ALGUNA RESERVA HA FACTURAR!");
                    txtFiltroApellido.text = "APELLIDO...";
                    txtFiltroId.text       = "ID...";
                }
            }
        }
Beispiel #3
0
 private void cbFiltro_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         using (var contexto = new SistemaHotelWaraEntitiesV1())
         {
             if (cbFiltro.SelectedIndex == 0)
             {
                 var lis = contexto.exo_DiezDatos2();
                 dgvRegistros.DataSource = lis.ToList();
             }
             else if (cbFiltro.SelectedIndex == 1)
             {
                 var lis = contexto.exo_SieteDiasPL2();
                 dgvRegistros.DataSource = lis.ToList();
             }
             else if (cbFiltro.SelectedIndex == 2)
             {
                 var lis = contexto.exo_UnMesPL2();
                 dgvRegistros.DataSource = lis.ToList();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Datos No Disponibles" + ex.Message);
     }
 }
        public void CargarHuespedes(string apellido)
        {
            using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
            {
                try
                {
                    if (apellido == "" || apellido == "APELLIDO...")
                    {
                        dgvHuespedes.DataSource = (from d in DB.Huespedes
                                                   select d).ToList();
                    }
                    else
                    {
                        dgvHuespedes.DataSource = (from d in DB.Huespedes
                                                   where d.paterno.StartsWith(apellido) || d.materno.StartsWith(apellido)
                                                   select d).ToList();
                    }

                }
                catch (Exception)
                {
                    MessageBox.Show("ERROR EN LA CONSULTA");
                }
            }
        }
        public void CargarRecepcionista(string apellido)
        {
            DataTable dt = new DataTable();

            using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
            {
                try
                {
                    if (apellido == "" || apellido == "APELLIDO...")
                    {
                        dgvEmpleados.DataSource = (from d in DB.Recepcionista
                                                   select d).ToList();
                    }
                    else
                    {
                        dgvEmpleados.DataSource = (from d in DB.Recepcionista
                                                   where d.paterno.StartsWith(apellido) || d.materno.StartsWith(apellido)
                                                   select d).ToList();
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("ERROR EN LA CONSULTA");
                }
            }
        }
Beispiel #6
0
        public bool SesionRecepcionista()
        {
            bool existe = false;

            using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
            {
                string        usu    = textBoxUsuario.Text;
                string        con    = textBoxContrasenia.Text;
                Recepcionista nuevog = DB.Recepcionista.Find(usu);
                if (nuevog == null)
                {
                    lblError.Visible = true;
                }
                else
                {
                    if (nuevog.contrasenia == con)
                    {
                        existe = true;
                    }
                    else
                    {
                        lblError.Visible = true;
                    }
                }
            }

            return(existe);
        }
 private void txtFiltroId_OnTextChange(object sender, EventArgs e)
 {
     using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
     {
         try
         {
             if (txtFiltroId.text == "TODOS" || txtFiltroId.text == "")
             {
                 dgvHabitacion.DataSource = (from h in DB.Habitaciones
                                             join dh in DB.DetalleHabitacion on h.idHabitacion equals dh.idDetalleHabitacion
                                             select new { h.idHabitacion, h.estado, h.nroPiso, h.nroCamas, dh.idTipo }
                                             ).ToList();
             }
             else
             {
                 dgvHabitacion.DataSource = (from h in DB.Habitaciones
                                             join dh in DB.DetalleHabitacion on h.idHabitacion equals dh.idDetalleHabitacion
                                             where h.idHabitacion.StartsWith(txtFiltroId.text)
                                             select new { h.idHabitacion, h.estado, h.nroPiso, h.nroCamas, dh.idTipo }
                                             ).ToList();
             }
         }
         catch (Exception)
         {
         }
     }
 }
        public void CargarHabitaciones()
        {
            using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
            {
                try
                {
                    if (txtFiltroId.text == "TODOS")
                    {
                        dgvHabitaciones.DataSource = (from h in DB.Habitaciones
                                                      join dh in DB.DetalleHabitacion on h.idHabitacion equals dh.idDetalleHabitacion
                                                      select new { h.idHabitacion, h.precio, h.nroPiso, h.nroCamas, h.estado, dh.idTipo }
                                                      ).ToList();
                    }
                    else if (checkFiltroTipo.Checked)
                    {
                        if (txtFiltroId.text == "" || txtFiltroId.text == "ID...")
                        {
                            decimal precio = 5000;
                            int nroCamas = 1;
                            if (cbPrecioMenos.SelectedItem != null && cbNroCamas.SelectedItem != null)
                            {
                                precio = decimal.Parse(cbPrecioMenos.SelectedItem.ToString());
                                nroCamas = int.Parse(cbNroCamas.SelectedItem.ToString());
                            }
                            dgvHabitaciones.DataSource = (from h in DB.Habitaciones
                                                          join dh in DB.DetalleHabitacion on h.idHabitacion equals dh.idDetalleHabitacion
                                                          where dh.idTipo == cbFiltroTipo.SelectedValue.ToString() &&
                                                          h.precio.Value <= precio &&
                                                          h.nroCamas.Value == nroCamas
                                                          select new { h.idHabitacion, h.precio, h.nroPiso, h.nroCamas, h.estado, dh.idTipo }
                                                          ).ToList();
                        }
                        else
                        {
                            decimal precio = 5000;
                            int nroCamas = 1;
                            if (cbPrecioMenos.SelectedItem != null && cbNroCamas.SelectedItem != null)
                            {
                                precio = decimal.Parse(cbPrecioMenos.SelectedItem.ToString());
                                nroCamas = int.Parse(cbNroCamas.SelectedItem.ToString());
                            }
                            dgvHabitaciones.DataSource = (from h in DB.Habitaciones
                                                          join dh in DB.DetalleHabitacion on h.idHabitacion equals dh.idDetalleHabitacion
                                                          where h.idHabitacion.StartsWith(txtFiltroId.text) &&
                                                          dh.idTipo == cbFiltroTipo.SelectedValue.ToString() &&
                                                          h.precio.Value <= precio &&
                                                          h.nroCamas.Value == nroCamas
                                                          select new { h.idHabitacion, h.precio, h.nroPiso, h.nroCamas, h.estado, dh.idTipo }
                                                          ).ToList();
                        }
                    }

                }
                catch (Exception)
                {
                }
            }
        }
Beispiel #9
0
 private void LlenarCamposUsuario(string id)
 {
     lblUsuario.Text = id;
     using (var DB = new SistemaHotelWaraEntitiesV1())
     {
         Mantenimiento nuevo = DB.Mantenimiento.Find(id);
         lblNombre.Text = nuevo.nombre + " " + nuevo.paterno + " " + nuevo.materno;
     }
 }
Beispiel #10
0
 private void LlenarCamposUsuario(string id)
 {
     lblUsuario.Text = id;
     using (var DB = new SistemaHotelWaraEntitiesV1())
     {
         Recepcionista nuevo = DB.Recepcionista.Find(id);
         lblNombre.Text = nuevo.nombre + " " + nuevo.paterno + " " + nuevo.materno;
     }
 }
 private void btnAgregar_Click(object sender, EventArgs e)
 {
     if (lblIdHabitacion.Text != "H" && txtCaracteristica.Text != "CARACTERISTICAS" && nudNroCamas.Value != 0 && nudNroPiso.Value != 0 && nudPrecio.Value != 0)
     {
         try
         {
             using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
             {
                 Habitaciones nuevo = new Habitaciones();
                 nuevo.idHabitacion    = lblIdHabitacion.Text;
                 nuevo.caracteristicas = txtCaracteristica.Text;
                 nuevo.precio          = nudPrecio.Value;
                 nuevo.nroPiso         = (int)nudNroPiso.Value;
                 nuevo.nroCamas        = (int)nudNroCamas.Value;
                 nuevo.estado          = cbEstadoH.SelectedItem.ToString();
                 DB.Entry(nuevo).State = System.Data.Entity.EntityState.Modified;
                 DB.SaveChanges();
             }
             using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
             {
                 Servicios nuevo = new Servicios();
                 nuevo.idServicio        = lblIdHabitacion.Text;
                 nuevo.wifiHabitacion    = swWifiHabitacion.Value;
                 nuevo.wifiLobby         = swWifiLobby.Value;
                 nuevo.alberca           = swAlberca.Value;
                 nuevo.spa               = swSpa.Value;
                 nuevo.estacionamiento   = swEstacionamiento.Value;
                 nuevo.mascotas          = swMascotas.Value;
                 nuevo.aireAcondicionado = swAireAcondicionado.Value;
                 nuevo.restaurante       = swRestaurante.Value;
                 nuevo.barHotel          = swBarHotel.Value;
                 nuevo.gym               = swGym.Value;
                 DB.Entry(nuevo).State   = System.Data.Entity.EntityState.Modified;
                 DB.SaveChanges();
             }
             using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
             {
                 DetalleHabitacion nuevo = new DetalleHabitacion();
                 nuevo.idDetalleHabitacion = lblIdHabitacion.Text;
                 nuevo.idTipo          = cbTipoHabitacion.SelectedValue.ToString();
                 DB.Entry(nuevo).State = System.Data.Entity.EntityState.Modified;
                 DB.SaveChanges();
             }
             MessageBox.Show("LA HABITACION AH SIDO MODIFICADA CON ÉXITO!");
             limpiarCampos();
         }
         catch (Exception)
         {
             MessageBox.Show("OCURRIO UN ERROR CON LA MODIFICACION DE LA HABITACION, VERIFIQUE EL ID DE LA HABITACION!");
         }
     }
     else
     {
         lblError.Visible = true;
     }
 }
Beispiel #12
0
 private void btnAgregar_Click(object sender, EventArgs e)
 {
     if (verificarAgregar())
     {
         try
         {
             using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
             {
                 Habitaciones nuevo = new Habitaciones();
                 nuevo.idHabitacion    = lblIdHabitacion.Text;
                 nuevo.caracteristicas = txtCaracteristica.Text;
                 nuevo.precio          = nudPrecio.Value;
                 nuevo.nroPiso         = (int)nudNroPiso.Value;
                 nuevo.nroCamas        = (int)nudNroCamas.Value;
                 nuevo.estado          = "DISPONIBLE";
                 DB.Habitaciones.Add(nuevo);
                 DB.SaveChanges();
             }
             using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
             {
                 Servicios nuevo = new Servicios();
                 nuevo.idServicio        = lblIdHabitacion.Text;
                 nuevo.wifiHabitacion    = swWifiHabitacion.Value;
                 nuevo.wifiLobby         = swWifiLobby.Value;
                 nuevo.alberca           = swAlberca.Value;
                 nuevo.spa               = swSpa.Value;
                 nuevo.estacionamiento   = swEstacionamiento.Value;
                 nuevo.mascotas          = swMascotas.Value;
                 nuevo.aireAcondicionado = swAireAcondicionado.Value;
                 nuevo.restaurante       = swRestaurante.Value;
                 nuevo.barHotel          = swBarHotel.Value;
                 nuevo.gym               = swGym.Value;
                 DB.Servicios.Add(nuevo);
                 DB.SaveChanges();
             }
             using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
             {
                 DetalleHabitacion nuevo = new DetalleHabitacion();
                 nuevo.idDetalleHabitacion = lblIdHabitacion.Text;
                 nuevo.idTipo = cbTipoHabitacion.SelectedValue.ToString();
                 DB.DetalleHabitacion.Add(nuevo);
                 DB.SaveChanges();
             }
             MessageBox.Show("LA HABITACION AH SIDO REGISTRADA CON ÉXITO!");
             limpiarCampos();
         }
         catch (Exception)
         {
             MessageBox.Show("OCURRIO UN ERROR CON EL REGISTRO DE LA HABITACION, VERIFIQUE EL ID DE LA HABITACION!");
         }
     }
     else
     {
         lblError.Visible = true;
     }
 }
 void MostrarHabitaciones()
 {
     using (var contexto = new SistemaHotelWaraEntitiesV1())
     {
         var quiery = from d
                      in contexto.Habitaciones
                      select new { d.idHabitacion, d.caracteristicas, d.nroCamas, d.nroPiso };
         dgvHabitaciones.DataSource = quiery.ToList();
     }
 }
Beispiel #14
0
 private void CargarDatos()
 {
     using (SistemaHotelWaraEntitiesV1 nx = new SistemaHotelWaraEntitiesV1())
     {
         var query = from d
                     in nx.Huespedes
                     select d;
         dgHuespedes.DataSource = query.ToList();
     }
 }
 void MostarEstadoHabitacionez()
 {
     using (var contexto = new SistemaHotelWaraEntitiesV1())
     {
         var query = from d
                     in contexto.Habitaciones
                     select new { d.idHabitacion, d.estado, d.nroPiso, d.nroCamas };
         dgvEstadoHab.DataSource = query.ToList();
     }
 }
 void MostarRegistros()
 {
     using (var contexto = new SistemaHotelWaraEntitiesV1())
     {
         var query = from d
                     in contexto.RegistroLimpieza
                     select new { d.idRegistroLimpieza, d.informe, d.fecha, d.hora };
         dvgRegsitros.DataSource = query.ToList();
     }
 }
Beispiel #17
0
 private void CargarDatos2(string a)
 {
     using (SistemaHotelWaraEntitiesV1 nx = new SistemaHotelWaraEntitiesV1())
     {
         var query = from d
                     in nx.Huespedes
                     where d.documento == a
                     select d;
         dgHuespedes.DataSource = query.ToList();
     }
 }
Beispiel #18
0
 private void txtFiltroId_OnTextChange(object sender, EventArgs e)
 {
     using (var DB = new SistemaHotelWaraEntitiesV1())
     {
         try
         {
             if (txtFiltroId.text == "TODOS" || txtFiltroId.text == "" || txtFiltroId.text == "ID...")
             {
                 dgvReservas.DataSource = (from dr in DB.DetalleReservas
                                           join res in DB.Reservas on dr.idDetalleReservas equals res.idReserva
                                           join f in DB.Factura on dr.idDetalleReservas equals f.idFactura
                                           join r in DB.Recepcionista on dr.idEmpleado equals r.idEmpleado
                                           join h in DB.Habitaciones on dr.idHabitacion equals h.idHabitacion
                                           join dh in DB.DetalleHabitacion on h.idHabitacion equals dh.idDetalleHabitacion
                                           where res.estado == "SIN PAGAR"
                                           orderby res.idReserva descending
                                           select new { ID_RESERVA = dr.idDetalleReservas, ESTADO = res.estado, RECEPCIONISTA = (r.nombre + " " + r.paterno + " " + r.materno), ID_HABITACION = h.idHabitacion, PISO = h.nroPiso, CAMAS = h.nroCamas, TIPO = dh.idTipo }
                                           ).ToList();
             }
             //else if (txtFiltroId.text != "" || txtFiltroId.text != "ID...")
             //{
             //    int i = int.Parse(txtFiltroId.text);
             //    dgvReservas.DataSource = (from dr in DB.DetalleReservas
             //                              join res in DB.Reservas on dr.idDetalleReservas equals res.idReserva
             //                              join f in DB.Factura on dr.idDetalleReservas equals f.idFactura
             //                              join r in DB.Recepcionista on dr.idEmpleado equals r.idEmpleado
             //                              join h in DB.Habitaciones on dr.idHabitacion equals h.idHabitacion
             //                              join dh in DB.DetalleHabitacion on h.idHabitacion equals dh.idDetalleHabitacion
             //                              where dr.idDetalleReservas == i && res.estado == "SIN PAGAR"
             //                              orderby res.idReserva descending
             //                              select new { ID_RESERVA = dr.idDetalleReservas, ESTADO = res.estado, RECEPCIONISTA = (r.nombre + " " + r.paterno + " " + r.materno), ID_HABITACION = h.idHabitacion, PISO = h.nroPiso, CAMAS = h.nroCamas, TIPO = dh.idTipo }
             //                                          ).ToList();
             //}
             else
             {
                 int i = int.Parse(txtFiltroId.text);
                 dgvReservas.DataSource = (from dr in DB.DetalleReservas
                                           join res in DB.Reservas on dr.idDetalleReservas equals res.idReserva
                                           join f in DB.Factura on dr.idDetalleReservas equals f.idFactura
                                           join r in DB.Recepcionista on dr.idEmpleado equals r.idEmpleado
                                           join h in DB.Habitaciones on dr.idHabitacion equals h.idHabitacion
                                           join dh in DB.DetalleHabitacion on h.idHabitacion equals dh.idDetalleHabitacion
                                           where dr.idDetalleReservas == i && res.estado == "SIN PAGAR"
                                           orderby res.idReserva descending
                                           select new { ID_RESERVA = dr.idDetalleReservas, ESTADO = res.estado, RECEPCIONISTA = (r.nombre + " " + r.paterno + " " + r.materno), ID_HABITACION = h.idHabitacion, PISO = h.nroPiso, CAMAS = h.nroCamas, TIPO = dh.idTipo }
                                           ).ToList();
             }
         }
         catch (Exception)
         {
         }
     }
 }
        private void dgvHabitaciones_Click(object sender, EventArgs e)
        {
            try
            {
                lblIdHabitacion.Text = dgvHabitaciones.Rows[dgvHabitaciones.CurrentRow.Index].Cells[0].Value.ToString();
                CargarServicios(lblIdHabitacion.Text);
                List <DateTime> fechas = new List <DateTime>();


                using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                {
                    var habitaciones = (from h in DB.DetalleReservas
                                        join r in DB.Reservas on h.idDetalleReservas equals r.idReserva
                                        where r.ingreso <= DateTime.Now && r.salida >= DateTime.Now && lblIdHabitacion.Text == h.idHabitacion && r.estado != "CANCELADO"
                                        select new { h.idHabitacion, r.ingreso, r.salida }
                                        ).ToList();
                    foreach (var h in habitaciones)
                    {
                        for (DateTime i = (DateTime)h.ingreso; i <= (DateTime)h.salida; i = i.AddDays(1))
                        {
                            fechas.Add(i);
                        }
                    }
                }

                using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                {
                    var habitaciones = (from h in DB.DetalleReservas
                                        join r in DB.Reservas on h.idDetalleReservas equals r.idReserva
                                        where r.ingreso >= DateTime.Now && lblIdHabitacion.Text == h.idHabitacion && r.estado != "CANCELADO"
                                        select new { h.idHabitacion, r.ingreso, r.salida }
                                        ).ToList();
                    foreach (var h in habitaciones)
                    {
                        for (DateTime i = (DateTime)h.ingreso; i <= (DateTime)h.salida; i = i.AddDays(1))
                        {
                            fechas.Add(i);
                        }
                    }
                }

                calendarEstadoHabitacion.BoldedDates = fechas.ToArray();
                if (dgvHuespedesSeleccionados.RowCount > int.Parse(dgvHabitaciones.Rows[dgvHabitaciones.CurrentRow.Index].Cells[3].Value.ToString()))
                {
                    dgvHuespedesSeleccionados.Rows.Clear();
                    dgvHuespedesSeleccionados.Refresh();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERROR: " + ex.Message);
            }
        }
Beispiel #20
0
 public VerRegistros()
 {
     InitializeComponent();
     using (var DB = new SistemaHotelWaraEntitiesV1())
     {
         dgvRegistro.DataSource = (from rm in DB.RegistroMantenimiento
                                   join drm in DB.DetalleRegistroMantenimiento on rm.idRegistroMantenimiento equals drm.idRegistroMantenimiento
                                   join e in DB.Mantenimiento on drm.idEmpleado equals e.idEmpleado
                                   orderby rm.fecha descending
                                   select new { e.idEmpleado, rm.fecha, rm.hora, drm.idRegistroMantenimiento }
                                   ).ToList();
     }
 }
Beispiel #21
0
        public bool ExisteUsuario(string usuario)
        {
            bool existe = false;

            using (var db = new SistemaHotelWaraEntitiesV1())
            {
                if (db.Huespedes.Find(usuario) != null)
                {
                    existe = true;
                }
            }
            return(existe);
        }
 private void buttonRecuperar_Click(object sender, EventArgs e)
 {
     if (txtContrasenia.Text == txtConfirmar.Text && txtConfirmar.Text != "" && txtContrasenia.Text != "")
     {
         using (var DB = new SistemaHotelWaraEntitiesV1())
         {
             if (Cargo == "R")
             {
                 Recepcionista nuevo = DB.Recepcionista.Find(idEmpleado);
                 nuevo.contrasenia     = txtContrasenia.Text;
                 DB.Entry(nuevo).State = System.Data.Entity.EntityState.Modified;
                 DB.SaveChanges();
                 MessageBox.Show("La contraseña se cambio con exito!");
                 this.Close();
             }
             else if (Cargo == "G")
             {
                 Gerente nuevo = DB.Gerente.Find(idEmpleado);
                 nuevo.contrasenia     = txtContrasenia.Text;
                 DB.Entry(nuevo).State = System.Data.Entity.EntityState.Modified;
                 DB.SaveChanges();
                 MessageBox.Show("La contraseña se cambio con exito!");
                 this.Close();
             }
             else if (Cargo == "L")
             {
                 Limpieza nuevo = DB.Limpieza.Find(idEmpleado);
                 nuevo.contrasenia     = txtContrasenia.Text;
                 DB.Entry(nuevo).State = System.Data.Entity.EntityState.Modified;
                 DB.SaveChanges();
                 MessageBox.Show("La contraseña se cambio con exito!");
                 this.Close();
             }
             else if (Cargo == "M")
             {
                 Mantenimiento nuevo = DB.Mantenimiento.Find(idEmpleado);
                 nuevo.contrasenia     = txtContrasenia.Text;
                 DB.Entry(nuevo).State = System.Data.Entity.EntityState.Modified;
                 DB.SaveChanges();
                 MessageBox.Show("La contraseña se cambio con exito!");
                 this.Close();
             }
         }
     }
     else
     {
         MessageBox.Show("Las contraseñas deben coincidir en ambos campos o no estar vacios!");
     }
 }
        private void swWifiLobby_OnValueChange(object sender, EventArgs e)
        {
            if (swWifiLobby.Value)
            {
                using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                {

                    dgvHabitaciones.DataSource = (from h in DB.Habitaciones
                                                  join dh in DB.Servicios on h.idHabitacion equals dh.idServicio
                                                  where dh.wifiLobby == true
                                                  select new { h.idHabitacion, h.precio, h.nroPiso, h.nroCamas, h.estado }
                                                  ).ToList();

                }
            }
        }
Beispiel #24
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            RegistroLimpieza reg = new RegistroLimpieza();

            reg.idRegistroLimpieza = lblIdRegistro.Text;
            reg.fecha   = Convert.ToDateTime(dgvRegistros.Rows[dgvRegistros.CurrentRow.Index].Cells[1].Value);
            reg.hora    = dgvRegistros.Rows[dgvRegistros.CurrentRow.Index].Cells[2].Value.ToString();
            reg.informe = txbInforme.Text;
            using (var contexto = new SistemaHotelWaraEntitiesV1())
            {
                contexto.Entry(reg).State = System.Data.Entity.EntityState.Modified;
                contexto.SaveChanges();
                Limpiar();
                MessageBox.Show("Registro Modificado");
            }
        }
Beispiel #25
0
        private void Top5ClienteMensual(int mes)
        {
            ArrayList cantidadReservas = new ArrayList();
            ArrayList idCliente        = new ArrayList();

            cmd             = new SqlCommand("Top5ClienteAnual", conexion);
            cmd.CommandType = CommandType.StoredProcedure;

            SqlParameter parametro = new SqlParameter("@mes", mes);

            parametro.Direction = ParameterDirection.Input;
            cmd.Parameters.Add(parametro);

            conexion.Open();
            dr = cmd.ExecuteReader();
            try
            {
                while (dr.Read())
                {
                    cantidadReservas.Add(dr.GetInt32(0));
                    idCliente.Add(dr.GetString(1));
                }
                chClientesReservas.Series[0].Points.DataBindXY(idCliente, cantidadReservas);
            }
            catch (Exception)
            {
            }
            dr.Close();
            conexion.Close();

            using (var DB = new SistemaHotelWaraEntitiesV1())
            {
                try
                {
                    string id = idCliente[0].ToString();
                    btnHuespedEstrella.LabelText = id;
                    Huespedes h = DB.Huespedes.Find(id);
                    lblNombreCompleto.Text = h.nombre + " " + h.paterno + " " + h.materno;
                    lblPais.Text           = h.pais;
                    lblDocumento.Text      = h.documento;
                    lblFechaNac.Text       = h.fechaNacimiento.Value.ToLongDateString();
                }
                catch (Exception)
                {
                }
            }
        }
Beispiel #26
0
        private void dgvReservas_Click(object sender, EventArgs e)
        {
            try
            {
                int idReserva = int.Parse(dgvReservas.Rows[dgvReservas.CurrentRow.Index].Cells[0].Value.ToString());
                lblIdReserva.Text = idReserva.ToString();
                string idHabitacion = dgvReservas.Rows[dgvReservas.CurrentRow.Index].Cells[3].Value.ToString();

                CargarServicios(idHabitacion);

                using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                {
                    dgvHuespedes.DataSource = (from r in DB.RegistroHuespedes
                                               join hu in DB.Huespedes on r.idHuespedes equals hu.idHuesped
                                               where r.idReserva == idReserva
                                               select new { hu.idHuesped, hu.nombre, hu.paterno, hu.materno }
                                               ).ToList();
                }

                using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                {
                    var datosFactura = (from r in DB.Reservas
                                        join f in DB.Factura on r.idReserva equals f.idFactura
                                        join dr in DB.DetalleReservas on r.idReserva equals dr.idDetalleReservas
                                        join h in DB.Habitaciones on dr.idHabitacion equals h.idHabitacion
                                        join dh in DB.DetalleHabitacion on h.idHabitacion equals dh.idDetalleHabitacion
                                        join rec in DB.Recepcionista on dr.idEmpleado equals rec.idEmpleado
                                        where r.idReserva == idReserva
                                        select new { r.ingreso, r.salida, REC = (rec.nombre + " " + rec.paterno + " " + rec.materno), h.idHabitacion, h.precio, dh.idTipo, h.nroCamas, h.nroPiso, r.estado, f.total }
                                        ).ToList().First();

                    lblFechaIngreso.Text          = datosFactura.ingreso.Value.ToLongDateString();
                    lblFechaSalida.Text           = datosFactura.salida.Value.ToLongDateString();
                    lblAtencionRecepcionista.Text = datosFactura.REC.ToString();
                    lblIdHabitacion.Text          = datosFactura.idHabitacion.ToString();
                    lblPrecioHabitacion.Text      = datosFactura.precio.ToString();
                    lblTipoHabitacion.Text        = datosFactura.idTipo.ToString();
                    lblNroCamas.Text      = datosFactura.nroCamas.ToString();
                    lblNroPiso.Text       = datosFactura.nroPiso.ToString();
                    lblEstadoReserva.Text = datosFactura.estado.ToString();
                    lblTotal.Text         = datosFactura.total.ToString();
                }
            }
            catch (Exception)
            {
            }
        }
Beispiel #27
0
        private void btnCancelar_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Esta segura que desea cancelar la reserva?", "Mensaje de Confirmacion", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                {
                    int      idReservaInt = int.Parse(dgvReservas.Rows[dgvReservas.CurrentRow.Index].Cells[0].Value.ToString());
                    Reservas nuevo        = DB.Reservas.Find(idReservaInt);
                    nuevo.estado          = "CANCELADO";
                    DB.Entry(nuevo).State = System.Data.Entity.EntityState.Modified;
                    DB.SaveChanges();
                }
                consultarReservas();
            }
        }
 private void swAireAcondicionado_OnValueChange(object sender, EventArgs e)
 {
     if (checkFiltroServicios.Checked)
     {
         if (swAireAcondicionado.Value)
         {
             using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
             {
                 dgvHabitaciones.DataSource = (from h in DB.Habitaciones
                                               join dh in DB.Servicios on h.idHabitacion equals dh.idServicio
                                               where dh.aireAcondicionado == true
                                               select new { h.idHabitacion, h.precio, h.nroPiso, h.nroCamas, h.estado }
                                               ).ToList();
             }
         }
     }
 }
 public void CargarServicios(string idHabitacion)
 {
     using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
     {
         Servicios s = DB.Servicios.Find(idHabitacion);
         swAireAcondicionado.Value = (bool)s.aireAcondicionado;
         swAlberca.Value           = (bool)s.alberca;
         swBarHotel.Value          = (bool)s.barHotel;
         swEstacionamiento.Value   = (bool)s.estacionamiento;
         swGym.Value            = (bool)s.gym;
         swMascotas.Value       = (bool)s.mascotas;
         swRestaurante.Value    = (bool)s.restaurante;
         swSpa.Value            = (bool)s.spa;
         swWifiHabitacion.Value = (bool)s.wifiHabitacion;
         swWifiLobby.Value      = (bool)s.wifiLobby;
     }
 }
        private void dgvHabitaciones_Click(object sender, EventArgs e)
        {
            lblIdHabitacion.Text = dgvHabitaciones.Rows[dgvHabitaciones.CurrentRow.Index].Cells[0].Value.ToString();
            using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
            {
                Habitaciones h = DB.Habitaciones.Find(lblIdHabitacion.Text);
                nudPrecio.Value         = (decimal)h.precio;
                nudNroPiso.Value        = (decimal)h.nroPiso;
                nudNroCamas.Value       = (decimal)h.nroCamas;
                txtCaracteristica.Text  = h.caracteristicas;
                cbEstadoH.SelectedIndex = cbEstadoH.FindString(h.estado);
            }
            String tipo = dgvHabitaciones.Rows[dgvHabitaciones.CurrentRow.Index].Cells[5].Value.ToString();

            cbTipoHabitacion.SelectedIndex = cbTipoHabitacion.FindString(tipo);
            CargarServicios(lblIdHabitacion.Text);
        }