public void OnComplete(object Capture, string ReaderSerialNumber, DPFP.Sample Sample) { try { if (TipoForm == 1) { this.CapturarChecado(Sample); } else if (TipoForm == 2) { ProcesarPersonal(Sample); } } catch (Exception ex) { LogError.AddExcFileTxt(ex, "LectorHuella ~ OnComplete"); } }
public void VerificarChecado(frmChecarEntradaSalida FrmChecar, DPFP.Sample Sample, DataTable datosHuellas, ref bool acceso, ref string id_usuario) { try { foreach (DataRow usuario in datosHuellas.Rows) { DPFP.Template templateGuardado = new DPFP.Template(); templateGuardado.DeSerialize(ConvertirStringToBytes.StringToBytes(usuario["HuellaDigital"].ToString())); if (ProcesarChecado(Sample, templateGuardado, FrmChecar)) { id_usuario = usuario["IDEmpleado"].ToString(); acceso = true; break; } } } catch (Exception ex) { LogError.AddExcFileTxt(ex, "LectorHuell ~ VerificarChecado"); } }
public bool Init() { try { Capturer = new DPFP.Capture.Capture(); if (null != Capturer) { Capturer.EventHandler = this; return(true); } else { return(false); } } catch (Exception ex) { LogError.AddExcFileTxt(ex, "LectorHuella ~ Init"); return(false); } }
public DPFP.FeatureSet ExtractFeaturesChecar(DPFP.Sample Sample, DPFP.Processing.DataPurpose Purpose) { try { DPFP.Processing.FeatureExtraction Extractor = new DPFP.Processing.FeatureExtraction(); DPFP.Capture.CaptureFeedback feedback = DPFP.Capture.CaptureFeedback.None; DPFP.FeatureSet features = new DPFP.FeatureSet(); Extractor.CreateFeatureSet(Sample, Purpose, ref feedback, ref features); if (feedback == DPFP.Capture.CaptureFeedback.Good) { return(features); } else { return(null); } } catch (Exception ex) { LogError.AddExcFileTxt(ex, "LectorHuella ~ ExtractFeaturesChecar"); return(null); } }
public static bool UploadFTP(string FilePath, string RemotePath, string Login, string Password) { try { using (FileStream fs = new FileStream(FilePath, FileMode.Open, FileAccess.Read, FileShare.Read)) { string url = Path.Combine(RemotePath, Path.GetFileName(FilePath)).ToLower(); FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(url); ftp.Credentials = new NetworkCredential(Login, Password); ftp.Method = WebRequestMethods.Ftp.UploadFile; ftp.KeepAlive = false; ftp.UseBinary = true; ftp.ContentLength = fs.Length; ftp.Proxy = null; fs.Position = 0; int buffLength = 2048; byte[] buff = new byte[buffLength]; int contentLen; using (Stream strm = ftp.GetRequestStream()) { contentLen = fs.Read(buff, 0, buffLength); while (contentLen != 0) { strm.Write(buff, 0, contentLen); contentLen = fs.Read(buff, 0, buffLength); } } } return(true); } catch (Exception ex) { LogError.AddExcFileTxt(ex, "UtilFtp ~ UploadFTP"); return(false); } }
public void CapturarChecado(DPFP.Sample Sample) { try { if (DatosHuellas == null) { Usuario_Negocio UN = new Usuario_Negocio(); Usuario DatosAux = new Usuario { Conexion = Comun.Conexion }; UN.ObtenerHuellasDigitales(DatosAux); DatosHuellas = DatosAux.TablaDatos; } VerificarChecado(FrmChecar, Sample, DatosHuellas, ref acceso, ref IDUsuario); if (acceso == true) { bool Concluido = false; this.FrmChecar.Invoke(new Function(delegate() { Concluido = FrmChecar.Checar(IDUsuario); })); if (Concluido) { FrmChecar.DialogResult = DialogResult.OK; Template = null; FrmChecar.Lector.Stop(); FrmChecar.Lector = new LectorHuella(); } else { FrmChecar.Lector.Stop(); FrmChecar.Invoke(new Function(delegate() { FrmChecar.lblInstrucciones.Text = "Error al procesar la huella."; FrmChecar.lblInstrucciones.BackColor = Color.Red; })); Thread.Sleep(2400); Template = null; FrmChecar.Lector = new LectorHuella(); FrmChecar.frmChecarEntradaSalida_Load(new object(), new EventArgs()); } } else { FrmChecar.Invoke(new Function(delegate() { FrmChecar.lblInstrucciones.Text = "Huella no registrada."; FrmChecar.lblInstrucciones.BackColor = Color.Red; })); Thread.Sleep(2400); FrmChecar.Invoke(new Function(delegate() { FrmChecar.lblInstrucciones.Text = "Use el lector para escanear su huella digital."; FrmChecar.lblInstrucciones.BackColor = Color.GreenYellow; })); } } catch (Exception ex) { LogError.AddExcFileTxt(ex, "LectorHuella ~ CapturarChecado"); } }