Exemplo n.º 1
0
        public JsonResult GetTagMailChimp()
        {
            IMailChimpManager mailChimpManager = new MailChimp.MailChimpManager(Session["ApiToken"].ToString());

            MailChimp.Templates.TemplateTypes tt = new MailChimp.Templates.TemplateTypes()
            {
                Base = true, Gallery = true, User = true
            };
            MailChimp.Templates.TemplateFilters tf = new MailChimp.Templates.TemplateFilters()
            {
                IncludeDragAndDrop = true
            };

            var list = mailChimpManager.GetTemplates(tt, tf);

            return(Json(new SelectList(list.UserTemplates, "TemplateID", "Name")));
        }
Exemplo n.º 2
0
        public SelectList GetTemplatesFromMailChimp(string ApiToken)
        {
            SelectList result = null;

            if (ApiToken != string.Empty)
            {
                IMailChimpManager mailChimpManager   = new MailChimp.MailChimpManager(ApiToken);
                MailChimp.Templates.TemplateTypes tt = new MailChimp.Templates.TemplateTypes()
                {
                    Base = true, Gallery = true, User = true
                };
                MailChimp.Templates.TemplateFilters tf = new MailChimp.Templates.TemplateFilters()
                {
                    IncludeDragAndDrop = true
                };

                var list = mailChimpManager.GetTemplates(tt, tf);
                result = new SelectList(list.UserTemplates, "TemplateID", "Name");
            }
            return(result);
        }
Exemplo n.º 3
0
        private bool TemplateIsValid(string idCampaign)
        {
            bool   result   = false;
            string apiKey   = string.Empty;
            string template = string.Empty;

            try
            {
                apiKey   = GetSetting("ApiKey", idCampaign);
                template = GetSetting("Template", idCampaign);

                IMailChimpManager mailChimpManager   = new MailChimp.MailChimpManager(apiKey);
                MailChimp.Templates.TemplateTypes tt = new MailChimp.Templates.TemplateTypes()
                {
                    Base = true, Gallery = true, User = true
                };
                MailChimp.Templates.TemplateFilters tf = new MailChimp.Templates.TemplateFilters()
                {
                    IncludeDragAndDrop = true
                };

                var list = mailChimpManager.GetTemplates(tt, tf);
                foreach (var tem in list.UserTemplates)
                {
                    if (tem.TemplateID.ToString() == template)
                    {
                        result = true;
                    }
                }
            }
            catch (Exception e)
            {
                var messageException = telemetria.MakeMessageException(e, System.Reflection.MethodBase.GetCurrentMethod().Name);
                telemetria.Critical(messageException);
            }
            return(result);
        }