Exemplo n.º 1
0
        public void ProcesarBeneficiariosCiudades(string numDoc, string tipoDoc, string token, string idConv, string numeroCelular)
        {
            ISchedulingPetitionsRepository petitionsRepository = new SchedulingPetitionsRepository();
            ISchedulingSaveRepository      saveRepository      = new SchedulingSaveRepository();
            SchedulingPetitionsService     serv = new SchedulingPetitionsService();
            AuthenticationApp aApp           = new AuthenticationApp();
            LocalQueriesApp   lApp           = new LocalQueriesApp();
            string            identificacion = tipoDoc + numDoc;

            _ = lApp.LimpiarTablas(idConv);
            List <BeneficiarioContratante> bens = serv.GetBeneficiariosContratante(petitionsRepository, saveRepository, identificacion, token, idConv);

            if (bens[0].Parentesco == "error_token")
            {
                token = aApp.RefreshToken(numeroCelular, identificacion, idConv);
                if (token != "error_credenciales" && token != "error_parametros" && token != "error_desconocido")
                {
                    bens = serv.GetBeneficiariosContratante(petitionsRepository, saveRepository, identificacion, token, idConv);
                }
            }
            if (bens.Count > 0)
            {
                dynamic lBen = bens.GroupBy(elem => elem.IdUsuario).Select(group => group.First());
                foreach (BeneficiarioContratante ben in lBen)
                {
                    string rC = serv.ProcesarCiudadesBeneficiarioBd(petitionsRepository, saveRepository, ben.NumeroIdentificacion, ben.TipoIdentificacion, token, idConv, ben.IdUsuario);
                    if (rC == "error_token")
                    {
                        token = aApp.RefreshToken(numeroCelular, identificacion, idConv);
                        serv.ProcesarCiudadesBeneficiarioBd(petitionsRepository, saveRepository, ben.NumeroIdentificacion, ben.TipoIdentificacion, token, idConv, ben.IdUsuario);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void GetBeneficiariosContratante()
        {
            ISchedulingPetitionsRepository petRepository  = new SchedulingPetitionsRepository();
            SchedulingPetitionsService     petService     = new SchedulingPetitionsService();
            IAuthenticationRepository      authRepository = new AuthenticationRepository();
            ISchedulingSaveRepository      saveRepository = new SchedulingSaveRepository();
            AuthenticationService          authService    = new AuthenticationService();
            string token = authService.RefreshToken(authRepository, "3194198375", "CC79880800", "alvaroposada");
            List <BeneficiarioContratante> res = petService.GetBeneficiariosContratante(petRepository, saveRepository, "CC79880800", token, "98fddusfh89udf-sf98df-9");

            Assert.IsNotNull(res);
        }