public async Task <GetCardHolder_DTO> ObtenerPersona(string idPersona, string idTipo)
        {
            GetCardHolder_DTO        persona    = new GetCardHolder_DTO();
            ManagementObjectSearcher cardHolder = new ManagementObjectSearcher();

            switch (idTipo)
            {
            case "V":
                cardHolder = await _cardHolder_REP.GetVisitor(idPersona, _path, _user, _pass);

                break;

            default:
                cardHolder = await _cardHolder_REP.GetCardHolder(idPersona, _path, _user, _pass);

                break;
            }


            try
            {
                foreach (ManagementObject queryObj in cardHolder.Get())
                {
                    try { persona.apellidos = queryObj["LASTNAME"].ToString(); } catch { persona.apellidos = null; }
                    try { persona.nombres = queryObj["FIRSTNAME"].ToString(); } catch { persona.nombres = null; }
                    try { persona.ssno = queryObj["SSNO"].ToString(); } catch { persona.ssno = null; }
                    try { persona.status = queryObj["STATE"].ToString(); } catch { persona.status = null; }
                    try { persona.documento = queryObj["OPHONE"].ToString(); } catch { persona.documento = null; }
                    try { persona.empresa = queryObj["DIVISION"].ToString(); } catch { persona.empresa = null; }
                    try { persona.ciudad = queryObj["CITY"].ToString(); } catch { persona.ciudad = null; }
                    try { persona.email = queryObj["EMAIL"].ToString(); } catch { persona.email = null; }
                    List <GetBadge_DTO> badges = await _badge_REP_LOCAL.ConsultarBadge(queryObj["ID"].ToString());

                    persona.Badges = badges;
                }

                return(persona);
            }
            catch (Exception ex) { throw new Exception("message: " + ex.Message + "|||query: " + cardHolder.Query.QueryString +
                                                       "|||path: " + cardHolder.Scope.Path + "|||st: " + ex.StackTrace + "|||inne: " + ex.InnerException + "|||data: " +
                                                       ex.Data + "|||helplink: " + ex.HelpLink + "|||Hresult: " + ex.HResult); }
        }
        public async Task <GetCardHolder_DTO> ObtenerPersona(string documento, string ssno)
        {
            GetCardHolder_DTO persona = new GetCardHolder_DTO();

            ManagementObjectSearcher cardHolder = await _cardHolder_REP.GetCardHolder(documento, ssno, _path, _user, _pass);

            try
            {
                foreach (ManagementObject queryObj in cardHolder.Get())
                {
                    persona.id = int.Parse(queryObj["ID"].ToString());
                    try { persona.apellidos = queryObj["LASTNAME"].ToString(); } catch { persona.apellidos = null; }
                    try { persona.nombres = queryObj["FIRSTNAME"].ToString(); } catch { persona.nombres = null; }
                    try { persona.ssno = queryObj["SSNO"].ToString(); } catch { persona.ssno = null; }
                    try { persona.status = queryObj["STATE"].ToString(); } catch { persona.status = null; }
                    try { persona.documento = queryObj["OPHONE"].ToString(); } catch { persona.documento = null; }
                    try { persona.empresa = queryObj["TITLE"].ToString(); } catch { persona.empresa = null; }
                    try { persona.ciudad = queryObj["DEPT"].ToString(); } catch { persona.ciudad = null; }
                    try { persona.instalacion = queryObj["BUILDING"].ToString(); } catch { persona.instalacion = null; }
                    try { persona.piso = queryObj["FLOOR"].ToString(); } catch { persona.piso = null; }
                    try { persona.area = queryObj["DIVISION"].ToString(); } catch { persona.area = null; }
                    try { persona.email = queryObj["EMAIL"].ToString(); } catch { persona.email = null; }
                    persona.permiteVisitantes = (bool)queryObj["ALLOWEDVISITORS"];
                    List <GetBadge_DTO> badges = await _badge_REP_LOCAL.ConsultarBadge(queryObj["ID"].ToString());

                    persona.Badges = badges;
                }

                if (persona.id == 0)
                {
                    throw new Exception("no se encontró una persona registrada con esos datos");
                }
                return(persona);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }