public void entraTrabajar(Int32 historialid)
        {
            HISTORIAL_ACTIVIDAD historial = context.HISTORIAL_ACTIVIDAD.FirstOrDefault(x => x.ID_ACTIVIDAD == historialid);

            if (historial != null)
            {
                historial.ACTIVIDAD_REALIZADA = "T";
                context.SaveChanges();
            }
        }
        public void nuevoHistorial(Int32 clienteid, Int32 sedeid)
        {
            HISTORIAL_ACTIVIDAD historial = new HISTORIAL_ACTIVIDAD();

            historial.ID_CLIENTE          = clienteid;
            historial.ID_SEDE             = sedeid;
            historial.ACTIVIDAD_REALIZADA = "E";

            context.HISTORIAL_ACTIVIDAD.Add(historial);
            context.SaveChanges();
        }
        public void completarHistorial(Int32 historialid, Int32 tabletaid)
        {
            HISTORIAL_ACTIVIDAD historial = context.HISTORIAL_ACTIVIDAD.FirstOrDefault(x => x.ID_ACTIVIDAD == historialid);

            if (historial.HORA_ENTRADA == null && historial.HORA_SALIDA == null)
            {
                historial.HORA_ENTRADA       = DateTime.Now;
                historial.ID_TABLETA_ENTRADA = tabletaid;
                context.SaveChanges();
            }
            else
            {
                historial.HORA_SALIDA       = DateTime.Now;
                historial.ID_TABLETA_SALIDA = tabletaid;
                context.SaveChanges();
            }
        }
        public HISTORIAL_ACTIVIDAD getHistorialCliente(Int32 clienteid)
        {
            HISTORIAL_ACTIVIDAD historial = new HISTORIAL_ACTIVIDAD();

            return(context.HISTORIAL_ACTIVIDAD.Where(x => x.ID_CLIENTE == clienteid).OrderByDescending(x => x.ID_ACTIVIDAD).FirstOrDefault());
        }
Esempio n. 5
0
        private void axBioPlugInActX_OnIdentify(object sender, EventArgs e)
        {
            documento = axBioPlugInActX.result;
            afiliado  = afiliadoBC.getAfiliado(documento);

            if (afiliado == null)
            {
                mensajeSalida = MensajeSalida.NoIdentificado;
                return;
            }
            else
            {
                var diasRestantes = DateTime.Today - afiliado.PRODUCTO_FECHA_VENCE;

                if (diasRestantes.Days > 0)
                {
                    mensajeSalida = MensajeSalida.AfiliacionVencida;
                    return;
                }

                Int32 clienteid = afiliado.TABLA_CLIENTE.Select(x => x.ID_CLIENTE).FirstOrDefault();
                HISTORIAL_ACTIVIDAD historial = historialBC.getHistorialCliente(clienteid);

                Boolean cumpleaños = helperBC.esCumpleanios(documento);
                Boolean trabaja    = helperBC.esTrabajador(documento);

                if (historial == null || (historial.HORA_ENTRADA != null && historial.HORA_SALIDA != null))
                {
                    historialBC.nuevoHistorial(clienteid, 1);
                    historial = historialBC.getHistorialCliente(clienteid);
                }

                historialid = historial.ID_ACTIVIDAD;

                if (historial.HORA_ENTRADA == null && historial.HORA_SALIDA == null) // ESTOY FUERA Y QUIERO ENTRAR
                {
                    if (tabletaEntrada)                                              //TABLETA ENTRADA // PUEDE INGRESAR
                    {
                        if (trabaja)                                                 //TRABAJA
                        {
                            if (cumpleaños)
                            {
                                mensajeSalida = MensajeSalida.CumpleañosTrabajador;
                            }
                            else
                            {
                                mensajeSalida = MensajeSalida.EntradaTrabajador;
                            }
                        }
                        else // SOLO AFILIADO
                        {
                            if (cumpleaños)
                            {
                                mensajeSalida = MensajeSalida.CumpleañosAfiliado;
                            }
                            else
                            {
                                mensajeSalida = MensajeSalida.EntradaAfiliado;
                            }
                        }
                        tituloPantalla = "BIENVENIDO";
                    }
                    else  //TABLETA SALIDA // NO PUEDE INGRESAR
                    {
                        mensajeSalida = MensajeSalida.ActividadInusual;
                    }
                }
                else // ESTA DENTRO Y QUIERE SALIR
                {
                    if (!tabletaEntrada) //TABLETA SALIDA // PUEDE SALIR
                    {
                        mensajeSalida  = MensajeSalida.SalidaCorrecta;
                        tituloPantalla = "HASTA PRONTO";
                    }
                    else //TABLETA ENTRADA // NO PUEDE SALIR
                    {
                        mensajeSalida = MensajeSalida.ActividadInusual;
                    }
                }
            }
        }
