コード例 #1
0
        public void GetTemplates_Successful()
        {
            //  Arrange
            MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
            var types = new TemplateTypes()
            {
                User = true
            };
            var filters = new TemplateFilters()
            {
                IncludeInactive = false
            };
            //  Act
            TemplateListResult details = mc.GetTemplates(types, filters);

            //  Assert
            Assert.IsNotNull(details);
        }
コード例 #2
0
        public void MailChimpLoad()
        {
            // CampaignListResult details = mc.GetCampaigns();
            //CampaignFilter options = new CampaignFilter();
            //options.CampaignId = "a5a9439561";
            //CampaignListResult ss = mc.GetCampaigns(options);


            //-- Template
            List<MailChimpList> mailChimpTemplate = new List<MailChimpList>();
            mailChimpTemplate.Add(new MailChimpList("0", "Select Template"));
            var types = new TemplateTypes()
            {
                User = true,

            };
            var filters = new TemplateFilters()
            {
                IncludeInactive = false,
                IncludeDragAndDrop = true
            };

            TemplateListResult details = mc.GetTemplates(types, filters);
            foreach (var list in details.UserTemplates)
            {
                mailChimpTemplate.Add(new MailChimpList(list.TemplateID.ToString(), list.Name));
            }
            if (mailChimpTemplate != null && mailChimpTemplate.Count > 0)
            {
                cmbTemplate.DisplayMember = "Name";
                cmbTemplate.ValueMember = "Id";
                cmbTemplate.DataSource = mailChimpTemplate;
            }


            // --- List---
            List<MailChimpList> mailChimpList = new List<MailChimpList>();
            ListResult lists = mc.GetLists();
            mailChimpList.Clear();
            mailChimpList.Add(new MailChimpList("0", "Select List"));
            foreach (var list in lists.Data)
            {
                mailChimpList.Add(new MailChimpList(list.Id.ToString(), list.Name));
            }
            if (mailChimpList != null && mailChimpList.Count > 0)
            {
                cmbList.DisplayMember = "Name";
                cmbList.ValueMember = "Id";
                cmbList.DataSource = mailChimpList;
            }
        }