// Saves the static newsletter NewsletterInfoProvider.SetNewsletterInfo(newNewsletter);
returntrue; }
returnfalse; }
The following example gets and updates a static newsletter.
privatebool GetAndUpdateStaticNewsletter() { // Gets the static newsletter NewsletterInfo updateNewsletter = NewsletterInfoProvider.GetNewsletterInfo("MyNewStaticNewsletter", CMSContext.CurrentSiteID); if (updateNewsletter != null) { // Updates the properties updateNewsletter.NewsletterDisplayName = updateNewsletter.NewsletterDisplayName.ToLower();
// Saves the changes NewsletterInfoProvider.SetNewsletterInfo(updateNewsletter);
returntrue; }
returnfalse; }
The following example gets and bulk updates static newsletters.
privatebool GetAndBulkUpdateStaticNewsletters() { // Prepares the parameters string where = "NewsletterName LIKE N'MyNewStaticNewsletter%'";
// Gets the data DataSet newsletters = NewsletterInfoProvider.GetNewsletters(where, null, 0, null); if (!DataHelper.DataSourceIsEmpty(newsletters)) { // Loops through the items foreach (DataRow newsletterDr in newsletters.Tables[0].Rows) { // Creates an object from the DataRow NewsletterInfo modifyNewsletter = newNewsletterInfo(newsletterDr);
// Updates the properties modifyNewsletter.NewsletterDisplayName = modifyNewsletter.NewsletterDisplayName.ToUpper();
// Saves the changes NewsletterInfoProvider.SetNewsletterInfo(modifyNewsletter); }
returntrue; }
returnfalse; }
The following example creates a dynamic newsletter.
// Sets the properties newNewsletter.NewsletterDisplayName = "My new dynamic newsletter"; newNewsletter.NewsletterName = "MyNewDynamicNewsletter"; newNewsletter.NewsletterType = NewsletterType.Dynamic; newNewsletter.NewsletterSubscriptionTemplateID = subscriptionTemplate.TemplateID; newNewsletter.NewsletterUnsubscriptionTemplateID = unsubscriptionTemplate.TemplateID; newNewsletter.NewsletterSenderName = "Sender name"; newNewsletter.NewsletterSenderEmail = "sender@localhost.local"; newNewsletter.NewsletterDynamicURL = "http://www.google.com"; newNewsletter.NewsletterDynamicSubject = "My new dynamic issue"; newNewsletter.NewsletterSiteID = CMSContext.CurrentSiteID;
// Saves the dynamic newsletter NewsletterInfoProvider.SetNewsletterInfo(newNewsletter);
returntrue; }
returnfalse; }
The following example gets and updates a dynamic newsletter.
privatebool GetAndUpdateDynamicNewsletter() { // Gets the dynamic newsletter NewsletterInfo updateNewsletter = NewsletterInfoProvider.GetNewsletterInfo("MyNewDynamicNewsletter", CMSContext.CurrentSiteID); if (updateNewsletter != null) { // Updates the properties updateNewsletter.NewsletterDisplayName = updateNewsletter.NewsletterDisplayName.ToLower();
// Saves the changes NewsletterInfoProvider.SetNewsletterInfo(updateNewsletter);
returntrue; }
returnfalse; }
The following example gets and bulk updates dynamic newsletters.
privatebool GetAndBulkUpdateDynamicNewsletters() { // Prepares the parameters string where = "NewsletterName LIKE N'MyNewDynamicNewsletter%'";
// Gets the data DataSet newsletters = NewsletterInfoProvider.GetNewsletters(where, null, 0, null); if (!DataHelper.DataSourceIsEmpty(newsletters)) { // Loops through the items foreach (DataRow newsletterDr in newsletters.Tables[0].Rows) { // Creates an object from the DataRow NewsletterInfo modifyNewsletter = newNewsletterInfo(newsletterDr);
// Updates the properties modifyNewsletter.NewsletterDisplayName = modifyNewsletter.NewsletterDisplayName.ToUpper();
// Saves the changes NewsletterInfoProvider.SetNewsletterInfo(modifyNewsletter); }
returntrue; }
returnfalse; }
The following example deletes a dynamic newsletter.