当前位置: 首页>>代码示例>>C#>>正文


C# MailChimpManager类代码示例

本文整理汇总了C#中MailChimpManager的典型用法代码示例。如果您正苦于以下问题:C# MailChimpManager类的具体用法?C# MailChimpManager怎么用?C# MailChimpManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MailChimpManager类属于命名空间,在下文中一共展示了MailChimpManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BatchSubscribe_Successful

        public void BatchSubscribe_Successful()
        {
            //  Arrange
            MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
            ListResult lists = mc.GetLists();

            List<BatchEmailParameter> emails = new List<BatchEmailParameter>();

            BatchEmailParameter email1 = new BatchEmailParameter()
            {
                Email = new EmailParameter()
                {
                    Email = "[email protected]"
                }
            };

            BatchEmailParameter email2 = new BatchEmailParameter()
            {
                Email = new EmailParameter()
                {
                    Email = "[email protected]"
                }
            };

            emails.Add(email1);
            emails.Add(email2);

            //  Act
            BatchSubscribeResult results = mc.BatchSubscribe(lists.Data[1].Id, emails);

            //  Assert
            Assert.IsNotNull(results);
            Assert.IsTrue(results.AddCount == 2);
        }
开发者ID:penfold,项目名称:MailChimp.NET,代码行数:34,代码来源:ListTests.cs

示例2: Send

        public void Send(String idUser, String firstName, String email)
        {
            String emailAPI = ConfigurationManager.AppSettings["MailChimpAPI"].ToString();

            MailChimpManager mc = new MailChimpManager(emailAPI);

            ListResult lists = mc.GetLists();

            EmailConfirm emailConfirm = new EmailConfirm();
            //emailConfirm.Groupings = new List<Grouping>();
            //emailConfirm.Groupings.Add(new Grouping());
            //emailConfirm.Groupings[0].Id = 1234; // replace with your grouping id
            //emailConfirm.Groupings[0].GroupNames = new List<string>();
            //emailConfirm.Groupings[0].GroupNames.Add("Your Group Name");
            emailConfirm.FirstName = firstName;
            emailConfirm.IdUser = idUser;

            //  Create the email parameter
            EmailParameter parameters = new EmailParameter()
            {
                Email = email
            };

            //            ListResult lr = mc.GetLists();
            EmailParameter results = mc.Subscribe("d31fd680be", parameters, emailConfirm);
        }
开发者ID:NannyWeb,项目名称:Nanny,代码行数:26,代码来源:EmailHelper.cs

示例3: GetMemberActivity_Successful

        public void GetMemberActivity_Successful()
        {
            //  Arrange
            MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);
            
            ListResult lists = mc.GetLists();
            Assert.IsNotNull(lists.Data);
            Assert.IsTrue(lists.Data.Any());

            MembersResult members = mc.GetAllMembersForList(lists.Data[0].Id);
            Assert.IsNotNull(members.Data);
            Assert.IsTrue(members.Data.Any());

            List<EmailParameter> memberEmails = new List<EmailParameter>();

            foreach (MemberInfo member in members.Data)
            {
                memberEmails.Add(new EmailParameter() { Email = member.Email });
            }

            //  Act
            MemberActivityResult results = mc.GetMemberActivity(lists.Data[0].Id, memberEmails);

            //  Assert
            Assert.IsNotNull(results);
            Assert.IsTrue(results.Data.Any());
        }
开发者ID:CaudronThomas,项目名称:MailChimp.NET,代码行数:27,代码来源:ListTests.cs

示例4: TemplateMethods_Sucessful

        public void TemplateMethods_Sucessful()
        {
            //  Arrange
            MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);

            TemplateAddResult addTemplateResult = null;
            try
            {
                //  Act
                addTemplateResult = mc.AddTemplate("Test Name " + Path.GetRandomFileName(), "Test Html");

                //  Assert
                Assert.IsNotNull(addTemplateResult);

                // Act
                var templateInformation = mc.GetTemplateInformation(addTemplateResult.TemplateId);

                // Assert
                Assert.IsNotNull(templateInformation);

                var templateUpdateValue = new TemplateUpdateValue
                {
                    Html = "Test Html Updated",
                    Name = "Test Name Updated " + Path.GetRandomFileName()
                };

                // Act
                var templateUpdate = mc.UpdateTemplate(addTemplateResult.TemplateId, templateUpdateValue);

                // Assert
                Assert.IsNotNull(templateUpdate);
            }
            finally
            {
                // Cleanup
                if (addTemplateResult != null)
                {
                    // Act
                    var deletedTemplate = mc.DeleteTemplate(addTemplateResult.TemplateId);

                    // Note: this might override a different assert.
                    // Assert
                    Assert.IsNotNull(deletedTemplate);

                    // Act
                    var undeletedTemplate = mc.UndeleteTemplate(addTemplateResult.TemplateId);

                    // Note: this might override a different assert.
                    // Assert
                    Assert.IsNotNull(undeletedTemplate);

                    // Act
                    var deletedTemplate2 = mc.DeleteTemplate(addTemplateResult.TemplateId);

                    // Note: this might override a different assert.
                    // Assert
                    Assert.IsNotNull(deletedTemplate2);
                }
            }
        }