Esempio n. 6
0
        private void btnIngresarVisita_Click(object sender, RoutedEventArgs e)
        {
            opcionEntrar = TypeModo.ingresoVisita;
            if (txtInvitadosDNI.Text == "")
            {
                mensajeSalida = MensajeAlerta.FaltaData;
                mostrarAlerta(opcionEntrar, mensajeSalida);
            }
            else
            {
                if (txtInvitadosDNI.Text == free)
                {
                    Dispatcher.Invoke(() => { _actividadInvitado.Stop(); });
                    BienvenidoTxt.Text       = "Adelante";
                    nombreComple.Text        = "Undefined";
                    PeriodoFecha.Text        = " 15/12/2017 - 15/12/2020";
                    tipoMembresia.Visibility = Visibility.Hidden;
                    txtMembresia.Visibility  = Visibility.Hidden;
                    txtInvitadosDNI.Clear();
                    tabGENERAL.SelectedIndex = 5;
                    flag = true;

                    Dispatcher.Invoke(() => { _regresarInicio.Start(); });
                    arduino.spArduino.Write("1");
                    //Console.WriteLine(flag);
                }
                else
                {
                    flag = false;
                    VISITAS visita = usuarioBC.getVisita(txtInvitadosDNI.Text);

                    if (visita == null)
                    {
                        mensajeSalida = MensajeAlerta.NoIdentificadoVisita;
                        mostrarAlerta(opcionEntrar, mensajeSalida);
                    }
                    else
                    {
                        var diasRestantes = DateTime.Today - visita.PRODUCTO_FECHA_VENCIMIENTO;
                        if (diasRestantes.Days > 0)
                        {
                            mensajeSalida = MensajeAlerta.InvitacionVencida;
                            mostrarAlerta(opcionEntrar, mensajeSalida);
                        }
                        else
                        {
                            Int32 clienteid = visita.TABLA_CLIENTE.Select(x => x.ID_CLIENTE).FirstOrDefault();
                            HISTORIAL_ACTIVIDAD historial = historialBC.getHistorialCliente(clienteid);
                            if (historial == null || (historial.HORA_ENTRADA != null && historial.HORA_SALIDA != null))
                            {
                                historialBC.nuevoHistorial(clienteid, 1);
                                historial = historialBC.getHistorialCliente(clienteid);
                            }

                            if (historial.HORA_ENTRADA == null && historial.HORA_SALIDA == null) //ESTOY AFUERA Y QUIERO ENTRAR
                            {
                                if (tabletaEntrada)                                              //TABLETA ENTRADA // ENTRA
                                {
                                    String titulo = "BIENVENIDO";
                                    pantallaBienvenido(opcionEntrar, visita, titulo);
                                }
                                else //TABLETA SALIDA // NO PUEDE ENTRAR
                                {
                                    mensajeSalida = MensajeAlerta.ActividadInusual;
                                    mostrarAlerta(opcionEntrar, mensajeSalida);
                                }
                            }
                            else //ESTOY DENTRO Y QUIERO ENTRAR
                            {
                                if (!tabletaEntrada) //TABLETA SALIDA // PUEDE SALIR
                                {
                                    String titulo = "HASTA PRONTO";
                                    pantallaBienvenido(opcionEntrar, visita, titulo);
                                }
                                else //TABLETA ENTRADA // NO PUEDE SALIR
                                {
                                    mensajeSalida = MensajeAlerta.ActividadInusual;
                                    mostrarAlerta(opcionEntrar, mensajeSalida);
                                }
                            }
                        }
                    }
                }
            }
        }