if (newsletter != null) { // Prepares the parameters string where = "IssueNewsletterID = " + newsletter.NewsletterID;
// Gets the data DataSet issues = IssueInfoProvider.GetIssues(where, null);
if (!DataHelper.DataSourceIsEmpty(issues)) { // Creates an object from the DataRow IssueInfo updateIssue = newIssueInfo(issues.Tables[0].Rows[0]);
if (updateIssue != null) { // Updates the properties updateIssue.IssueSubject = updateIssue.IssueSubject.ToLower();
// Saves the changes IssueInfoProvider.SetIssueInfo(updateIssue);
returntrue; } } } returnfalse; }
The following example gets and bulk updates static issues.
privatebool GetAndBulkUpdateStaticIssues()
{ // Gets the newsletter NewsletterInfo newsletter = NewsletterInfoProvider.GetNewsletterInfo("MyNewStaticNewsletter", CMSContext.CurrentSiteID);
if (newsletter != null) { // Prepares the parameters string where = "IssueNewsletterID = " + newsletter.NewsletterID;
// Gets the data DataSet issues = IssueInfoProvider.GetIssues(where, null); if (!DataHelper.DataSourceIsEmpty(issues)) { // Loops through the items foreach (DataRow issueDr in issues.Tables[0].Rows) { // Creates object from the DataRow IssueInfo modifyIssue = newIssueInfo(issueDr);
// Updates the properties modifyIssue.IssueSubject = modifyIssue.IssueSubject.ToUpper();
// Saves the changes IssueInfoProvider.SetIssueInfo(modifyIssue); }
if (newsletter != null) { // Prepares the parameters string where = "IssueNewsletterID = " + newsletter.NewsletterID;
// Gets the data DataSet issues = IssueInfoProvider.GetIssues(where, null); if (!DataHelper.DataSourceIsEmpty(issues)) { // Loops through the individual items foreach (DataRow issueDr in issues.Tables[0].Rows) { // Creates an object from the DataRow IssueInfo modifyIssue = newIssueInfo(issueDr);
// Updates the properties modifyIssue.IssueSubject = modifyIssue.IssueSubject.ToUpper();
// Saves the changes IssueInfoProvider.SetIssueInfo(modifyIssue); }