开发者ID:erpframework,项目名称:MailChimp.NET,代码行数:60,代码来源:TemplateTests.cs

示例5: SetDefaultSubscribersList

 private void SetDefaultSubscribersList(string accessToken, string dataCenter)
 {
     var mc = new MailChimpManager(accessToken, dataCenter);
     var lists = mc.GetLists();
     if (lists.Data.Any())
         _settingsManager.SetValue(_subscribersListIdPropertyName, lists.Data[0].Id);
 }
开发者ID:adwardliu,项目名称:vc-community,代码行数:7,代码来源:MCAuthorizationController.cs

示例6: Update

        public ActionResult Update(string id)
        {
            var defaultEvent = service.GetDefaultEvent();
            int eventid = defaultEvent.ID;
            MailChimpManager mc = new MailChimpManager(_mailchimpKey);
            ListInfo mailingList = mc.GetLists().Data.Where(l=>l.Id==id).SingleOrDefault();
            List<BatchEmailParameter> batchList = new List<BatchEmailParameter>();
            if (mailingList.Name.Contains("Speakers"))
            {
                foreach (var speaker in service.GetSpeakers(eventid))
                {
                    MyMergeVar myMergeVars = new MyMergeVar();
                    myMergeVars.FirstName = speaker.FirstName;
                    myMergeVars.LastName = speaker.LastName;           //  Create the email parameter
                    BatchEmailParameter batchEmail = new BatchEmailParameter();
                    EmailParameter email = new EmailParameter()
                    {
                        Email = speaker.Email

                    };
                    batchEmail.Email = email;
                    batchEmail.MergeVars = myMergeVars;

                    batchList.Add(batchEmail);
                }
            }
            if (mailingList.Name.Contains("Attendees"))
            {
                foreach (var attendee in service.GetAllAttendees(eventid))
                {
                    MyMergeVar myMergeVars = new MyMergeVar();
                    myMergeVars.FirstName = attendee.FirstName;
                    myMergeVars.LastName = attendee.LastName;           //  Create the email parameter
                    EmailParameter email = new EmailParameter()
                    {
                        Email = attendee.Email
                    };
                    BatchEmailParameter batchEmail = new BatchEmailParameter();
                    batchEmail.Email = email;
                    batchEmail.MergeVars = myMergeVars;

                    batchList.Add(batchEmail);

                }

            }
            BatchSubscribeResult bResult = mc.BatchSubscribe(id, batchList, false, true, true);
            //MyMergeVar myMergeVars = new MyMergeVar();
            //myMergeVars.FirstName = subscriber.FirstName;
            //myMergeVars.LastName = subscriber.LastName;           //  Create the email parameter
            //EmailParameter email = new EmailParameter()
            //{
            //    Email = subscriber.EmailAddress
            //};

            //EmailParameter results = mc.Subscribe(_mailchimpGroupId, email, myMergeVars);

            return RedirectToAction("Index");
        }
开发者ID:cfranciscodev,项目名称:WebSite,代码行数:59,代码来源:MailingListController.cs

