privatebool CreateStaticIssue() { // Get the newsletter Newsletter newsletter = NewsletterProvider.GetNewsletter("MyNewStaticNewsletter", CMSContext.CurrentSiteID);
if (newsletter != null) { // Create new static issue object Issue newIssue = newIssue();
// Set the properties newIssue.IssueSubject = "My new static issue"; newIssue.IssueNewsletterID = newsletter.NewsletterID; newIssue.IssueSiteID = CMSContext.CurrentSiteID; newIssue.IssueText = "<?xml version=\"1.0\" encoding=\"utf-16\"?><content><region id=\"content\">Issue text</region></content>"; newIssue.IssueUnsubscribed = 0; newIssue.IssueSentEmails = 0; newIssue.IssueTemplateID = newsletter.NewsletterTemplateID; newIssue.IssueShowInNewsletterArchive = false;
// Save the static issue IssueProvider.SetIssue(newIssue);
returntrue; }
returnfalse; }
The following example gets and updates a static issue.
privatebool GetAndUpdateStaticIssue() { // Get the newsletter Newsletter newsletter = NewsletterProvider.GetNewsletter("MyNewStaticNewsletter", CMSContext.CurrentSiteID);
if (newsletter != null) { // Prepare the parameters string where = "IssueNewsletterID = " + newsletter.NewsletterID;
// Get the data DataSet issues = IssueProvider.GetIssues(where, null);
if (!DataHelper.DataSourceIsEmpty(issues)) { // Create object from DataRow Issue updateIssue = newIssue(issues.Tables[0].Rows[0]);
if (updateIssue != null) { // Update the properties updateIssue.IssueSubject = updateIssue.IssueSubject.ToLower();
// Save the changes IssueProvider.SetIssue(updateIssue);
returntrue; } } } returnfalse; }
The following example gets and bulk updates static issues.
privatebool GetAndBulkUpdateStaticIssues()
{ // Get the newsletter Newsletter newsletter = NewsletterProvider.GetNewsletter("MyNewStaticNewsletter", CMSContext.CurrentSiteID);
if (newsletter != null) { // Prepare the parameters string where = "IssueNewsletterID = " + newsletter.NewsletterID;
// Get the data DataSet issues = IssueProvider.GetIssues(where, null); if (!DataHelper.DataSourceIsEmpty(issues)) { // Loop through the individual items foreach (DataRow issueDr in issues.Tables[0].Rows) { // Create object from DataRow Issue modifyIssue = newIssue(issueDr);
// Update the properties modifyIssue.IssueSubject = modifyIssue.IssueSubject.ToUpper();
// Save the changes IssueProvider.SetIssue(modifyIssue); }
returntrue; } }
returnfalse; }
The following example creates a dynamic issue.
privatebool CreateDynamicIssue() { // Get the newsletter Newsletter newsletter = NewsletterProvider.GetNewsletter("MyNewDynamicNewsletter", CMSContext.CurrentSiteID);
if (newsletter != null) { // Generate dynamic issue EmailQueueManager.GenerateDynamicIssue(newsletter.NewsletterID);
returntrue; }
returnfalse; }
The following example gets and updates a dynamic issue.
privatebool GetAndUpdateDynamicIssue() { // Get the newsletter Newsletter newsletter = NewsletterProvider.GetNewsletter("MyNewDynamicNewsletter", CMSContext.CurrentSiteID);
if (newsletter != null) { // Prepare the parameters string where = "IssueNewsletterID = " + newsletter.NewsletterID;
// Get the data DataSet issues = IssueProvider.GetIssues(where, null);
if (!DataHelper.DataSourceIsEmpty(issues)) { // Create object from DataRow Issue updateIssue = newIssue(issues.Tables[0].Rows[0]);
if (updateIssue != null) { // Update the properties updateIssue.IssueSubject = updateIssue.IssueSubject.ToLower();
// Save the changes IssueProvider.SetIssue(updateIssue);
returntrue; } } } returnfalse; }
The following example gets and bulk updates dynamic issues.
privatebool GetAndBulkUpdateDynamicIssues() { // Get the newsletter Newsletter newsletter = NewsletterProvider.GetNewsletter("MyNewDynamicNewsletter", CMSContext.CurrentSiteID);
if (newsletter != null) { // Prepare the parameters string where = "IssueNewsletterID = " + newsletter.NewsletterID;
// Get the data DataSet issues = IssueProvider.GetIssues(where, null); if (!DataHelper.DataSourceIsEmpty(issues)) { // Loop through the individual items foreach (DataRow issueDr in issues.Tables[0].Rows) { // Create object from DataRow Issue modifyIssue = newIssue(issueDr);
// Update the properties modifyIssue.IssueSubject = modifyIssue.IssueSubject.ToUpper();
// Save the changes IssueProvider.SetIssue(modifyIssue); }
returntrue; } } returnfalse; }
The following example deletes a dynamic issue.
privatebool DeleteDynamicIssue() { // Get the newsletter Newsletter newsletter = NewsletterProvider.GetNewsletter("MyNewDynamicNewsletter", CMSContext.CurrentSiteID);
if (newsletter != null) { // Prepare the parameters string where = "IssueNewsletterID = " + newsletter.NewsletterID;
// Get the data DataSet issues = IssueProvider.GetIssues(where, null);
if (!DataHelper.DataSourceIsEmpty(issues)) { // Create object from DataRow Issue deleteIssue = newIssue(issues.Tables[0].Rows[0]);
// Delete the dynamic issue IssueProvider.DeleteIssue(deleteIssue);
return (deleteIssue != null); } } returnfalse; }
The following example deletes a static issue.
privatebool DeleteStaticIssue() { // Get the newsletter Newsletter newsletter = NewsletterProvider.GetNewsletter("MyNewStaticNewsletter", CMSContext.CurrentSiteID);
if (newsletter != null) { // Prepare the parameters string where = "IssueNewsletterID = " + newsletter.NewsletterID;
// Get the data DataSet issues = IssueProvider.GetIssues(where, null);
if (!DataHelper.DataSourceIsEmpty(issues)) { // Create object from DataRow Issue deleteIssue = newIssue(issues.Tables[0].Rows[0]);
// Delete the static issue IssueProvider.DeleteIssue(deleteIssue);