コード例 #1
0
        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);
        }
コード例 #2
0
 protected internal override void Antes()
 {
     Dto = new es_terceros();
     Mapper.Map(oDto, Dto);
     ctx.es_terceros.Add(Dto);
     byaRpt.id = Dto.terceroid.ToString();
 }
コード例 #3
0
        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);
        }
コード例 #4
0
 protected internal override bool esValido()
 {
     objO = ctx.es_terceros.Where(t => t.terceroid == oDto.terceroid).FirstOrDefault();
     if (objO != null)
     {
         return(true);
     }
     else
     {
         byaRpt.Mensaje = "No se encuentra el tercero con ese número de identificación";
         byaRpt.Error   = true;
         return(false);
     }
 }
コード例 #5
0
 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);
 }
コード例 #6
0
        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);
        }