示例7: CreateListAddMemberCustomMergefields

        static void CreateListAddMemberCustomMergefields(MailChimpManager mailChimp)
        {
            var list = mailChimp.AddList(new ListsInstance()
            {
                Name = "Test list (custom merge fields) " + DateTime.Now,
                Contact = new Contact()
                {
                    Company = "Test company",
                    Address1 = "675 Ponce de Leon Ave NE",
                    City = "Atlanta",
                    Country = "US",
                    State = "Georgia",
                    Zip = "GA 30308"
                },
                PermissionReminder = "You subscribed to our newsletter.",
                CampaignDefaults = new CampaignDefaults()
                {
                    FromEmail = "[email protected]",
                    FromName = "Freddie",
                    Subject = "Test subject",
                    Language = "en"
                },
                EmailTypeOption = false
            });
            Console.WriteLine("Created list \"{0}\", id {1}", list.Name, list.Id);

            var mergeFieldSalutation = mailChimp.AddMergeField(list.Id, new MergeFieldsInstance()
            {
                Name = "Salutation",
                Tag = "SALUTATION",
                Type = "text"
            });
            Console.WriteLine("Added merge field for salutation, id {0}", mergeFieldSalutation.MergeId);

            var mergeFieldAddress = mailChimp.AddMergeField(list.Id, new MergeFieldsInstance()
            {
                Name = "Address",
                Tag = "ADDRESS",
                Type = "address"
            });
            Console.WriteLine("Added merge field for address, id {0}", mergeFieldAddress.MergeId);

            var subscriber = new MembersInstance(string.Format("testaddress+{0}@yourdomain.com", "test"), MembersInstance.StatusEnum.Subscribed, "John", "Doe");
            subscriber.MergeFields.AddOrUpdateVar(mergeFieldSalutation.Tag, "Mr.");
            subscriber.MergeFields.AddOrUpdateVar(mergeFieldAddress.Tag, new MergeFieldsInstance.Address()
            {
                Address1 = "675 Ponce de Leon Ave NE",
                City = "Atlanta",
                Country = "US",
                State = "Georgia",
                Zip = "GA 30308"
            });
            
            // Add a customer to list
            subscriber = mailChimp.AddMember(list.Id, subscriber);

            Console.WriteLine("Member {0} added to list, id {1}", subscriber.EmailAddress, subscriber.Id);
        }
开发者ID:ebol2000,项目名称:MailChimp.NET,代码行数:58,代码来源:Program.cs

示例8: GetFolders_Successful

        public void GetFolders_Successful()
        {
            //  Arrange
            MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);

            //  Act
            List<FolderListResult> details = mc.GetFolders("campaign");

            //  Assert
            Assert.IsNotNull(details);
        }
开发者ID:erpframework,项目名称:MailChimp.NET,代码行数:11,代码来源:FolderTests.cs

示例9: GetChimpChatter_Successful

        public void GetChimpChatter_Successful()
        {
            //  Arrange
            MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);

            //  Act
            List<ChimpChatterMessage> details = mc.GetChimpChatter();

            //  Assert
            Debug.WriteLine(details.Count);
        }
开发者ID:RomeoQNgo,项目名称:MailChimp.NET,代码行数:11,代码来源:HelperTests.cs

示例10: GetProfile_Successful

        public void GetProfile_Successful()
        {
            //  Arrange
            MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);

            //  Act
            UserProfile details = mc.GetUserProfile();

            //  Assert
            Assert.IsFalse(string.IsNullOrEmpty(details.AccountName));
        }
开发者ID:erpframework,项目名称:MailChimp.NET,代码行数:11,代码来源:UserTests.cs

示例11: GetLogins_Successful

        public void GetLogins_Successful()
        {
            //  Arrange
            MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);

            //  Act
            List<UserLoginsResult> details = mc.GetLogins();

            //  Assert
            Assert.IsTrue(details.Any());
        }
开发者ID:erpframework,项目名称:MailChimp.NET,代码行数:11,代码来源:UserTests.cs

示例12: GetOrders_Successful

        public void GetOrders_Successful()
        {
            //  Arrange
            MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);

            //  Act
            OrderListResult result = mc.GetOrders();

            //  Assert
            Assert.IsNotNull(result);
        }
开发者ID:erpframework,项目名称:MailChimp.NET,代码行数:11,代码来源:EcommTests.cs

示例13: Index

        //
        // GET: /MailingList/
        public ActionResult Index()
        {
            var defaultEvent = service.GetDefaultEvent();
            int eventid = defaultEvent.ID;
            ViewBag.Event = service.GetEvent(eventid);
            int eventYear = ViewBag.Event.StartTime.Year;

            MailChimpManager mc = new MailChimpManager(_mailchimpKey);
            List<ListInfo> mailingLists = mc.GetLists().Data.Where(l=>l.Name.Contains(eventYear.ToString())).ToList();
            return View(mailingLists);
        }
开发者ID:cfranciscodev,项目名称:WebSite,代码行数:13,代码来源:MailingListController.cs

示例14: GetCampaigns_Successful

        public void GetCampaigns_Successful()
        {
            //  Arrange
            MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);

            //  Act
            CampaignListResult details = mc.GetCampaigns();

            //  Assert
            Assert.IsNotNull(details.Data);
        }
开发者ID:penfold,项目名称:MailChimp.NET,代码行数:11,代码来源:CampaignTests.cs

示例15: GetTemplates_Successful

        public void GetTemplates_Successful()
        {
            //  Arrange
            MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);

            //  Act
            TemplateListResult details = mc.GetTemplates();

            //  Assert
            Assert.IsNotNull(details);
        }
开发者ID:ultrakapy,项目名称:MailChimp.NET,代码行数:11,代码来源:TemplateTests.cs


注:本文中的MailChimpManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。