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!");
     }
 }
Example #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...";
                }
            }
        }
Example #3
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);
     }
 }
 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;
     }
 }
Example #5
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");
            }
        }
Example #6
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();
            }
        }
 public void ActualizarEstadoHabitaciones()
 {
     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
                             select new { h.idHabitacion }
                             ).ToList();
         foreach (var i in habitaciones)
         {
             Habitaciones h = DB.Habitaciones.Find(i.idHabitacion);
             h.estado          = "RESERVADA";
             DB.Entry(h).State = System.Data.Entity.EntityState.Modified;
             DB.SaveChanges();
         }
     }
 }
Example #8
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Esta seguro que desea modificar el huesped?", "Mensaje de Confirmacion", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                if (txtNombre.Text != "NOMBRE" && txtPaterno.Text != "PATERNO" && txtMaterno.Text != "MATERNO" && txtDocumento.Text != "DOCUMENTO" && txtPais.Text != "PAIS")
                {
                    try
                    {
                        using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                        {
                            Huespedes nuevog = new Huespedes();
                            nuevog.idHuesped       = lblUsuario.Text;
                            nuevog.nombre          = txtNombre.Text;
                            nuevog.paterno         = txtPaterno.Text;
                            nuevog.materno         = txtMaterno.Text;
                            nuevog.documento       = txtDocumento.Text;
                            nuevog.pais            = txtPais.Text;
                            nuevog.fechaNacimiento = dtpFechaNacimiento.Value;
                            DB.Entry(nuevog).State = System.Data.Entity.EntityState.Modified;
                            DB.SaveChanges();
                            MessageBox.Show("HUESPED MODIFICADO CON EXITO!");

                            dgvEmpleados.DataSource = (from d in DB.Huespedes
                                                       where d.idHuesped == lblUsuario.Text
                                                       select d).ToList();

                            limpiarCampos();
                            txtNombre.Focus();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("ERROR CON LA LLAVE PRIMARIA: " + ex.Message);
                    }
                }
                else
                {
                    lblError.Visible = true;
                }
            }
        }
        private void bunifuFlatButton1_Click(object sender, EventArgs e)
        {
            if (txtInforme.Text != "")
            {
                DialogResult result = MessageBox.Show("Esta seguro que desea modificar el registro?", "Mensaje de Confirmacion", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    try
                    {
                        string i = dgvRegistro.Rows[dgvRegistro.CurrentRow.Index].Cells[4].Value.ToString();
                        using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                        {
                            RegistroLimpieza nuevog = DB.RegistroLimpieza.Find(i);
                            nuevog.informe         = txtInforme.Text;
                            DB.Entry(nuevog).State = System.Data.Entity.EntityState.Modified;
                            DB.SaveChanges();
                        }

                        string ii = dgvHabitacion.Rows[dgvHabitacion.CurrentRow.Index].Cells[0].Value.ToString();
                        using (var DB = new SistemaHotelWaraEntitiesV1())
                        {
                            dgvRegistro.DataSource = (from h in DB.Habitaciones
                                                      join dh in DB.DetalleRegistroLimpiezas on h.idHabitacion equals dh.idHabitacion
                                                      join rl in DB.RegistroLimpieza on dh.idRegistroLimpieza equals rl.idRegistroLimpieza
                                                      join l in DB.Limpieza on dh.idEmpleado equals l.idEmpleado
                                                      where h.idHabitacion == ii && l.idEmpleado == idEmpleadoConectado
                                                      orderby rl.fecha.Value descending
                                                      select new { l.idEmpleado, rl.informe, rl.fecha, rl.hora, rl.idRegistroLimpieza }
                                                      ).ToList();
                        }
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Error con la modificacion!");
                    }
                }
            }
            else
            {
                MessageBox.Show("No puede modificar a un registro vacío! Por favor ingrese su registro!");
            }
        }
        private void bunifuFlatButton1_Click(object sender, EventArgs e)
        {
            if (txtInforme.Text != "")
            {
                DialogResult result = MessageBox.Show("Esta seguro que desea modificar el registro?", "Mensaje de Confirmacion", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    try
                    {
                        string i = dgvRegistro.Rows[dgvRegistro.CurrentRow.Index].Cells[3].Value.ToString();
                        using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                        {
                            RegistroMantenimiento nuevog = DB.RegistroMantenimiento.Find(i);
                            nuevog.informe         = txtInforme.Text;
                            DB.Entry(nuevog).State = System.Data.Entity.EntityState.Modified;
                            DB.SaveChanges();
                        }

                        using (var DB = new SistemaHotelWaraEntitiesV1())
                        {
                            var informe = (from rm in DB.RegistroMantenimiento
                                           where rm.idRegistroMantenimiento == i
                                           select new { rm.informe }
                                           ).ToList().First();

                            txtInforme.Text = informe.informe;
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            else
            {
                MessageBox.Show("No puede modificar a un registro vacio! Por favor complete su registro!");
            }
        }
        private void btnModificar_Click(object sender, EventArgs e)
        {
            if (txtNombre.Text != "NOMBRE" && txtPaterno.Text != "PATERNO" && txtMaterno.Text != "MATERNO" && txtEmail.Text != "E-MAIL" && txtPregunta.Text != "PREGUNTA RECUPERACIÓN" && txtRespuesta.Text != "RESPUESTA RECUPERACIÓN" && txtTelefono.Text != "TELEFONO")
            {
                try
                {
                    switch (lblUsuario.Text[0])
                    {
                    case 'G':
                        using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                        {
                            Gerente nuevog = new Gerente();
                            nuevog.idEmpleado      = lblUsuario.Text;
                            nuevog.contrasenia     = lblContra.Text;
                            nuevog.nombre          = txtNombre.Text;
                            nuevog.paterno         = txtPaterno.Text;
                            nuevog.materno         = txtMaterno.Text;
                            nuevog.email           = txtEmail.Text;
                            nuevog.telefono        = txtTelefono.Text;
                            nuevog.preguntaRecu    = txtPregunta.Text;
                            nuevog.respuestaRecu   = txtRespuesta.Text;
                            nuevog.fechaNacimiento = dtpFechaNacimiento.Value;
                            DB.Entry(nuevog).State = System.Data.Entity.EntityState.Modified;
                            DB.SaveChanges();
                            MessageBox.Show("EMPLEADO MODIFICADO CON EXITO!");
                            limpiarCampos();
                            CargarGerentes("");
                        }
                        break;

                    case 'R':
                        using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                        {
                            Recepcionista nuevog = new Recepcionista();
                            nuevog.idEmpleado      = lblUsuario.Text;
                            nuevog.contrasenia     = lblContra.Text;
                            nuevog.nombre          = txtNombre.Text;
                            nuevog.paterno         = txtPaterno.Text;
                            nuevog.materno         = txtMaterno.Text;
                            nuevog.email           = txtEmail.Text;
                            nuevog.telefono        = txtTelefono.Text;
                            nuevog.preguntaRecu    = txtPregunta.Text;
                            nuevog.respuestaRecu   = txtRespuesta.Text;
                            nuevog.fechaNacimiento = dtpFechaNacimiento.Value;
                            DB.Entry(nuevog).State = System.Data.Entity.EntityState.Modified;
                            DB.SaveChanges();
                            MessageBox.Show("EMPLEADO MODIFICADO CON EXITO!");
                            limpiarCampos();
                            CargarRecepcionista("");
                        }
                        break;

                    case 'L':
                        using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                        {
                            Limpieza nuevog = new Limpieza();
                            nuevog.idEmpleado      = lblUsuario.Text;
                            nuevog.contrasenia     = lblContra.Text;
                            nuevog.nombre          = txtNombre.Text;
                            nuevog.paterno         = txtPaterno.Text;
                            nuevog.materno         = txtMaterno.Text;
                            nuevog.email           = txtEmail.Text;
                            nuevog.telefono        = txtTelefono.Text;
                            nuevog.preguntaRecu    = txtPregunta.Text;
                            nuevog.respuestaRecu   = txtRespuesta.Text;
                            nuevog.fechaNacimiento = dtpFechaNacimiento.Value;
                            DB.Entry(nuevog).State = System.Data.Entity.EntityState.Modified;
                            DB.SaveChanges();
                            MessageBox.Show("EMPLEADO MODIFICADO CON EXITO!");
                            limpiarCampos();
                            CargarLimpieza("");
                        }
                        break;

                    case 'M':
                        using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                        {
                            Mantenimiento nuevog = new Mantenimiento();
                            nuevog.idEmpleado      = lblUsuario.Text;
                            nuevog.contrasenia     = lblContra.Text;
                            nuevog.nombre          = txtNombre.Text;
                            nuevog.paterno         = txtPaterno.Text;
                            nuevog.materno         = txtMaterno.Text;
                            nuevog.email           = txtEmail.Text;
                            nuevog.telefono        = txtTelefono.Text;
                            nuevog.preguntaRecu    = txtPregunta.Text;
                            nuevog.respuestaRecu   = txtRespuesta.Text;
                            nuevog.fechaNacimiento = dtpFechaNacimiento.Value;
                            DB.Entry(nuevog).State = System.Data.Entity.EntityState.Modified;
                            DB.SaveChanges();
                            MessageBox.Show("EMPLEADO MODIFICADO CON EXITO!");
                            limpiarCampos();
                            CargarMantenimiento("");
                        }
                        break;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("ERROR CON LA LLAVE PRIMARIA: " + ex.Message);
                }
            }
            else
            {
                lblError.Visible = true;
            }
        }
Example #12
0
        private void btnRealizar_Click(object sender, EventArgs e)
        {
            if (txtId.Text != "ID" && txtDescripcion.Text != "DESCRIPCION")
            {
                switch (cbAccion.SelectedItem.ToString())
                {
                case "AGREGAR":
                    try
                    {
                        using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                        {
                            Tipo nuevo = new Tipo();
                            nuevo.idTipo      = txtId.Text;
                            nuevo.descripcion = txtDescripcion.Text;
                            DB.Tipo.Add(nuevo);
                            DB.SaveChanges();
                            limpiarCampos();
                        }
                    }
                    catch (Exception)
                    {
                    }
                    break;

                case "MODIFICAR":
                    try
                    {
                        using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                        {
                            Tipo nuevo = new Tipo();
                            nuevo.idTipo          = txtId.Text;
                            nuevo.descripcion     = txtDescripcion.Text;
                            DB.Entry(nuevo).State = System.Data.Entity.EntityState.Modified;
                            DB.SaveChanges();
                            limpiarCampos();
                        }
                    }
                    catch (Exception)
                    {
                    }
                    break;

                default:
                    try
                    {
                        using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                        {
                            Tipo nuevo = DB.Tipo.Find(txtId.Text);
                            DB.Tipo.Remove(nuevo);
                            DB.SaveChanges();
                            limpiarCampos();
                        }
                    }
                    catch (Exception)
                    {
                    }
                    break;
                }
            }
            else
            {
                lblError.Visible = true;
            }
        }
        private void btnRealizar_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Esta seguro que desea realizar la accion?", "Mensaje de Confirmacion", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                if (txtId.Text != "ID" && txtDescripcion.Text != "DESCRIPCION")
                {
                    switch (cbAccion.SelectedItem.ToString())
                    {
                    case "AGREGAR":
                        try
                        {
                            using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                            {
                                Tipo nuevo = new Tipo();
                                nuevo.idTipo      = txtId.Text;
                                nuevo.descripcion = txtDescripcion.Text;
                                DB.Tipo.Add(nuevo);
                                DB.SaveChanges();
                                limpiarCampos();
                            }
                        }
                        catch (Exception)
                        {
                            MessageBox.Show("El tipo de habitacion que desea agregar ya se encuentra registrada!");
                        }
                        break;

                    case "MODIFICAR":
                        try
                        {
                            using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                            {
                                Tipo nuevo = new Tipo();
                                nuevo.idTipo          = txtId.Text;
                                nuevo.descripcion     = txtDescripcion.Text;
                                DB.Entry(nuevo).State = System.Data.Entity.EntityState.Modified;
                                DB.SaveChanges();
                                limpiarCampos();
                            }
                        }
                        catch (Exception)
                        {
                            MessageBox.Show("El tipo de habitacion que desea modificar no se encuentra registrado!");
                        }
                        break;

                    default:
                        try
                        {
                            using (SistemaHotelWaraEntitiesV1 DB = new SistemaHotelWaraEntitiesV1())
                            {
                                Tipo nuevo = DB.Tipo.Find(txtId.Text);
                                DB.Tipo.Remove(nuevo);
                                DB.SaveChanges();
                                limpiarCampos();
                            }
                        }
                        catch (Exception)
                        {
                            MessageBox.Show("El tipo de habitacion que desea eliminar no se encuentra registrado!");
                        }
                        break;
                    }
                }
                else
                {
                    lblError.Visible = true;
                }
            }
        }