Esempio n. 1
0
        private void AgregarIngresos()
        {
            DispositivoBioStar Dispositivo = (DispositivoBioStar)_BioStar.Dispositivos[0];

            Dispositivo.LeerLogIngresosEgresosExitosos();

            Persistence.Database oDatos = new Persistence.Database();
            oDatos.conectar();
            oDatos.Ejecutar_Consulta("SELECT UltimaFechaLog FROM Configuracion");
            DateTime UltimoLog = new DateTime(1970, 1, 1);

            if (oDatos.Tabla.Rows.Count > 0)
            {
                UltimoLog = DateTime.Parse(oDatos.Tabla.Rows[0].ItemArray[0].ToString());
            }
            oDatos.Desconectar();


            DateTime UltimoLogNuevo = new DateTime(1970, 1, 1);

            oDatos.conectar();
            foreach (LogBioStar Registro in Dispositivo.Log)
            {
                if ((Registro.FechaHora > UltimoLog) && (Registro.EventoTNA == 0))
                {
                    oDatos.Ejecutar_Sentencia("INSERT INTO Ingresos (idPersonas, Activo, FechaIngreso, idUbicacionesIngreso, idUbicacionesEgreso) VALUES (" +
                                              Registro.UsuarioID + ", 'True', " + BioSoft.Funciones.FechaASQL(Registro.FechaHora) + "," + 1 + "," + 1 + ")");
                    if (Registro.FechaHora > UltimoLogNuevo)
                    {
                        UltimoLogNuevo = Registro.FechaHora;
                    }
                }
            }
            oDatos.Desconectar();


            if (UltimoLogNuevo.Year > 1970)
            {
                oDatos.conectar();
                oDatos.Ejecutar_Sentencia("UPDATE Configuracion SET UltimaFechaLog = " + BioSoft.Funciones.FechaASQL(UltimoLogNuevo));
                oDatos.Desconectar();
            }
        }
Esempio n. 2
0
        public void Modificacion()
        {
            string huella1, huella2;

            if (this.Dedo1Huella == null)
            {
                huella1 = "null";
            }
            else
            {
                huella1 = "'" + this.Dedo1Huella.ToString() + "'";
            }
            if (this.Dedo2Huella == null)
            {
                huella2 = "null";
            }
            else
            {
                huella2 = "'" + this.Dedo2Huella.ToString() + "'";
            }
            string sqlsentencia = "UPDATE Personas SET "
                                  + "nombre = '" + this.Nombre + "',"
//            + "imagen = @Imagen,"
                                  + "apellido = '" + this.Apellido + "',"
                                  + "idRolesPersonas = '" + this.idRolesPersonas + "',"
                                  + "idTiposDocumento = '" + this.idTiposDocumento + "',"
                                  + "FechaNacimiento = " + Funciones.FechaASQL(this.FechaNacimiento) + ","
                                  + "FechaBaja = " + Funciones.FechaASQL(this.FechaBaja) + ","
                                  + "FechaAlta = " + Funciones.FechaASQL(this.FechaAlta) + ","
                                  + "Celular = '" + this.Celular + "',"
//            + "Dedo1Huella = '" + this.Dedo1Huella +"',"
//            + "Dedo2Huella = '" + this.Dedo2Huella +"',"
                                  + "Dedo1Checksum = '" + this.Dedo1Checksum + "',"
                                  + "Dedo2Checksum = '" + this.Dedo2Checksum + "',"
                                  + "Dedos = '" + this.Dedos + "',"
                                  + "Activo = '" + this.Activo + "',"
                                  + "Masculino = '" + this.Masculino + "',"
                                  + "Administrador = '" + this.Administrador + "',"
                                  + "idNivelesSeguridad = '" + this.idNivelesSeguridad + "',"
                                  + "NumeroDocumento = '" + this.NumeroDocumento + "'"
                                  + " WHERE idPersonas = " + this.idPersonas;

            Persistence.Database oDatos = new Persistence.Database();
            oDatos.conectar();
            oDatos.Ejecutar_Sentencia(sqlsentencia);
            oDatos.Desconectar();
        }
Esempio n. 3
0
        public int Alta()
        {
            string fechaIngreso, fechaEgreso;

            if (this.FechaIngreso == null)
            {
                fechaIngreso = "null";
            }
            else
            {
                fechaIngreso = this.FechaIngreso.ToString();
            }
            if (this.FechaEgreso == null)
            {
                fechaEgreso = "null";
            }
            else
            {
                fechaEgreso = this.FechaEgreso.ToString();
            }
            string sqlsentencia = "INSERT INTO Ingresos"
                                  + "(activo, vehiculo, pertenencias, codigoTarjeta, tiempoExtendido, tiempoPersonal, idUbicacionesEgreso, idUbicacionesIngreso, fechaIngreso, fechaEgreso, Lote, idPersonas)"
                                  + "values ("
                                  + " '" + this.Activo + "',"
                                  + " '" + this.Vehiculo + "',"
                                  + " '" + this.Pertenencias + "',"
                                  + " '" + this.CodigoTarjeta + "',"
                                  + " '" + this.TiempoExtendido + "',"
                                  + " '" + this.TiempoPersonal + "',"
                                  + " '" + this.idUbicacionesEgreso + "',"
                                  + " '" + this.idUbicacionesIngreso + "',"
                                  + " " + Funciones.FechaASQL(this.FechaIngreso) + ","
                                  + " " + Funciones.FechaASQL(this.FechaEgreso) + ","
                                  + " '" + this.Lote + "',"
                                  + " '" + this.idPersonas + "')";

            Persistence.Database oDatos = new Persistence.Database();
            oDatos.conectar();
            int ID = oDatos.Ejecutar_Sentencia(sqlsentencia);

            oDatos.Desconectar();
            return(ID);
        }
Esempio n. 4
0
        public void Modificacion()
        {
            string sqlsentencia = "UPDATE Ingresos SET "
                                  + "Activo = '" + this.Activo + "',"
                                  + "Vehiculo = '" + this.Vehiculo + "',"
                                  + "Pertenencias = '" + this.Pertenencias + "',"
                                  + "CodigoTarjeta = '" + this.CodigoTarjeta + "',"
                                  + "TiempoExtendido = '" + this.TiempoExtendido + "',"
                                  + "TiempoPersonal = '" + this.TiempoPersonal + "',"
                                  + "idUbicacionesEgreso = '" + this.idUbicacionesEgreso + "',"
                                  + "idUbicacionesIngreso =  '" + this.idUbicacionesIngreso + "',"
                                  + "fechaIngreso =  " + Funciones.FechaASQL(this.FechaIngreso) + ","
                                  + "fechaEgreso =  " + Funciones.FechaASQL(this.FechaEgreso) + ","
                                  + "Lote = '" + this.Lote + "',"
                                  + "idPersonas = '" + this.idPersonas + "'"
                                  + " WHERE idIngresos = " + this.idIngresos;

            Persistence.Database oDatos = new Persistence.Database();
            oDatos.conectar();
            oDatos.Ejecutar_Sentencia(sqlsentencia);
            oDatos.Desconectar();
        }