Exemple #1
0
        //************************SENDIBLUE OBTENER LISTA DE CONTACTOS *********************************************************************************************************************************

        public async Task <string> GetAllContactSendiBlue(string endPoint)
        {
            EngineData        Valor     = EngineData.Instance();
            string            respuesta = string.Empty;
            ContactsSendiBlue resultado = new ContactsSendiBlue();

            using (HttpClient client = new HttpClient())
            {
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.Add("api-key", EngineData.ApiKeySendiBlue);
                HttpResponseMessage response = await client.GetAsync(endPoint);

                if (response.IsSuccessStatusCode)
                {
                    respuesta = await response.Content.ReadAsStringAsync();

                    resultado = JsonConvert.DeserializeObject <ContactsSendiBlue>(respuesta);
                }
                else
                {
                    respuesta = response.IsSuccessStatusCode.ToString();
                }
            }
            Valor.ListaSendiBlueContacto = resultado;
            return(respuesta);
        }
Exemple #2
0
 public static EngineData Instance()
 {
     if ((valor == null))
     {
         valor = new EngineData();
     }
     return(valor);
 }
Exemple #3
0
        /* private List<SendiBlueTransaccional.To> ListaTo()
         * {
         *   EngineData Valor = EngineData.Instance();
         *   ContactsSendiBlue listaContacts = Valor.ListaSendiBlueContacto;
         *   List<SendiBlueTransaccional.To> l = new List<SendiBlueTransaccional.To>();
         *   string[] p = new string[2];
         *   foreach (ContactsSendiBlue.Contact item in listaContacts.contacts)
         *   {
         *       p = item.email.Split('@');
         *       SendiBlueTransaccional.To i = new SendiBlueTransaccional.To()
         *       {
         *           email = item.email,
         *           name = p[0]
         *       };
         *       l.Add(i);
         *    }
         *
         *   return l;
         * }*/


        private List <SendiBlueTransaccional.To> ListaTo()
        {
            EngineData        Valor            = EngineData.Instance();
            ContactsSendiBlue listaContacts    = Valor.ListaSendiBlueContacto;
            List <SendiBlueTransaccional.To> l = new List <SendiBlueTransaccional.To>();


            SendiBlueTransaccional.To i = new SendiBlueTransaccional.To()
            {
                email = "*****@*****.**",
                name  = "efrain mejias"
            };
            l.Add(i);


            return(l);
        }