public ByARpt CambioContraseña(string uRol, string antiguoPassword, string newPassword) { ByARpt res = new ByARpt(); using (ctx = new bd_esEntities()) { usuarios usuario = ctx.usuarios.Where(t => t.Usuario == uRol).FirstOrDefault(); if (usuario.Contraseña == antiguoPassword) { usuario.Contraseña = newPassword; try { ctx.SaveChanges(); res.Error = false; res.Mensaje = "Se cambio contraseña"; } catch { res.Error = true; res.Mensaje = "No se pudo cambiar contraseña..."; } } else { res.Error = true; res.Mensaje = "La contraseña antigua no es correcta..."; } } return(res); }
public ByARpt Enviar() { byaRpt = new ByARpt(); using (ctx = new bd_esEntities()) { if (!esValido()) { return(byaRpt); } try { Antes(); SaveChange(); Despues(); } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { ByAExcep.AdminException(byaRpt, ex); } catch (Exception ex) { ByAExcep.AdminException(byaRpt, ex); } return(byaRpt); } }
public ByARpt AsignarCodigoHuellaPersona(string idPersona, int idHuella) { ByARpt res = new ByARpt(); using (ctx = new bd_esEntities()) { es_terceros persona = ctx.es_terceros.Where(t => t.terceroid == idPersona).FirstOrDefault(); persona.indice_id = idHuella; if (persona != null) { try { ctx.SaveChanges(); res.Error = false; res.Mensaje = "Operacion realizada correctamente..."; } catch { res.Error = true; res.Mensaje = "Ha ocurrido un error al intentar guardar..."; } } else { res.Error = true; res.Mensaje = "Error: el documento no se encuentra..."; } } return(res); }
public es_entradassalidasDto GetUltimoRegistro(string idTercero) { es_entradassalidasDto rRegistro = new es_entradassalidasDto(); using (ctx = new bd_esEntities()) { es_entradassalidas Registro = ctx.es_entradassalidas.Where(t => t.idTercero == idTercero).OrderByDescending(t => t.FechaEntrada).FirstOrDefault(); Mapper.Map(Registro, rRegistro); } return(rRegistro); }
public int GetIdUltimoTemplate() { int IdUltimaHuella; using (bd_esEntities db = new bd_esEntities()) { enroll Huella = db.enroll.OrderByDescending(t => t.ID).FirstOrDefault(); IdUltimaHuella = Huella.ID; } return(IdUltimaHuella); }
public es_tercerosFotoDto GetPorIdHuella(int IdHuella) { es_tercerosFotoDto rPersonas = new es_tercerosFotoDto(); using (ctx = new bd_esEntities()) { es_terceros lPersonas = ctx.es_terceros.Where(t => t.indice_id == IdHuella).FirstOrDefault(); Mapper.Map(lPersonas, rPersonas); } return(rPersonas); }
public List <es_tercerosDto> Gets() { List <es_tercerosDto> lrPersonas = new List <es_tercerosDto>(); using (ctx = new bd_esEntities()) { List <es_terceros> lPersonas = ctx.es_terceros.ToList(); Mapper.Map(lPersonas, lrPersonas); } return(lrPersonas); }
public void SaveTemplate(FingerprintTemplateDTO fingerPrintTemplate) { using (bd_esEntities db = new bd_esEntities()) { enroll nuevo = new enroll(); nuevo.quality = fingerPrintTemplate.Quality; nuevo.template = fingerPrintTemplate.Buffer; db.enroll.Add(nuevo); db.SaveChanges(); } }
public FingerprintTemplateDTO GetTemplate(int idTemplate) { FingerprintTemplateDTO fpt; using (bd_esEntities db = new bd_esEntities()) { fpt = db.enroll.Where(t => t.ID == idTemplate).Select( t => new FingerprintTemplateDTO { Quality = (int)t.quality, Buffer = t.template, ID = t.ID }).FirstOrDefault(); } return(fpt); }
public List <FingerprintTemplateDTO> GetTemplates() { List <FingerprintTemplateDTO> lst; using (bd_esEntities db = new bd_esEntities()) { lst = db.enroll.Select( t => new FingerprintTemplateDTO { Quality = (int)t.quality, Buffer = t.template, ID = t.ID }).ToList(); } return(lst); }
public byte[] ObtenerFotoTercero(string idTercero) { byte[] imagen; using (ctx = new bd_esEntities()) { es_terceros tercero = ctx.es_terceros.Where(t => t.terceroid == idTercero).FirstOrDefault(); if (tercero != null) { imagen = tercero.foto; } else { imagen = null; } } return(imagen); }
public void DeleteTemplate(int idTemplate) { using (ctx = new bd_esEntities()) { enroll huella = ctx.enroll.Where(t => t.ID == idTemplate).FirstOrDefault(); if (huella != null) { ctx.enroll.Remove(huella); try { ctx.SaveChanges(); } catch { } } } }
public es_rtpLogin Login(string usuario, string password) { es_rtpLogin res = new es_rtpLogin(); using (ctx = new bd_esEntities()) { usuarios usu = ctx.usuarios.Where(t => t.Usuario == usuario && t.Contraseña == password).FirstOrDefault(); if (usu != null) { res.permiso = true; res.rol = usu.Rol; } else { res.permiso = false; } } return(res); }
public List <RegistroEntradasSalidasDto> GetEntradasSalidasPersona(DateTime FInicial, DateTime FFinal, string idTercero) { List <RegistroEntradasSalidasDto> lrRES = new List <RegistroEntradasSalidasDto>(); using (ctx = new bd_esEntities()) { es_terceros persona = ctx.es_terceros.Where(t => t.terceroid == idTercero).FirstOrDefault(); if (persona != null) { List <es_entradassalidas> lRES = ctx.es_entradassalidas.Where(t => t.idTercero == idTercero && t.FechaEntrada >= FInicial && t.FechaEntrada <= FFinal).OrderBy(t => t.FechaEntrada).ToList(); if (lRES != null) { foreach (es_entradassalidas item in lRES) { if (item.FechaSalida != null) { RegistroEntradasSalidasDto registro = new RegistroEntradasSalidasDto(); registro.idTercero = idTercero; registro.nombre = persona.nombre; registro.FechaEntrada = item.FechaEntrada.ToString(); registro.FechaSalida = item.FechaSalida.ToString(); DateTime FE = (DateTime)item.FechaEntrada; DateTime FS = (DateTime)item.FechaSalida; TimeSpan Duracion = FS - FE; double segundos = (double)Duracion.Seconds / 3600; double minutes = (double)Duracion.Minutes / 60; registro.TiempoDentro = Duracion.Hours + minutes + segundos; if (registro.TiempoDentro > 0) { lrRES.Add(registro); } } } } } } return(lrRES); }