本文整理汇总了C#中Parser.SetTemplate方法的典型用法代码示例。如果您正苦于以下问题:C# Parser.SetTemplate方法的具体用法?C# Parser.SetTemplate怎么用?C# Parser.SetTemplate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parser
的用法示例。
在下文中一共展示了Parser.SetTemplate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendConfirmationEmail
private Boolean SendConfirmationEmail()
{
bool blnEmailSent = false;
try
{
//get managers info
List<ManagerItem> staffMembers = null;
if (clubItem.InnerItem.Axes.SelectItems(String.Format("descendant-or-self::*[@@tid = '{0}']", ManagerItem.TemplateId)) != null)
{
staffMembers = clubItem.InnerItem.Axes.SelectItems(String.Format("descendant-or-self::*[@@tid = '{0}']", ManagerItem.TemplateId)).ToList().ConvertAll(x => new ManagerItem(x));
manager = staffMembers.First();
}
if (currentLanding != null && currentLanding.LandingBase.EmailTemplate.Item != null)
{
//Get Campaign Email object
EmailBaseItem emailItem = currentLanding.LandingBase.EmailTemplate.Item;
Sitecore.Links.UrlOptions urlOptions = new Sitecore.Links.UrlOptions();
urlOptions.AlwaysIncludeServerUrl = true;
urlOptions.AddAspxExtension = true;
//string strEmailSubject = campaign.CampaignBase.Emailsubject.Rendered;
string strEmailSubject = emailItem.Subject.Raw;
//string strEmailFromAddress = Settings.WebsiteMailFromText;
string strEmailFromAddress = emailItem.Fromaddress.Raw;
string strEmailToAddress = txtEmail.Value.Trim();
//Populate email text variables
Hashtable objTemplateVariables = new Hashtable();
objTemplateVariables.Add("HomePageUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.HomePage));
objTemplateVariables.Add("FacilitiesAndClassesLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.FacilitiesAndClasses));
objTemplateVariables.Add("YourHealthLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.YourHealth));
objTemplateVariables.Add("MembershipsLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.Memberships));
objTemplateVariables.Add("PrivacyPolicyLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.PrivacyPolicy));
objTemplateVariables.Add("TermsAndConditionsLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.TermsAndConditions));
objTemplateVariables.Add("Copyright", Translate.Text("© Copyright ##Year## Virgin Active. All rights reserved."));
//objTemplateVariables.Add("CampaignTermsAndConditionsLinkUrl", new PageSummaryItem(currentCampaign.CampaignBase.Termsandconditionslink.Item).QualifiedUrl);
objTemplateVariables.Add("CustomerName", txtName.Value.Trim());
if (manager != null)
{
objTemplateVariables.Add("ClubManagerName", manager.Person.Firstname.Rendered + " " + manager.Person.Lastname.Rendered);
}
else
{
objTemplateVariables.Add("ClubManagerName", "");
}
objTemplateVariables.Add("ClubName", clubItem.Clubname.Rendered);
objTemplateVariables.Add("EmailSubject", strEmailSubject);
objTemplateVariables.Add("EmailFromAddress", strEmailFromAddress);
objTemplateVariables.Add("EmailToAddress", strEmailToAddress);
objTemplateVariables.Add("YouTubeLinkUrl", Settings.YouTubeLinkUrl);
objTemplateVariables.Add("TwitterLinkUrl", Settings.TwitterLinkUrl);
objTemplateVariables.Add("FacebookLinkUrl", Settings.FacebookLinkUrl);
objTemplateVariables.Add("McCormackMorrisonLinkUrl", Settings.McCormackMorrisonUrl);
objTemplateVariables.Add("ImageRootUrl", Sitecore.Web.WebUtil.GetServerUrl());
objTemplateVariables.Add("ClubPhoneNumber", clubItem.Salestelephonenumber.Rendered);
objTemplateVariables.Add("ClubHomePageUrl", Sitecore.Links.LinkManager.GetItemUrl(clubItem, urlOptions));
System.Text.StringBuilder markupBuilder;
markupBuilder = new System.Text.StringBuilder();
markupBuilder.Append(clubItem.Addressline1.Rendered);
markupBuilder.Append(!String.IsNullOrEmpty(clubItem.Addressline2.Rendered) ? "<br />" + clubItem.Addressline2.Rendered : "");
markupBuilder.Append(!String.IsNullOrEmpty(clubItem.Addressline3.Rendered) ? "<br />" + clubItem.Addressline3.Rendered : "");
markupBuilder.Append(!String.IsNullOrEmpty(clubItem.Addressline4.Rendered) ? "<br />" + clubItem.Addressline4.Rendered : "");
markupBuilder.Append("<br />" + clubItem.Postcode.Rendered);
objTemplateVariables.Add("ClubAddress", markupBuilder.ToString());
//Parser objParser = new Parser(campaign.CampaignBase.GetTemplateHtml(), objTemplateVariables);
Parser objParser = new Parser(objTemplateVariables);
if (emailItem.InnerItem.TemplateName == Templates.CampaignEmail)
{
CampaignEmailItem campaignEmail = (CampaignEmailItem)emailItem.InnerItem;
//First parse the Email Body text
objParser.SetTemplate(campaignEmail.Emailbody.Raw);
string strEmailBody = objParser.Parse();
objTemplateVariables.Add("EmailBody", strEmailBody);
//Second parse the full html -substituting in title and preheader
objTemplateVariables.Add("EmailTitle", campaignEmail.Emailtitle.Raw);
objTemplateVariables.Add("EmailPreheader", campaignEmail.Emailpreheader.Raw);
objParser = new Parser(objTemplateVariables);
if (clubItem.InnerItem.TemplateName == Templates.ClassicClub)
{
objParser.SetTemplate(campaignEmail.Classichtml.Raw);
}
else
{
objParser.SetTemplate(campaignEmail.Standardhtml.Raw);
}
}
//.........这里部分代码省略.........
示例2: SendConfirmationEmail
private Boolean SendConfirmationEmail()
{
bool blnEmailSent = false;
try
{
string strEmailSubject = EmailSubjects.EnquiryConfirmation;
string strEmailFromAddress = Settings.WebsiteMailFromText;
string strEmailToAddress = txtEmail.Value.Trim();
Sitecore.Links.UrlOptions urlOptions = new Sitecore.Links.UrlOptions();
urlOptions.AlwaysIncludeServerUrl = true;
urlOptions.AddAspxExtension = true;
urlOptions.LanguageEmbedding = LanguageEmbedding.Never;
//Populate email text variables
Hashtable objTemplateVariables = new Hashtable();
objTemplateVariables.Add("HomePageUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.HomePage));
objTemplateVariables.Add("FacilitiesAndClassesLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.FacilitiesLanding));
objTemplateVariables.Add("YourHealthLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.YourHealthArticles));
objTemplateVariables.Add("MembershipsLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.MembershipOptions));
objTemplateVariables.Add("PrivacyPolicyLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.PrivacyPolicy));
objTemplateVariables.Add("TermsAndConditionsLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.TermsAndConditions));
objTemplateVariables.Add("Copyright", Translate.Text("© Copyright ##Year## Virgin Active. All rights reserved."));
objTemplateVariables.Add("CustomerName", txtName.Value.Trim());
if (manager != null)
{
objTemplateVariables.Add("ClubManagerName", manager.Person.Firstname.Rendered + " " + manager.Person.Lastname.Rendered);
}
else
{
objTemplateVariables.Add("ClubManagerName", "");
}
objTemplateVariables.Add("ClubName", currentClub.Clubname.Rendered);
objTemplateVariables.Add("ClubHomePageUrl", Sitecore.Links.LinkManager.GetItemUrl(currentClub, urlOptions));
objTemplateVariables.Add("EmailSubject", strEmailSubject);
objTemplateVariables.Add("EmailFromAddress", strEmailFromAddress);
objTemplateVariables.Add("EmailToAddress", strEmailToAddress);
objTemplateVariables.Add("YouTubeLinkUrl", Settings.YouTubeLinkUrl);
objTemplateVariables.Add("TwitterLinkUrl", Settings.TwitterLinkUrl);
objTemplateVariables.Add("FacebookLinkUrl", Settings.FacebookLinkUrl);
objTemplateVariables.Add("McCormackMorrisonLinkUrl", Settings.McCormackMorrisonUrl);
objTemplateVariables.Add("ImageRootUrl", WebUtil.GetServerUrl());
objTemplateVariables.Add("ClubPhoneNumber", currentClub.Salestelephonenumber.Rendered);
System.Text.StringBuilder markupBuilder;
markupBuilder = new System.Text.StringBuilder();
markupBuilder.Append(currentClub.Addressline1.Rendered);
markupBuilder.Append(!String.IsNullOrEmpty(currentClub.Addressline2.Rendered) ? "<br />" + currentClub.Addressline2.Rendered : "");
markupBuilder.Append(!String.IsNullOrEmpty(currentClub.Addressline3.Rendered) ? "<br />" + currentClub.Addressline3.Rendered : "");
markupBuilder.Append(!String.IsNullOrEmpty(currentClub.Addressline4.Rendered) ? "<br />" + currentClub.Addressline4.Rendered : "");
markupBuilder.Append("<br />" + currentClub.Postcode.Rendered);
objTemplateVariables.Add("ClubAddress", markupBuilder.ToString());
//Parser objParser = new Parser(Server.MapPath(EmailTemplates.EnquiryConfirmation), objTemplateVariables);
Parser objParser = new Parser(objTemplateVariables);
objParser.SetTemplate(((EmailItem)Sitecore.Context.Database.GetItem(EmailPaths.EnquiryConfirmation)).Emailhtml.Text);
string strMessageBody = objParser.Parse();
mm.sharedtools.EmailMessagingService.SendResult objSendResult = new mm.sharedtools.EmailMessagingService.SendResult();
mm.sharedtools.EmailMessagingService.Messaging objMessaging = new mm.sharedtools.EmailMessagingService.Messaging();
string strAttachments = "";
//now call messaging service
objSendResult = objMessaging.SendMailSecure(strEmailFromAddress, strEmailToAddress, "", Settings.BccEmailAddress, strEmailSubject, true, strMessageBody, strAttachments);
if (objSendResult.Success == true)
{
blnEmailSent = true;
}
}
catch (Exception ex)
{
Log.Error(String.Format("Error sending confirmation email {1}: {0}", ex.Message, currentClub.Clubname.Raw), this);
mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
}
return blnEmailSent;
}
示例3: SendAdminEmail
private Boolean SendAdminEmail()
{
bool blnEmailSent = false;
try
{
string strEmailSubject = EmailSubjects.KidsClubFeedbackFormAdmin;
string strEmailFromAddress = Settings.WebsiteMailFromText;
string strEmailToAddress = "";
if (Sitecore.Configuration.Settings.GetSetting("SystemEmails").ToLower() == "false")
{
//Use test
strEmailToAddress = Settings.McCormackMorrisonTestEmailAddress;
}
else
{
if (currentClub.Kidsfeedbackemail.Rendered.Trim() != "")
{
strEmailToAddress = currentClub.Kidsfeedbackemail.Rendered.Trim();
}
else if (currentClub.Salesemail.Rendered.Trim() != "")
{
strEmailToAddress = currentClub.Salesemail.Rendered.Trim();
}
else
{
strEmailToAddress = Settings.DefaultFormToEmailAddress;
//TODO: Send warning alert.
Log.Error(String.Format("Could not find sales email address for club {0}", currentClub.Clubname.Raw), this);
}
}
//Populate email text variables
Hashtable objTemplateVariables = new Hashtable();
objTemplateVariables.Add("CustomerName", txtName.Value.Trim());
objTemplateVariables.Add("CustomerEmail", txtEmail.Value.Trim());
objTemplateVariables.Add("MembershipNo", txtMembership.Value.Trim());
objTemplateVariables.Add("Telephone", txtPhone.Value.Trim());
objTemplateVariables.Add("QueryType", drpQueryTypeList.SelectedValue.ToString() != Translate.Text("Select") ? drpQueryTypeList.SelectedValue.ToString() : "");
objTemplateVariables.Add("Comments", txtComments.Value.Trim());
objTemplateVariables.Add("ClubName", currentClub.Clubname.Rendered);
objTemplateVariables.Add("EmailSubject", strEmailSubject);
objTemplateVariables.Add("EmailFromAddress", strEmailFromAddress);
objTemplateVariables.Add("EmailToAddress", strEmailToAddress);
//Parser objParser = new Parser(Server.MapPath(EmailTemplates.KidsClubFeedbackFormAdmin), objTemplateVariables);
Parser objParser = new Parser(objTemplateVariables);
objParser.SetTemplate(((EmailItem)Sitecore.Context.Database.GetItem(EmailPaths.KidsClubFeedbackFormAdmin)).Emailhtml.Text);
string strMessageBody = objParser.Parse();
mm.sharedtools.EmailMessagingService.SendResult objSendResult = new mm.sharedtools.EmailMessagingService.SendResult();
mm.sharedtools.EmailMessagingService.Messaging objMessaging = new mm.sharedtools.EmailMessagingService.Messaging();
string strAttachments = "";
//now call messaging service
objSendResult = objMessaging.SendMailSecure(strEmailFromAddress, strEmailToAddress, "", Settings.BccEmailAddress, strEmailSubject, true, strMessageBody, strAttachments);
if (currentClub.ClubId.Rendered == "")
{
Log.Error(String.Format("No Club ID exists for club: {0}", currentClub.Clubname.Raw), this);
}
if (objSendResult.Success == true)
{
blnEmailSent = true;
}
}
catch (Exception ex)
{
Log.Error(String.Format("Error sending kids club feedback data email {1}: {0}", ex.Message, currentClub.Clubname.Raw), this);
mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
}
return blnEmailSent;
}
示例4: SendAdminEmail
private Boolean SendAdminEmail()
{
bool blnEmailSent = false;
try
{
string strEmailSubject = EmailSubjects.FeedbackCampaignFormAdmin;
string strEmailFromAddress = Settings.WebsiteMailFromText;
string strEmailToAddress = "";
string strEmailBccAddress = "";
if (Sitecore.Configuration.Settings.GetSetting("SystemEmails").ToLower() == "false")
{
strEmailToAddress = Settings.McCormackMorrisonTestEmailAddress;
}
else
{
//form sent to webleads -send confirmation to admin team
strEmailToAddress = Settings.FeedbackCampaignEmailToListShort;
}
//Populate email text variables
Hashtable objTemplateVariables = new Hashtable();
objTemplateVariables.Add("CustomerName", txtName.Value);
objTemplateVariables.Add("CustomerEmail", txtEmail.Value);
objTemplateVariables.Add("HomeClubID", clubItem.ClubId.Rendered);
objTemplateVariables.Add("ClubName", clubItem.Clubname.Rendered);
objTemplateVariables.Add("Telephone", txtPhone.Value);
objTemplateVariables.Add("Comments", "N/A");
objTemplateVariables.Add("HowDidCustomerFindUs", "N/A"); //drpHowDidYouFindUs.SelectedValue.ToString() != "" && drpHowDidYouFindUs.SelectedValue.ToString() != Translate.Text("Select") ? drpHowDidYouFindUs.SelectedValue.ToString() : "");
objTemplateVariables.Add("SubscribeToNewsletter", chkSubscribe.Checked ? "Yes" : "No");
objTemplateVariables.Add("PublishDetails", "N/A");
objTemplateVariables.Add("FeedbackSubject", currentLanding.LandingBase.LandingId.Rendered); //currentCampaign.CampaignBase.Campaigntype.Raw);
objTemplateVariables.Add("FeedbackSubjectDetail", currentLanding.DisplayName); //currentCampaign.CampaignBase.Campaignname.Rendered);
objTemplateVariables.Add("SubmissionDate", DateTime.Now.ToShortDateString());
objTemplateVariables.Add("ImageSubmitted", "N/A");
objTemplateVariables.Add("EnquiryType", "General");
objTemplateVariables.Add("EmailSubject", strEmailSubject);
objTemplateVariables.Add("EmailFromAddress", strEmailFromAddress);
objTemplateVariables.Add("EmailToAddress", strEmailToAddress);
//Parser objParser = new Parser(Server.MapPath(EmailTemplates.FeedbackCampaignFormAdmin), objTemplateVariables);
Parser objParser = new Parser(objTemplateVariables);
objParser.SetTemplate(((EmailItem)Sitecore.Context.Database.GetItem(EmailPaths.FeedbackCampaignFormAdmin)).Emailhtml.Text);
string strMessageBody = objParser.Parse();
mm.sharedtools.EmailMessagingService.SendResult objSendResult = new mm.sharedtools.EmailMessagingService.SendResult();
mm.sharedtools.EmailMessagingService.Messaging objMessaging = new mm.sharedtools.EmailMessagingService.Messaging();
string strAttachments = "";
//now call messaging service
objSendResult = objMessaging.SendMailSecure(strEmailFromAddress, strEmailToAddress, "", strEmailBccAddress, strEmailSubject, true, strMessageBody, strAttachments);
if (objSendResult.Success == true)
{
blnEmailSent = true;
}
}
catch (Exception ex)
{
Log.Error(String.Format("Error sending club feedback data email: {0}", ex.Message), this);
mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
}
return blnEmailSent;
}
示例5: SendConfirmationEmail
private Boolean SendConfirmationEmail()
{
bool blnEmailSent = false;
try
{
string strEmailSubject = EmailSubjects.PersonalDetailsConfirmation;
string strEmailFromAddress = Settings.WebsiteMailFromText;
string strEmailToAddress = txtEmail.Value.Trim();
//Populate email text variables
Hashtable objTemplateVariables = new Hashtable();
objTemplateVariables.Add("HomePageUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.HomePage));
objTemplateVariables.Add("FacilitiesAndClassesLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.FacilitiesAndClasses));
objTemplateVariables.Add("YourHealthLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.YourHealth));
objTemplateVariables.Add("MembershipsLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.Memberships));
objTemplateVariables.Add("PrivacyPolicyLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.PrivacyPolicy));
objTemplateVariables.Add("TermsAndConditionsLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.TermsAndConditions));
objTemplateVariables.Add("Copyright", Translate.Text("© Copyright ##Year## Virgin Active. All rights reserved."));
objTemplateVariables.Add("CustomerName", (txtFirstName.Value.Trim() + " " + txtSurname.Value.Trim()).Trim());
objTemplateVariables.Add("EmailSubject", strEmailSubject);
objTemplateVariables.Add("EmailFromAddress", strEmailFromAddress);
objTemplateVariables.Add("EmailToAddress", strEmailToAddress);
objTemplateVariables.Add("YouTubeLinkUrl", Settings.YouTubeLinkUrl);
objTemplateVariables.Add("TwitterLinkUrl", Settings.TwitterLinkUrl);
objTemplateVariables.Add("FacebookLinkUrl", Settings.FacebookLinkUrl);
objTemplateVariables.Add("McCormackMorrisonLinkUrl", Settings.McCormackMorrisonUrl);
objTemplateVariables.Add("ImageRootUrl", Sitecore.Web.WebUtil.GetServerUrl());
//Parser objParser = new Parser(Server.MapPath(EmailTemplates.ContactUsFeedbackConfirmation), objTemplateVariables);
Parser objParser = new Parser(objTemplateVariables);
objParser.SetTemplate(((EmailItem)Sitecore.Context.Database.GetItem(EmailPaths.PersonalDetailsConfirmation)).Emailhtml.Text);
string strMessageBody = objParser.Parse();
mm.sharedtools.EmailMessagingService.SendResult objSendResult = new mm.sharedtools.EmailMessagingService.SendResult();
mm.sharedtools.EmailMessagingService.Messaging objMessaging = new mm.sharedtools.EmailMessagingService.Messaging();
string strAttachments = "";
//now call messaging service
objSendResult = objMessaging.SendMailSecure(strEmailFromAddress, strEmailToAddress, "", Settings.BccEmailAddress, strEmailSubject, true, strMessageBody, strAttachments);
if (objSendResult.Success == true)
{
blnEmailSent = true;
}
}
catch (Exception ex)
{
Log.Error(String.Format("Error sending contact us email confirmation: {0}", ex.Message), this);
mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
}
return blnEmailSent;
}
示例6: SendConfirmationEmail
//.........这里部分代码省略.........
objTemplateVariables.Add("FacebookLinkUrl", Settings.FacebookLinkUrl);
objTemplateVariables.Add("McCormackMorrisonLinkUrl", Settings.McCormackMorrisonUrl);
objTemplateVariables.Add("ImageRootUrl", Sitecore.Web.WebUtil.GetServerUrl());
objTemplateVariables.Add("ClubPhoneNumber", club.Salestelephonenumber.Rendered);
System.Text.StringBuilder markupBuilder;
markupBuilder = new System.Text.StringBuilder();
markupBuilder.Append(club.Addressline1.Rendered);
markupBuilder.Append(!String.IsNullOrEmpty(club.Addressline2.Rendered) ? "<br />" + club.Addressline2.Rendered : "");
markupBuilder.Append(!String.IsNullOrEmpty(club.Addressline3.Rendered) ? "<br />" + club.Addressline3.Rendered : "");
markupBuilder.Append(!String.IsNullOrEmpty(club.Addressline4.Rendered) ? "<br />" + club.Addressline4.Rendered : "");
markupBuilder.Append("<br />" + club.Postcode.Rendered);
objTemplateVariables.Add("ClubAddress", markupBuilder.ToString());
//Get the facility modules that are to be shown on listing page
List<TreatmentModuleItem> treatmentModules = listing.Sharedtreatments.ListItems.ToList().ConvertAll(X => new TreatmentModuleItem(X));
//Chosen Treatment and Brand details
string strTreatment = "";
string strHealthAndBeautyBrand = "";
string strTreatmentBrandDetails = "";
strTreatment = drpTreatment.SelectedValue.ToString() != Translate.Text("Select") ? drpTreatment.SelectedValue.ToString() : "";
foreach (TreatmentModuleItem module in treatmentModules)
{
//find which brand the treatment belows to
sharedLanding = new HealthAndBeautyLandingItem(module.InnerItem.Axes.SelectSingleItem(String.Format(@"ancestor-or-self::*[@@tid=""{0}""]", HealthAndBeautyLandingItem.TemplateId)));
if (sharedLanding != null)
{
strHealthAndBeautyBrand = sharedLanding.PageSummary.NavigationTitle.Rendered;
strEmailSubject = strEmailSubject.Replace("<SpaName>", strHealthAndBeautyBrand);
}
break;
}
if (strTreatment != "" && strHealthAndBeautyBrand != "" && blnIsAppointment)
{
strTreatmentBrandDetails = strTreatment + " at " + strHealthAndBeautyBrand + ", " + club.Clubname.Rendered;
}
else if (strHealthAndBeautyBrand != "")
{
strTreatmentBrandDetails = strHealthAndBeautyBrand + ", " + club.Clubname.Rendered;
}
else if (strTreatment != "")
{
strTreatmentBrandDetails = strHealthAndBeautyBrand + ", " + club.Clubname.Rendered;
}
else
{
strTreatmentBrandDetails = club.Clubname.Rendered;
}
objTemplateVariables.Add("TreatmentBrandDetails", strTreatmentBrandDetails);
//Chosen Time and Day options
string strDay = txtPreferredDay.Value.Trim();
string strTime = drpPreferredTime.SelectedValue.ToString() != Translate.Text("Select") ? drpPreferredTime.SelectedValue.ToString() : "";
string strDayAndTime = "";
if (strDay != "" && strTime != "")
{
strDayAndTime = strDay + " and " + strTime;
}
else if (strDay != "")
{
strDayAndTime = strDay;
}
objTemplateVariables.Add("PreferredDayAndTime", strDayAndTime);
//Parser objParser = new Parser(Server.MapPath(strEmailTemplate), objTemplateVariables);
Parser objParser = new Parser(objTemplateVariables);
objParser.SetTemplate(EmailTemplate.Emailhtml.Text);
string strMessageBody = objParser.Parse();
mm.sharedtools.EmailMessagingService.SendResult objSendResult = new mm.sharedtools.EmailMessagingService.SendResult();
mm.sharedtools.EmailMessagingService.Messaging objMessaging = new mm.sharedtools.EmailMessagingService.Messaging();
string strAttachments = "";
//now call messaging service
objSendResult = objMessaging.SendMailSecure(strEmailFromAddress, strEmailToAddress, "", Settings.BccEmailAddress, strEmailSubject, true, strMessageBody, strAttachments);
if (objSendResult.Success == true)
{
blnEmailSent = true;
}
}
catch (Exception ex)
{
Log.Error(String.Format("Error sending confirmation email {1}: {0}", ex.Message, club.Clubname.Raw), this);
mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
}
return blnEmailSent;
}
示例7: SendConfirmationEmail
private Boolean SendConfirmationEmail()
{
bool blnEmailSent = false;
try
{
if (campaign.CampaignBase.Emailtemplate.Item != null)
{
//Get Campaign Email object
EmailBaseItem emailItem = campaign.CampaignBase.Emailtemplate.Item;
//string strEmailSubject = campaign.Campaign.CampaignBase.Emailsubject.Rendered;
string strEmailSubject = emailItem.Subject.Raw;
//string strEmailFromAddress = Settings.WebsiteMailFromText;
string strEmailFromAddress = emailItem.Fromaddress.Raw;
string strEmailToAddress = email.Value.Trim();
//Populate email text variables
Hashtable objTemplateVariables = new Hashtable();
objTemplateVariables.Add("HomePageUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.HomePage));
objTemplateVariables.Add("Copyright", Translate.Text("© Copyright ##Year## Virgin Active. All rights reserved."));
objTemplateVariables.Add("FacilitiesAndClassesLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.FacilitiesAndClasses));
objTemplateVariables.Add("YourHealthLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.YourHealth));
objTemplateVariables.Add("MembershipsLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.Memberships));
objTemplateVariables.Add("PrivacyPolicyLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.PrivacyPolicy));
objTemplateVariables.Add("TermsAndConditionsLinkUrl", SitecoreHelper.GetQualifiedUrlFromItemPath(ItemPaths.TermsAndConditions));
//objTemplateVariables.Add("CampaignTermsAndConditionsLinkUrl", new PageSummaryItem(campaign.CampaignBase.Termsandconditionslink.Item).QualifiedUrl);
objTemplateVariables.Add("CampaignUrl", campaign.CampaignBase.QualifiedUrl);
objTemplateVariables.Add("ClubManagerName", manager != null ? manager.Person.Firstname.Rendered + " " + manager.Person.Lastname.Rendered : "");
objTemplateVariables.Add("EmailSubject", strEmailSubject);
objTemplateVariables.Add("EmailFromAddress", strEmailFromAddress);
objTemplateVariables.Add("EmailToAddress", strEmailToAddress);
objTemplateVariables.Add("YouTubeLinkUrl", Settings.YouTubeLinkUrl);
objTemplateVariables.Add("TwitterLinkUrl", Settings.TwitterLinkUrl);
objTemplateVariables.Add("FacebookLinkUrl", Settings.FacebookLinkUrl);
objTemplateVariables.Add("McCormackMorrisonLinkUrl", Settings.McCormackMorrisonUrl);
objTemplateVariables.Add("ImageRootUrl", Sitecore.Web.WebUtil.GetServerUrl());
System.Text.StringBuilder markupBuilder;
markupBuilder = new System.Text.StringBuilder();
//Parser objParser = new Parser(campaign.Campaign.CampaignBase.GetTemplateHtml(), objTemplateVariables);
Parser objParser = new Parser(objTemplateVariables);
if (emailItem.InnerItem.TemplateName == Templates.CampaignEmail)
{
CampaignEmailItem campaignEmail = (CampaignEmailItem)emailItem.InnerItem;
//First parse the Email Body text
objParser.SetTemplate(campaignEmail.Emailbody.Raw);
string strEmailBody = objParser.Parse();
objTemplateVariables.Add("EmailBody", strEmailBody);
//Second parse the full html -substituting in title and preheader
objTemplateVariables.Add("EmailTitle", campaignEmail.Emailtitle.Raw);
objTemplateVariables.Add("EmailPreheader", campaignEmail.Emailpreheader.Raw);
objParser = new Parser(objTemplateVariables);
objParser.SetTemplate(campaignEmail.Classichtml.Raw);
}
else
{
EmailItem standardEmail = (EmailItem)emailItem.InnerItem;
//Standard email
objParser.SetTemplate(standardEmail.Emailhtml.Raw);
}
//Parser objParser = new Parser(Server.MapPath(EmailTemplates.FreeGuestPassConfirmation), objTemplateVariables);
string strEmailHtml = objParser.Parse();
mm.sharedtools.EmailMessagingService.SendResult objSendResult = new mm.sharedtools.EmailMessagingService.SendResult();
mm.sharedtools.EmailMessagingService.Messaging objMessaging = new mm.sharedtools.EmailMessagingService.Messaging();
string strAttachments = "";
//now call messaging service
objSendResult = objMessaging.SendMailSecure(strEmailFromAddress, strEmailToAddress, "", Settings.BccEmailAddress, strEmailSubject, true, strEmailHtml, strAttachments);
if (objSendResult.Success == true)
{
blnEmailSent = true;
}
}
}
catch (Exception ex)
{
//Log.Error(String.Format("Error sending contact us email confirmation {1}: {0}", ex.Message, currentClub.Clubname.Raw), this);
}
return blnEmailSent;
}
示例8: SendAdminEmail
private Boolean SendAdminEmail()
{
bool blnEmailSent = false;
try
{
string strEmailSubject = EmailSubjects.PersonalDetailsFormAdmin;
string strEmailFromAddress = Settings.WebsiteMailFromText;
string strEmailToAddress = "";
if (Sitecore.Configuration.Settings.GetSetting("SystemEmails").ToLower() == "false")
{
//Use test
strEmailToAddress = Settings.McCormackMorrisonTestEmailAddress;
}
else
{
//Use Email Address for per marketing campaigns
strEmailToAddress = Settings.FeedbackCampaignEmailToListShort;
}
//Populate email text variables
Hashtable objTemplateVariables = new Hashtable();
//objTemplateVariables.Add("FeedbackSubject", "Personal Details Update");
//objTemplateVariables.Add("FeedbackSubjectDetail", "");
objTemplateVariables.Add("SubmissionDate", DateTime.Now.ToShortDateString());
objTemplateVariables.Add("MemberRecordID", hdnRecordId.Value.Trim());
objTemplateVariables.Add("CustomerName", (txtFirstName.Value.Trim() + " " + txtSurname.Value.Trim()).Trim());
objTemplateVariables.Add("CustomerEmail", txtEmail.Value.Trim());
objTemplateVariables.Add("MembershipNo", txtMembership.Value.Trim());
DateTime datDateOfBirth;
if (DateTime.TryParse(drpDOBDay.SelectedValue + "/" + drpDOBMonth.SelectedValue + "/" + drpDOBYear.SelectedValue, out datDateOfBirth))
{
objTemplateVariables.Add("DateOfBirth", datDateOfBirth.ToString("dd/MM/yyyy"));
}
else
{
objTemplateVariables.Add("DateOfBirth", "");
}
objTemplateVariables.Add("HomePhoneNo", txtHomeNo.Value.Trim());
objTemplateVariables.Add("WorkPhoneNo", txtWorkNo.Value.Trim());
objTemplateVariables.Add("MobilePhoneNo", txtMobileNo.Value.Trim());
objTemplateVariables.Add("Address1", txtAddress1.Value.Trim());
objTemplateVariables.Add("Address2", txtAddress2.Value.Trim());
objTemplateVariables.Add("Address3", txtAddress3.Value.Trim());
objTemplateVariables.Add("Address4", txtAddress4.Value.Trim());
objTemplateVariables.Add("Address5", txtAddress5.Value.Trim());
objTemplateVariables.Add("Postcode", txtPostcode.Value.Trim());
objTemplateVariables.Add("ContactByMarketing", chkContactByMarketing.Checked == true ? "Y" : "N");
objTemplateVariables.Add("SubscribeToNewsletter", "N/A");
objTemplateVariables.Add("PublishDetails", "N/A");
objTemplateVariables.Add("EmailSubject", strEmailSubject);
objTemplateVariables.Add("EmailFromAddress", strEmailFromAddress);
objTemplateVariables.Add("EmailToAddress", strEmailToAddress);
//Parser objParser = new Parser(Server.MapPath(EmailTemplates.ClubFeedbackFormAdmin), objTemplateVariables);
Parser objParser = new Parser(objTemplateVariables);
objParser.SetTemplate(((EmailItem)Sitecore.Context.Database.GetItem(EmailPaths.PersonalDetailsFormAdmin)).Emailhtml.Text);
string strMessageBody = objParser.Parse();
mm.sharedtools.EmailMessagingService.SendResult objSendResult = new mm.sharedtools.EmailMessagingService.SendResult();
mm.sharedtools.EmailMessagingService.Messaging objMessaging = new mm.sharedtools.EmailMessagingService.Messaging();
string strAttachments = "";
//now call messaging service
objSendResult = objMessaging.SendMailSecure(strEmailFromAddress, strEmailToAddress, "", "", strEmailSubject, true, strMessageBody, strAttachments);
if (objSendResult.Success == true)
{
blnEmailSent = true;
}
}
catch (Exception ex)
{
Log.Error(String.Format("Error sending contact us data email: {0}", ex.Message), this);
mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
}
return blnEmailSent;
}
示例9: SendAdminEmail
private Boolean SendAdminEmail()
{
bool blnEmailSent = false;
try
{
string strEmailSubject = EmailSubjects.FeedbackCampaignFormAdmin;
string strEmailFromAddress = Settings.WebsiteMailFromText;
string strEmailToAddress = "";
if (Sitecore.Configuration.Settings.GetSetting("SystemEmails").ToLower() == "false")
{
//Use test
strEmailToAddress = Settings.McCormackMorrisonTestEmailAddress;
}
else
{
strEmailToAddress = Settings.FeedbackCampaignEmailToListShort;
}
//Populate email text variables
Hashtable objTemplateVariables = new Hashtable();
objTemplateVariables.Add("CustomerName", yourname.Value);
objTemplateVariables.Add("CustomerEmail", email.Value);
//objTemplateVariables.Add("HomeClubID", txtClubCode.Value);
objTemplateVariables.Add("HomeClubID", currentClub.ClubId.Rendered);
objTemplateVariables.Add("Telephone", contact.Value);
objTemplateVariables.Add("Comments", "N/A");
objTemplateVariables.Add("SubscribeToNewsletter", subscribe.Checked ? "Yes" : "No");
objTemplateVariables.Add("PublishDetails", "N/A");
//objTemplateVariables.Add("FeedbackSubject", campaign.CampaignBase.Campaigntype.Raw);
objTemplateVariables.Add("FeedbackSubject", !String.IsNullOrEmpty(campaign.CampaignBase.Campaigntype.Raw) ? campaign.CampaignBase.Campaigntype.Raw : "");
objTemplateVariables.Add("FeedbackSubjectDetail", campaign.CampaignBase.Campaignname.Rendered);
objTemplateVariables.Add("SubmissionDate", DateTime.Now.ToShortDateString());
objTemplateVariables.Add("ImageSubmitted", "N/A");
objTemplateVariables.Add("EmailSubject", strEmailSubject);
objTemplateVariables.Add("EmailFromAddress", strEmailFromAddress);
objTemplateVariables.Add("EmailToAddress", strEmailToAddress);
//Parser objParser = new Parser(Server.MapPath(EmailTemplates.FeedbackCampaignFormAdmin), objTemplateVariables);
Parser objParser = new Parser(objTemplateVariables);
objParser.SetTemplate(((EmailItem)Sitecore.Context.Database.GetItem(EmailPaths.FeedbackCampaignFormAdmin)).Emailhtml.Text);
string strMessageBody = objParser.Parse();
mm.sharedtools.EmailMessagingService.SendResult objSendResult = new mm.sharedtools.EmailMessagingService.SendResult();
mm.sharedtools.EmailMessagingService.Messaging objMessaging = new mm.sharedtools.EmailMessagingService.Messaging();
string strAttachments = "";
//now call messaging service
objSendResult = objMessaging.SendMailSecure(strEmailFromAddress, strEmailToAddress, "", "", strEmailSubject, true, strMessageBody, strAttachments);
if (objSendResult.Success == true)
{
if (campaign.InnerItem.TemplateName == Templates.ExMemberCampaign)
{
//if this is an Ex-Member send email to Members Feeback email address for the club
strEmailToAddress = "";
if (Sitecore.Configuration.Settings.GetSetting("SystemEmails").ToLower() == "false")
{
//Use test
strEmailToAddress = Settings.McCormackMorrisonTestEmailAddress;
}
else
{
//use feedback email address
strEmailToAddress = currentClub.Feedbackemail.Raw;
}
//now call messaging service
objSendResult = objMessaging.SendMailSecure(strEmailFromAddress, strEmailToAddress, "", "", strEmailSubject, true, strMessageBody, strAttachments);
}
blnEmailSent = true;
}
}
catch (Exception ex)
{
Log.Error(String.Format("Error sending club feedback data email: {0}", ex.Message), this);
mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
}
return blnEmailSent;
}
示例10: SendAdminEmail
private Boolean SendAdminEmail()
{
bool blnEmailSent = false;
try
{
string strEmailSubject = EmailSubjects.FeedbackCampaignFormAdmin;
string strEmailFromAddress = Settings.WebsiteMailFromText;
string strEmailToAddress = "";
if (Sitecore.Configuration.Settings.GetSetting("SystemEmails").ToLower() == "false")
{
//Use test
strEmailToAddress = Settings.McCormackMorrisonTestEmailAddress;
}
else
{
strEmailToAddress = Settings.FeedbackCampaignEmailToListShort;
}
//Populate email text variables
Hashtable objTemplateVariables = new Hashtable();
objTemplateVariables.Add("CustomerEmail", email.Value);
//objTemplateVariables.Add("HomeClubID", txtClubCode.Value);
objTemplateVariables.Add("Comments", "N/A");
objTemplateVariables.Add("SubscribeToNewsletter", "Yes");
objTemplateVariables.Add("PublishDetails", "N/A");
objTemplateVariables.Add("FeedbackSubject", campaign.CampaignBase.Campaigntype.Raw);
objTemplateVariables.Add("FeedbackSubjectDetail", campaign.CampaignBase.Campaignname.Rendered);
objTemplateVariables.Add("SubmissionDate", DateTime.Now.ToShortDateString());
objTemplateVariables.Add("ImageSubmitted", "N/A");
objTemplateVariables.Add("EmailSubject", strEmailSubject);
objTemplateVariables.Add("EmailFromAddress", strEmailFromAddress);
objTemplateVariables.Add("EmailToAddress", strEmailToAddress);
//Parser objParser = new Parser(Server.MapPath(EmailTemplates.FeedbackCampaignFormAdmin), objTemplateVariables);
Parser objParser = new Parser(objTemplateVariables);
objParser.SetTemplate(campaign.CampaignBase.GetAdminTemplateHtml());
string strMessageBody = objParser.Parse();
mm.sharedtools.EmailMessagingService.SendResult objSendResult = new mm.sharedtools.EmailMessagingService.SendResult();
mm.sharedtools.EmailMessagingService.Messaging objMessaging = new mm.sharedtools.EmailMessagingService.Messaging();
string strAttachments = "";
//now call messaging service
objSendResult = objMessaging.SendMailSecure(strEmailFromAddress, strEmailToAddress, "", "", strEmailSubject, true, strMessageBody, strAttachments);
if (objSendResult.Success == true)
{
blnEmailSent = true;
}
}
catch (Exception ex)
{
Log.Error(String.Format("Error sending club feedback data email: {0}", ex.Message), this);
mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
}
return blnEmailSent;
}
示例11: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
//This is a timetable item (or microsite timetable item -treated the same)
timetableItem = new TimetableItem(Sitecore.Context.Item);
List<PageSummaryItem> sectionTimetables = null;
if (Sitecore.Context.Item.TemplateID.ToString() == TimetableItem.TemplateId.ToString())
{
//This is a timetable item
currentClub = new ClubItem(Sitecore.Context.Item.Axes.SelectSingleItem(String.Format(@"ancestor-or-self::*[@@tid=""{0}"" or @@tid=""{1}""]", ClassicClubItem.TemplateId, LifeCentreItem.TemplateId)));
ClubHomeUrl = currentClub != null ? LinkManager.GetItemUrl(currentClub.InnerItem) : "";
sectionTimetables = timetableItem.InnerItem.Axes.SelectItems(String.Format("..//*[@@tid='{0}']", TimetableItem.TemplateId)).ToList().ConvertAll(x => new PageSummaryItem(x));
sectionTimetables.RemoveAll(x => x.Hidefrommenu.Checked); //Remove all hidden items
}
else
{
//This is a microsoft timetable item
MicrositeHomeItem micrositeHome = new MicrositeHomeItem(timetableItem.InnerItem.Axes.SelectSingleItem(String.Format(@"ancestor-or-self::*[@@tid=""{0}""]", MicrositeHomeItem.TemplateId)));
ClubMicrositeLandingItem micrositeLanding = micrositeHome.InnerItem.Parent;
currentClub = micrositeLanding.Club.Item;
ClubHomeUrl = currentClub != null ? LinkManager.GetItemUrl(micrositeHome.InnerItem) : "";
sectionTimetables = timetableItem.InnerItem.Axes.SelectItems(String.Format("..//*[@@tid='{0}']", MicrositeTimetableItem.TemplateId)).ToList().ConvertAll(x => new PageSummaryItem(x));
sectionTimetables.RemoveAll(x => x.Hidefrommenu.Checked); //Remove all hidden items
}
//Set Navigation elements
if (sectionTimetables != null && sectionTimetables.Count > 1)
{
sectionTimetables.First().IsFirst = true;
sectionTimetables.Last().IsLast = true;
//Set current
foreach (PageSummaryItem child in sectionTimetables)
{
Item current = child.InnerItem.Axes.SelectSingleItem(String.Format("descendant-or-self::*[@@id='{0}']", timetableItem.ID.ToString()));
if (current != null)
{
child.IsCurrent = true;
}
}
SecondLevelElements.DataSource = sectionTimetables;
SecondLevelElements.DataBind();
}
PageSummaryItem timetableSectionItem = new PageSummaryItem(timetableItem.InnerItem.Parent);
ClubTimetablesUrl = Sitecore.Links.LinkManager.GetItemUrl(timetableSectionItem);
if (currentClub != null)
{
ClubName = currentClub.Clubname.Rendered;
clubMemberPhone = currentClub.Memberstelephonenumber.Rendered;
//Get enquiries link
PageSummaryItem enqForm = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.EnquiryForm));
if (enqForm != null)
{
ClubEnquiriesUrl = enqForm.Url + "?sc_trk=enq&c=" + currentClub.InnerItem.ID.ToShortID();
}
//Set Book Online Link
if (currentClub.GetCrmSystem() == ClubCrmSystemTypes.ClubCentric || currentClub.GetCrmSystem() == ClubCrmSystemTypes.Vision)
{
//Show link
pnlBookOnline.Visible = true;
BookOnlineUrl = SitecoreHelper.GetMembershipLoginUrl(currentClub);
}
if (timetableItem.Showalert.Checked)
{
string textToParse = timetableItem.Alerttext.Rendered;
Hashtable objTemplateVariables = new Hashtable();
objTemplateVariables.Add("SalesNumber", currentClub.Salestelephonenumber.Rendered);
Parser objParser = new Parser(objTemplateVariables);
objParser.SetTemplate(textToParse);
textToParse = objParser.Parse();
alert = @"<div class=""message""><p>" + textToParse + @"</p></div>";
}
}
//What day are we rendering?
int.TryParse(WebUtil.GetQueryString("day"), out day);
timetableType = timetableItem.Type.Raw;
Item settings = Sitecore.Context.Database.GetItem(ItemPaths.TimetableShared);
if (settings != null)
{
TimetableSharedItem settingsItem = new TimetableSharedItem(settings);
//TimetableUnavailableHeading.Text = settingsItem.Timetableunavailableheading.Text;
TimetableUnavailableMessage.Text =
settingsItem.Mobiletimetableunavailabletext.Text.Replace("#clubMemberPhone#", clubMemberPhone);
}
//.........这里部分代码省略.........
示例12: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
TimetableItem currentItem = new TimetableItem(Sitecore.Context.Item);
ClubItem club = new ClubItem(Sitecore.Context.Item.Axes.SelectSingleItem(String.Format(@"ancestor-or-self::*[@@tid=""{0}"" or @@tid=""{1}""]", ClassicClubItem.TemplateId, LifeCentreItem.TemplateId)));
try
{
clubMemberPhone = club.Memberstelephonenumber.Rendered;
clubId = club.ClubId.Rendered;
timetableType = currentItem.Type.Rendered;
Item settings = Sitecore.Context.Database.GetItem(ItemPaths.TimetableShared);
if (settings != null)
{
TimetableSharedItem settingsItem = new TimetableSharedItem(settings);
TimetableUnavailableHeading.Text = settingsItem.Timetableunavailableheading.Text;
TimetableUnavailableMessage.Text =
settingsItem.Timetableunavailabletext.Text.Replace("#clubMemberPhone#", clubMemberPhone);
}
if(currentItem.Showalert.Checked)
{
string textToParse = currentItem.Alerttext.Rendered;
Hashtable objTemplateVariables = new Hashtable();
objTemplateVariables.Add("SalesNumber", club.Salestelephonenumber.Rendered);
Parser objParser = new Parser(objTemplateVariables);
objParser.SetTemplate(textToParse);
textToParse = objParser.Parse();
alert = @"<div class=""club-alert-panel""><div class=""club-alert""><p>" + textToParse + @"</p></div></div>";
}
ClassContainer ClubClasses = Utility.GetClubTimetable(clubId);
////Need to lookup the daterange from the timetable
//if (Cache[clubId] == null)
//{
// //initialise webservice
// //mm.virginactive.webservices.virginactive.classtimetable.Service vs = new mm.virginactive.webservices.virginactive.classtimetable.Service();
// mm.virginactive.webservices.virginactive.classtimetable.VA_ClassTimetables vs = new mm.virginactive.webservices.virginactive.classtimetable.VA_ClassTimetables();
// //mm.virginactive.webservices.virginactive.classtimetable.VA_ClassTimetables vs = new mm.virginactive.webservices.virginactive.classtimetable.VA_ClassTimetables();
// ClubClasses = vs.Classes(clubId);
// double cacheLiveTime = 20.0;
// Double.TryParse(Settings.TimetableCacheMinutes, out cacheLiveTime);
// Cache.Insert(clubId, ClubClasses, null, DateTime.Now.AddMinutes(cacheLiveTime), Cache.NoSlidingExpiration);
//}
//else //Fetch from cache
//{
// ClubClasses = (struct_Classes)Cache[clubId];
//}
List<Timetable> tempItems = new List<Timetable>();
//Check each Timetable in collection is valid
foreach (Timetable item in ClubClasses.Timetables)
{
if (item.Dayname != null)
{
tempItems.Add(item);
}
}
if ((tempItems.Count > 0) && (currentItem.Type.Rendered != ""))
{
System.Text.StringBuilder markupBuilder = new System.Text.StringBuilder();
markupBuilder.Append(@"<span class=""bold"">");
markupBuilder.Append(StringHelper.GenerateDateString(tempItems[0].Date));
markupBuilder.Append(@"</span> to <span class=""bold"">");
markupBuilder.Append(StringHelper.GenerateDateString(tempItems[tempItems.Count - 1].Date));
markupBuilder.Append("</span>");
dateRangeStr = markupBuilder.ToString();
timetableNameStr = currentItem.PageSummary.DisplayName;
//create ajax controls
ClubTimetableResult timetableResult = this.Page.LoadControl("~/layouts/virginactive/ajax/ClubTimetableResult.ascx") as ClubTimetableResult;
ClubTimetableFilter timetableFilter = this.Page.LoadControl("~/layouts/virginactive/ajax/ClubTimetableFilter.ascx") as ClubTimetableFilter;
timetableResult.ClubId = clubId;
timetableResult.Type = timetableType;
timetableResult.ShowBookClassTooltip = currentItem.Showbookclasstooltip.Checked;
string textToParse = currentItem.Bookclasstooltip.Raw;
Hashtable objTemplateVariables = new Hashtable();
objTemplateVariables.Add("salesnumber", club.Salestelephonenumber.Rendered);
Parser objParser = new Parser(objTemplateVariables);
objParser.SetTemplate(textToParse);
textToParse = objParser.Parse();
timetableResult.BookClassTooltip = textToParse;
//.........这里部分代码省略.........
示例13: SendAdminEmail
private Boolean SendAdminEmail()
{
bool blnEmailSent = false;
try
{
string strEmailSubject = EmailSubjects.ClubEnquiryFormAdmin;
string strEmailFromAddress = Settings.WebsiteMailFromText;
string strEmailToAddress = "";
if (Sitecore.Configuration.Settings.GetSetting("SystemEmails").ToLower() == "false")
{
//Use test
strEmailToAddress = Settings.McCormackMorrisonTestEmailAddress;
}
else
{
if (currentClub.Salesemail.Rendered.Trim() != "")
{
strEmailToAddress = currentClub.Salesemail.Rendered.Trim();
}
else
{
strEmailToAddress = Settings.DefaultFormToEmailAddress;
//TODO: Send warning alert.
Log.Error(String.Format("Could not find sales email address for club {0}", currentClub.Clubname.Raw), this);
}
}
User objUser = new User();
//Set user session variable
if (Session["sess_User"] != null)
{
objUser = (User)Session["sess_User"];
}
string enquiryFormType = "";
switch (objUser.EnquiryFormType)
{
case EnquiryFormTypes.BookATour:
enquiryFormType = "Book A Visit";
break;
case EnquiryFormTypes.Corporate:
enquiryFormType = "Corporate";
break;
case EnquiryFormTypes.ExistingScheme:
enquiryFormType = "Existing Scheme";
break;
case EnquiryFormTypes.General:
enquiryFormType = "General";
break;
default:
enquiryFormType = "General";
break;
}
//Populate email text variables
Hashtable objTemplateVariables = new Hashtable();
objTemplateVariables.Add("CustomerName", txtName.Value.Trim());
objTemplateVariables.Add("CustomerEmail", txtEmail.Value.Trim());
objTemplateVariables.Add("Telephone", txtPhone.Value.Trim() != "" ? txtPhone.Value.Trim() : "N/A");
objTemplateVariables.Add("HowDidCustomerFindUs", drpHowDidYouFindUs.SelectedValue.ToString() != "" && drpHowDidYouFindUs.SelectedValue.ToString() != Translate.Text("Select") ? drpHowDidYouFindUs.SelectedValue.ToString() : "");
objTemplateVariables.Add("SubscribeToNewsletter", chkSubscribe.Checked ? "Yes" : "No");
objTemplateVariables.Add("ClubName", currentClub.Clubname.Rendered);
objTemplateVariables.Add("EnquiryType", enquiryFormType);
objTemplateVariables.Add("EmailSubject", strEmailSubject);
objTemplateVariables.Add("EmailFromAddress", strEmailFromAddress);
objTemplateVariables.Add("EmailToAddress", strEmailToAddress);
//Parser objParser = new Parser(Server.MapPath(EmailTemplates.ClubEnquiryFormAdmin), objTemplateVariables);
Parser objParser = new Parser(objTemplateVariables);
objParser.SetTemplate(((EmailItem)Sitecore.Context.Database.GetItem(EmailPaths.ClubEnquiryFormAdmin)).Emailhtml.Text);
string strMessageBody = objParser.Parse();
mm.sharedtools.EmailMessagingService.SendResult objSendResult = new mm.sharedtools.EmailMessagingService.SendResult();
mm.sharedtools.EmailMessagingService.Messaging objMessaging = new mm.sharedtools.EmailMessagingService.Messaging();
string strAttachments = "";
//now call messaging service
objSendResult = objMessaging.SendMailSecure(strEmailFromAddress, strEmailToAddress, "", Settings.BccEmailAddress, strEmailSubject, true, strMessageBody, strAttachments);
if (objSendResult.Success == true)
{
blnEmailSent = true;
}
if (currentClub.ClubId.Rendered == "")
{
Log.Error(String.Format("No Club ID exists for club: {0}", currentClub.Clubname.Raw), this);
}
}
catch (Exception ex)
{
Log.Error(String.Format("Error sending enquiry data email {1}: {0}", ex.Message, currentClub.Clubname.Raw), this);
}
return blnEmailSent;
}
示例14: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
try
{
ClubMicrositeLandingItem landing = new ClubMicrositeLandingItem(micrositeTimetable.InnerItem.Axes.SelectSingleItem(String.Format(@"ancestor-or-self::*[@@tid=""{0}""]", ClubMicrositeLandingItem.TemplateId)));
currentClub = landing.Club.Item;
micrositeTimetableLanding = micrositeTimetable.InnerItem.Parent;
//Set Navigation elements
List<PageSummaryItem> sectionTimetables = micrositeTimetable.InnerItem.Axes.SelectItems(String.Format("..//*[@@tid='{0}']", MicrositeTimetableItem.TemplateId)).ToList().ConvertAll(x => new PageSummaryItem(x));
sectionTimetables.RemoveAll(x => x.Hidefrommenu.Checked); //Remove all hidden items
if (sectionTimetables.Count > 1)
{
sectionTimetables.First().IsFirst = true;
sectionTimetables.Last().IsLast = true;
//Set current
foreach (PageSummaryItem child in sectionTimetables)
{
Item current = child.InnerItem.Axes.SelectSingleItem(String.Format("descendant-or-self::*[@@id='{0}']", micrositeTimetable.ID.ToString()));
if (current != null)
{
child.IsCurrent = true;
}
}
SecondLevelElements.DataSource = sectionTimetables;
SecondLevelElements.DataBind();
}
clubId = currentClub.ClubId.Raw;
//timetableType = TimetableTypes.General;
timetableType = micrositeTimetable.Type.Rendered;
if (micrositeTimetable.Showalert.Checked)
{
string textToParse = micrositeTimetable.Alerttext.Rendered;
Hashtable objTemplateVariables = new Hashtable();
objTemplateVariables.Add("SalesNumber", currentClub.Salestelephonenumber.Rendered);
Parser objParser = new Parser(objTemplateVariables);
objParser.SetTemplate(textToParse);
textToParse = objParser.Parse();
alert = @"<div class=""club-alert-panel""><div class=""club-alert"">" + textToParse + @"</div></div>";
}
clubMemberPhone = currentClub.Memberstelephonenumber.Raw != "" ? currentClub.Memberstelephonenumber.Raw : currentClub.Salestelephonenumber.Raw;
Item settings = Sitecore.Context.Database.GetItem(ItemPaths.TimetableShared);
if (settings != null)
{
TimetableSharedItem settingsItem = new TimetableSharedItem(settings);
TimetableUnavailableHeading.Text = settingsItem.Timetableunavailableheading.Text;
TimetableUnavailableMessage.Text =
settingsItem.Timetableunavailabletext.Text.Replace("#clubMemberPhone#", clubMemberPhone);
}
ClassContainer ClubClasses = Utility.GetClubTimetable(clubId);
////Need to lookup the daterange from the timetable
//if (Cache[clubId] == null)
//{
// //initialise webservice
// //mm.virginactive.webservices.virginactive.classtimetable.Service vs = new mm.virginactive.webservices.virginactive.classtimetable.Service();
// mm.virginactive.webservices.virginactive.classtimetable.VA_ClassTimetables vs = new mm.virginactive.webservices.virginactive.classtimetable.VA_ClassTimetables();
// //mm.virginactive.webservices.virginactive.classtimetable.VA_ClassTimetables vs = new mm.virginactive.webservices.virginactive.classtimetable.VA_ClassTimetables();
// ClubClasses = vs.Classes(clubId);
// double cacheLiveTime = 20.0;
// Double.TryParse(Settings.TimetableCacheMinutes, out cacheLiveTime);
// Cache.Insert(clubId, ClubClasses, null, DateTime.Now.AddMinutes(cacheLiveTime), Cache.NoSlidingExpiration);
//}
//else //Fetch from cache
//{
// ClubClasses = (struct_Classes)Cache[clubId];
//}
List<Timetable> tempItems = new List<Timetable>();
//Check each Timetable in collection is valid
foreach (Timetable item in ClubClasses.Timetables)
{
if (item.Dayname != null)
{
tempItems.Add(item);
}
}
if ((tempItems.Count > 0))
{
System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
stringBuilder.Append(@"<strong>");
stringBuilder.Append(StringHelper.GenerateDateString(tempItems[0].Date));
stringBuilder.Append(@"</strong> ");
//.........这里部分代码省略.........
示例15: SendAdminEmail
private Boolean SendAdminEmail()
{
bool blnEmailSent = false;
try
{
string strEmailSubject = EmailSubjects.FeedbackCampaignFormAdmin;
string strEmailFromAddress = Settings.WebsiteMailFromText;
string strEmailToAddress = "";
string strEmailBccAddress = "";
if (Sitecore.Configuration.Settings.GetSetting("SystemEmails").ToLower() == "false")
{
strEmailToAddress = Settings.McCormackMorrisonTestEmailAddress;
}
else
{
//Use live emails
if (chkExistingMember.Checked == false && campaign.CampaignBase.Isweblead.Checked == true)
{
//form sent to webleads -send confirmation to admin team
strEmailToAddress = Settings.FeedbackCampaignEmailToListShort;
}
else
{
//form NOT sent to webleads -send directly to club
strEmailToAddress = campaign.CampaignBase.Administratorsemaillist.Raw;
//Bcc admin personnel
strEmailBccAddress = Settings.FeedbackCampaignEmailToListShort;
}
}
//Populate email text variables
Hashtable objTemplateVariables = new Hashtable();
objTemplateVariables.Add("CustomerName", name.Value);
objTemplateVariables.Add("CustomerEmail", email.Value);
objTemplateVariables.Add("HomeClubID", currentClub.ClubId.Rendered);
objTemplateVariables.Add("Telephone", tel.Value);
objTemplateVariables.Add("ExistingMember", chkExistingMember.Checked == true ? "Y" : "N");
objTemplateVariables.Add("Comments", "N/A");
objTemplateVariables.Add("SubscribeToNewsletter", "N/A");
objTemplateVariables.Add("PublishDetails", "N/A");
objTemplateVariables.Add("FeedbackSubject", campaign.CampaignBase.Campaigntype.Raw);
objTemplateVariables.Add("FeedbackSubjectDetail", campaign.CampaignBase.Campaignname.Rendered);
objTemplateVariables.Add("SubmissionDate", DateTime.Now.ToShortDateString());
objTemplateVariables.Add("ImageSubmitted", "N/A");
objTemplateVariables.Add("EmailSubject", strEmailSubject);
objTemplateVariables.Add("EmailFromAddress", strEmailFromAddress);
objTemplateVariables.Add("EmailToAddress", strEmailToAddress);
//Parser objParser = new Parser(Server.MapPath(EmailTemplates.FeedbackCampaignFormAdmin), objTemplateVariables);
Parser objParser = new Parser(objTemplateVariables);
objParser.SetTemplate(((EmailItem)Sitecore.Context.Database.GetItem(EmailPaths.FeedbackCampaignFormAdmin)).Emailhtml.Text);
string strMessageBody = objParser.Parse();
mm.sharedtools.EmailMessagingService.SendResult objSendResult = new mm.sharedtools.EmailMessagingService.SendResult();
mm.sharedtools.EmailMessagingService.Messaging objMessaging = new mm.sharedtools.EmailMessagingService.Messaging();
string strAttachments = "";
//now call messaging service
objSendResult = objMessaging.SendMailSecure(strEmailFromAddress, strEmailToAddress, "", strEmailBccAddress, strEmailSubject, true, strMessageBody, strAttachments);
if (objSendResult.Success == true)
{
blnEmailSent = true;
}
}
catch (Exception ex)
{
Log.Error(String.Format("Error sending club feedback data email: {0}", ex.Message), this);
mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
}
return blnEmailSent;
}