public IEnumerable <ISelectItem> GetSelections(ExtendedMetadata metadata) { if ((metadata.Model as PropertyData) == null || (metadata.Model as PropertyData).Parent["icontent_contentlink"] == null || string.IsNullOrEmpty((metadata.Model as PropertyData).Parent["icontent_contentlink"].ToString())) { yield break; } var ownerPage = new ContentReference((metadata.Model as PropertyData).Parent["icontent_contentlink"].ToString()); EventPageBase EventPageBase = EPiServer.DataFactory.Instance.Get <EventPageBase>(ownerPage); if (EventPageBase.RegistrationForm == null) { yield break; } XForm xform = XForm.CreateInstance(new Guid(EventPageBase.RegistrationForm.Id.ToString())); NameValueCollection formControls = xform.CreateFormData().GetValues(); foreach (string data in formControls) { yield return(new SelectItem() { Text = data, Value = data }); } }
public static int UpdateEvent(EventPageBase EventPageBase) { var scheduledEmails = Attend.Business.API.AttendScheduledEmailEngine.GetAllEmails(EventPageBase.ContentLink); int cnt = 0; if (!ContainsStatusMail(scheduledEmails, AttendStatus.Submitted)) { cnt++; CreateScheduledEmail(EventPageBase, AttendStatus.Submitted, EventPageBase["SubmitMailTemplate"] as EmailTemplateBlock, EventPageBase["SubmitMailTemplateBlock"] as ContentReference, "Submit mail template"); } if (!ContainsStatusMail(scheduledEmails, AttendStatus.Confirmed)) { cnt++; CreateScheduledEmail(EventPageBase, AttendStatus.Confirmed, EventPageBase["ConfirmMailTemplate"] as EmailTemplateBlock, EventPageBase["ConfirmMailTemplateBlock"] as ContentReference, "Confirm mail template"); } if (!ContainsStatusMail(scheduledEmails, AttendStatus.Cancelled)) { cnt++; CreateScheduledEmail(EventPageBase, AttendStatus.Cancelled, EventPageBase["CancelMailTemplate"] as EmailTemplateBlock, EventPageBase["CancelMailTemplateBlock"] as ContentReference, "Cancel mail template"); } return(cnt); }
public static string GetEventDates(ContentReference currentEvent) { EventPageBase EventPageBase = ServiceLocator.Current.GetInstance <IContentRepository>().Get <EventPageBase>(currentEvent); if (EventPageBase != null) { // One day event if (EventPageBase.EventDetails.EventEnd.ToShortDateString() == EventPageBase.EventDetails.EventStart.ToShortDateString()) { return(EventPageBase.EventDetails.EventStart.ToString("dd. MMMM yyyy")); } // Multiple days, same month if (EventPageBase.EventDetails.EventStart.Month == EventPageBase.EventDetails.EventEnd.Month) { return(EventPageBase.EventDetails.EventStart.ToString("d. - ") + EventPageBase.EventDetails.EventEnd.ToString("d. MMMM yyyy")); } if (EventPageBase.EventDetails.EventStart.Month == EventPageBase.EventDetails.EventEnd.Month) { return(EventPageBase.EventDetails.EventStart.ToString("d. MMMM - ") + EventPageBase.EventDetails.EventEnd.ToString("d. MMMM yyyy")); } } return(string.Empty); }
public static IEnumerable <ScheduledEmailBlock> GetScheduledEmailsToSend(EventPageBase eventPageBase, DateTime plannedAfterDate, DateTime plannedBeforeDate) { var scheduledEmailBlocks = GetScheduledEmails(eventPageBase); var scheduledEmailBlocksToSend = new List <ScheduledEmailBlock>(); scheduledEmailBlocksToSend.AddRange((from x in scheduledEmailBlocks where x.SendDateTime <plannedBeforeDate && x.SendDateTime> plannedAfterDate && x.DateSent < new DateTime(1801, 01, 01) select x)); return(scheduledEmailBlocksToSend); }
private void PopulateParticipantNumbers() { EventPageBase eventPageBase = CurrentEvent; _numberConfirmed = BVNetwork.Attend.Business.API.AttendRegistrationEngine.GetParticipants(eventPageBase.ContentLink, Business.Text.AttendStatus.Confirmed).Count <IParticipant>(); _numberParticipated = BVNetwork.Attend.Business.API.AttendRegistrationEngine.GetParticipants(eventPageBase.ContentLink, Business.Text.AttendStatus.Participated).Count <IParticipant>(); _numberExpected = _numberConfirmed + _numberParticipated; }
public override IParticipant GenerateParticipant(ContentReference EventPageBase, string email, bool sendMail, string xform, string logText) { var contentRepository = ServiceLocator.Current.GetInstance <IContentRepository>(); EventPageBase EventPageBaseData = contentRepository.Get <EventPageBase>(EventPageBase); ContentFolder participantsFolder = GetOrCreateParticipantsFolder(EventPageBase); ParticipantBlock newParticipant = contentRepository.GetDefault <ParticipantBlock>(participantsFolder.ContentLink); (newParticipant as IContent).Name = email; newParticipant.Code = GenerateCode(); newParticipant.XForm = xform; newParticipant.EventPage = EventPageBase as PageReference; newParticipant.Email = email; newParticipant.AttendStatus = (GetAvailableSeats(EventPageBase) > 0) ? AttendStatus.Confirmed.ToString() : AttendStatus.Submitted.ToString(); newParticipant.Price = EventPageBaseData.EventDetails.Price; newParticipant.Username = EPiServerProfile.Current.UserName; newParticipant.DateSubmitted = DateTime.Now; ParticipantEventArgs e1 = new ParticipantEventArgs(); e1.CurrentParticipant = newParticipant; e1.CancelEvent = false; e1.SendMail = sendMail; RaiseOnAddingParticipant(e1); if (e1.CancelEvent == true) { return(null); } contentRepository.Save(newParticipant as IContent, EPiServer.DataAccess.SaveAction.Publish, EPiServer.Security.AccessLevel.NoAccess); newParticipant = ParticipantLog.AddLogTextAndSave("Generated", logText, newParticipant as ParticipantBlock) as ParticipantBlock; newParticipant = ParticipantLog.AddLogTextAndSave("Status", "Status set to " + newParticipant.AttendStatus, newParticipant as IParticipant) as ParticipantBlock; sendMail = e1.SendMail; ParticipantEventArgs e2 = new ParticipantEventArgs(); e2.CurrentParticipant = newParticipant; e2.CancelEvent = false; e2.SendMail = sendMail; RaiseOnAddedParticipant(e2); sendMail = e1.SendMail; if (sendMail) { SendStatusMail(newParticipant); } return(newParticipant); }
public static EventPageBase GetEventPageBase(IParticipant participant) { if (participant.EventPage != null) { EventPageBase EventPage = ServiceLocator.Current.GetInstance <IContentRepository>().Get <EventPageBase>(participant.EventPage); return(EventPage); } return(null); }
public bool SendStatusMail(IParticipant participant) { AttendStatus status = AttendStatus.Undefined; EventPageBase CurrentEvent = EPiServer.DataFactory.Instance.Get <EventPageBase>(participant.EventPage); Enum.TryParse <AttendStatus>(participant.AttendStatus, out status); foreach (ScheduledEmailBlock scheduledEmailBlock in AttendScheduledEmailEngine.GetScheduledEmails(CurrentEvent.ContentLink, SendOptions.Action, status)) { AttendScheduledEmailEngine.SendScheduledEmail(scheduledEmailBlock, participant); } return(true); }
protected override void OnInit(EventArgs e) { base.OnInit(e); Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1)); string idstring = Request.QueryString["participant"]; string email = Request.QueryString["email"]; string code = Request.QueryString["code"]; int id = 0; int.TryParse(idstring, out id); registration = AttendRegistrationEngine.GetParticipant(id); if (null == registration) { Response.Status = "404 Not Found"; Response.StatusCode = 404; Response.End(); } else { EventPageBase EventPageBaseData = EPiServer.DataFactory.Instance.GetPage(registration.EventPage) as EventPageBase; var file = ServiceLocator.Current.GetInstance <IContentRepository>().Get <MediaData>(EventPageBaseData.EventDetails.PdfTemplate); string pdfTemplateUrl = UrlResolver.Current.GetUrl(file.ContentLink); //string pdfTemplateUrl = EventPageBaseData.EventDetails.PdfTemplate; var filestream = file.BinaryData.OpenRead(); VirtualFile vf = HostingEnvironment.VirtualPathProvider.GetFile(pdfTemplateUrl); string physicalPath = ""; /* * UnifiedFile uf = vf as UnifiedFile; * if (null != uf) * physicalPath = uf.LocalPath; */ Response.ContentType = "application/pdf"; Response.AddHeader("Content-Disposition", String.Format("attachment; filename=EventDiploma_{0}.pdf", code)); PdfGenerator.Create(filestream, registration, EventPageBaseData, Response.OutputStream); Response.Flush(); Response.End(); } }
public static void PasteParticipantsMove(EventPageBase destination) { foreach (IParticipant participantBlock in GetOrCreateParticipantsClipboard()) { var participant = (participantBlock as ParticipantBlock).CreateWritableClone() as ParticipantBlock; participant.EventPage = (destination as IContent).ContentLink.ToPageReference(); ServiceLocator.Current.GetInstance <IContentRepository>() .Save(participant as IContent, SaveAction.Publish); Log.ParticipantLog.AddLogText("Move", "Moved from " + participantBlock.EventPage.ID + " to " + destination.ContentLink.ID, participant); ServiceLocator.Current.GetInstance <IContentRepository>() .Move((participantBlock as IContent).ContentLink, GetOrCreateParticipantsFolder(destination.ContentLink).ContentLink, AccessLevel.NoAccess, AccessLevel.NoAccess); } }
public static bool RegistrationOpen(ContentReference EventPageBase) { EventPageBase currentEvent = (ServiceLocator.Current.GetInstance <IContentRepository>().Get <EventPageBase>(EventPageBase)); if (currentEvent.EventDetails.RegistrationOpen == DateTime.MinValue) { return(true); } if (currentEvent.EventDetails.RegistrationOpen < DateTime.Now && (currentEvent.EventDetails.RegistrationClose > DateTime.Now || currentEvent.EventDetails.RegistrationClose == DateTime.MinValue)) { return(true); } return(false); }
public static SessionBlock GenerateSession(EventPageBase EventPageBase, string name, DateTime start, DateTime end) { var contentRepository = ServiceLocator.Current.GetInstance <IContentRepository>(); SessionBlock newSession = contentRepository.GetDefault <SessionBlock>(GetOrCreateSessionFolder(EventPageBase.ContentLink).ContentLink); newSession.Start = start; newSession.End = end; newSession.NumberOfSeats = EventPageBase.EventDetails.NumberOfSeats; newSession.EventPage = EventPageBase.ContentLink.ToPageReference(); IContent newSessionContent = newSession as IContent; newSessionContent.Name = name; contentRepository.Save(newSessionContent, EPiServer.DataAccess.SaveAction.Publish, EPiServer.Security.AccessLevel.NoAccess); return(newSession); }
public static EmailTemplate Load(EmailTemplateBlock template, EventPageBase EventPageBase, IParticipant participant) { EmailTemplate email = new EmailTemplate(); email.HtmlBody = PopulatePropertyValues(template.MainBody != null ? template.MainBody.ToString() : string.Empty, EventPageBase, participant); email.HtmlBody = RewriteUrls(email.HtmlBody, GetSiteUrl(EventPageBase)); email.Body = PopulatePropertyValues(template.MainTextBody, EventPageBase, participant); email.To = PopulatePropertyValues(template.To, EventPageBase, participant); email.From = PopulatePropertyValues(template.From, EventPageBase, participant); email.Cc = PopulatePropertyValues(template.CC, EventPageBase, participant); email.Bcc = PopulatePropertyValues(template.BCC, EventPageBase, participant); email.Subject = PopulatePropertyValues(template.Subject, EventPageBase, participant); email.Participant = participant; email.SendAsSms = template.SendAsSms; return(email); }
protected string GetProgressBar(EventPageBase eventPageBase) { if (eventPageBase.EventDetails.Cancelled == true) { return("<div class='progress-bar progress-bar-danger' style='width:100%;'></div>"); } if (ConfirmedParticipants() == 0) { return("<div class='progress-bar progress-bar-info' style='width:100%;'></div>"); } return (string.Format("<div class='progress-bar progress-bar-success' style='width:{0}%;'><div class='pull-right'>{1} </span></div></div>", Math.Round(((double)(ParticipatedParticipants()) / (double)ExpectedParticipants() * 100)), ParticipatedParticipants())); }
private void ConvertEmailTemplateToLocal(string sharedBlock, string localBlock) { EventPageBase currentEventPageBase = CurrentPage.CreateWritableClone() as EventPageBase; EmailTemplateBlock sharedBlockData = Locate.ContentRepository().Get <EmailTemplateBlock>((CurrentPage as EventPageBase)[sharedBlock] as ContentReference) as EmailTemplateBlock; EmailTemplateBlock localBlockData = currentEventPageBase[localBlock] as EmailTemplateBlock; localBlockData.BCC = sharedBlockData.BCC; localBlockData.CC = sharedBlockData.CC; localBlockData.From = sharedBlockData.From; localBlockData.MainBody = sharedBlockData.MainBody; localBlockData.MainTextBody = sharedBlockData.MainTextBody; localBlockData.Subject = sharedBlockData.Subject; localBlockData.To = sharedBlockData.To; currentEventPageBase[sharedBlock] = null; Locate.ContentRepository().Save(currentEventPageBase, SaveAction.Save | SaveAction.ForceCurrentVersion); this.Page.ClientScript.RegisterStartupScript(this.GetType(), "scriptid", "window.parent.location.href='" + EPiServer.Editor.PageEditing.GetEditUrl((currentEventPageBase as IContent).ContentLink) + "'", true); }
public static string PopulatePropertyValues(string template, EventPageBase EventPageBase, IParticipant participant) { if (template != null) { template = EmailTemplate.databindPattern.Replace(template, delegate(Match m) { string value = GetPropertyValue(m.Groups[1].Value, m.Groups[2].Value, EventPageBase, participant); if (!String.IsNullOrEmpty(value)) { value = EmailTemplate.xmlSafe.Replace(value, new MatchEvaluator(XmlSafe)); } return(value); }); } return(template); }
private void ExtractFieldNames(EventPageBase EventPageBase) { if (EventPageBase.RegistrationForm == null) { return; } XForm xform = XForm.CreateInstance(new Guid(EventPageBase.RegistrationForm.Id.ToString())); NameValueCollection formControls = xform.CreateFormData().GetValues(); foreach (string data in formControls) { if (!FieldsList.Contains(data)) { FieldsList.Add(data); } } }
protected string GetProgressBar(EventPageBase EventPageBase) { if (EventPageBase.EventDetails.Cancelled == true) { return("<div class='progress-bar progress-bar-danger' style='width:100%;'></div>"); } int numberOfSeats = BVNetwork.Attend.Business.API.AttendRegistrationEngine.GetNumberOfSeats(EventPageBase.PageLink); int availableSeats = BVNetwork.Attend.Business.API.AttendRegistrationEngine.GetAvailableSeats(EventPageBase.PageLink); if (availableSeats == 0) { return("<div class='progress-bar progress-bar-info' style='width:100%;'></div>"); } return (string.Format("<div class='progress-bar' style='width:{0}%;'><div class='pull-right'>{1} </span></div>", Math.Round(((double)(numberOfSeats - availableSeats) / (double)numberOfSeats) * 100), numberOfSeats - availableSeats)); }
protected void ImportBtn_Click(object sender, EventArgs e) { //PageData parent = EPiServer.DataFactory.Instance.Get<PageData>(); StatusLiteral.Text = ""; StatusLiteral.Text += "<h1>Import started</h1><br>"; EventPageBase ep = ServiceLocator.Current.GetInstance <IContentRepository>().Get <EventPageBase>(RootTextBox.PageLink); string participants = ParticipantsTextBox.Text; string[] participantStrings = participants.Split('\n'); if (participantStrings.Count() < 2) { return; } string[] keys = participantStrings[0].Split(';'); for (int i = 1; i < participantStrings.Count(); i++) { ImportParticipant(ep, participantStrings[i].Split(';'), keys); } }
protected void ImportParticipant(EventPageBase ep, string[] participantFields, string[] keys) { string email = ""; Hashtable fieldsHashtable = new Hashtable(); if (participantFields.Count() == keys.Count()) { for (int i = 0; i < keys.Count(); i++) { if (!fieldsHashtable.ContainsKey(keys[i])) { fieldsHashtable.Add(keys[i].ToLower(), participantFields[i]); } } } if (fieldsHashtable.ContainsKey("email")) { email = fieldsHashtable["email"].ToString(); } else { return; } if (string.IsNullOrEmpty(email)) { return; } XForm xform = ep.RegistrationForm; XFormData xFormData = xform.CreateFormData(); PopulateChildNodeRecursive(fieldsHashtable, xFormData.Data.ChildNodes); string xformstring = xFormData.Data.InnerXml; StatusLiteral.Text += "Adding participant: " + email + "<br/>"; AttendRegistrationEngine.GenerateParticipation(ep.ContentLink, email, false, xformstring, "Imported participant from text"); }
protected void previewRepeater_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e) { var propertyControl = e.Item.FindControl("Participants") as Repeater; EventPageBase EventPageBase = e.Item.DataItem as EventPageBase; if (EventPageBase != null) { propertyControl.DataSource = AttendRegistrationEngine.GetParticipants(EventPageBase.ContentLink).ToList(); propertyControl.DataBind(); //var eventDetailsControl = e.Item.FindControl("EventInfoProperty") as Property; //SetupPreviewPropertyControl(eventDetailsControl, EventPageBase); } //SetupPreviewPropertyControl(propertyControl, AttendRegistrationEngine.GetParticipants(EventPageBase.ContentLink).ToList()); }
public static void PasteParticipantsCopy(EventPageBase destination) { ///TODO: Rewrite /* * foreach (ParticipantBlock participantBlock in GetOrCreateParticipantsClipboard()) * { * * var newParticipant = ServiceLocator.Current.GetInstance<IContentRepository>() * .Copy((participantBlock as IContent).ContentLink, GetOrCreateParticipantsFolder(destination.ContentLink).ContentLink, AccessLevel.NoAccess, AccessLevel.NoAccess, true); * var participant = ServiceLocator.Current.GetInstance<IContentRepository>().Get<ParticipantBlock>(newParticipant).CreateWritableClone() as ParticipantBlock; * participant.Code = GenerateCode(); * participant.Comment = participant.Comment + "Copied from " + participantBlock.EventPageBase.ID; * participant.EventPageBase = (destination as IContent).ContentLink.ToPageReference(); * Log.ParticipantLog.AddLogText("Copy", "Copied from " + participantBlock.EventPageBase.ID + " to " + destination.ContentLink.ID, participant); * ServiceLocator.Current.GetInstance<IContentRepository>() * .Save(participant as IContent, SaveAction.Publish); * } * CopyParticipantsRemoveAll();*/ }
public static void CreateScheduledEmail(EventPageBase EventPageBase, AttendStatus status, EmailTemplateBlock emailTemplate, ContentReference emailTemplateContentReference, string name) { ScheduledEmailBlock emailBlock = API.AttendScheduledEmailEngine.GenerateScheduledEmailBlock(EventPageBase.ContentLink).CreateWritableClone() as ScheduledEmailBlock; emailBlock.EmailSendOptions = SendOptions.Action; emailBlock.SendOnStatus = status; emailBlock.EmailTemplate.BCC = emailTemplate.BCC; emailBlock.EmailTemplate.CC = emailTemplate.CC; emailBlock.EmailTemplate.From = emailTemplate.From; emailBlock.EmailTemplate.To = emailTemplate.To; emailBlock.EmailTemplate.Subject = emailTemplate.Subject; emailBlock.EmailTemplate.MainBody = emailTemplate.MainBody; emailBlock.EmailTemplate.MainTextBody = emailTemplate.MainTextBody; emailBlock.EmailTemplateContentReference = emailTemplateContentReference; (emailBlock as IContent).Name = name; DataFactory.Instance.Save(emailBlock as IContent, SaveAction.Publish); }
public static string GetAvailableSeatsText(EventPageBase EventPageBase) { int available = GetAvailableSeats(EventPageBase.ContentLink); if (available > 3 && !string.IsNullOrEmpty(EventPageBase.AvailableSeatsText.ManyAvailableSeats)) { return(string.Format(EventPageBase.AvailableSeatsText.ManyAvailableSeats, available)); } if (available == 3) { return(EventPageBase.AvailableSeatsText.ThreeSeats); } if (available == 2) { return(EventPageBase.AvailableSeatsText.TwoSeats); } if (available == 1) { return(EventPageBase.AvailableSeatsText.OneSeat); } return(string.Empty); }
public static IEnumerable <ScheduledEmailBlock> GetScheduledEmails(EventPageBase EventPageBase) { return(from e in GetAllEmails(EventPageBase.ContentLink) where (e.EmailSendOptions == SendOptions.Specific || e.EmailSendOptions == SendOptions.Relative) select e); }
public static void ProcessForm(NameValueCollection rawFormData, FormContainerBlock formBlock, Submission submissionData) { string eventPageIds = rawFormData[__AttendEvent]; string participantEmail = rawFormData[__AttendParticipantEmail]; string participantCode = rawFormData[__AttendParticipantCode]; List <string> eventPages = null; if (string.IsNullOrEmpty(eventPageIds)) // Not an Attend form - exit form processing. { return; } if (eventPageIds.Split(',').Length > 1) { eventPages = eventPageIds.Split(',').ToList <string>(); } else { eventPages = new List <string>() { eventPageIds } }; SetPrivatePropertyValue <PropertyData>(false, "IsReadOnly", formBlock.Property["SubmitSuccessMessage"]); NameValueCollection nvc = FormParser.ParseForm(submissionData, formBlock); StringBuilder message = new StringBuilder(); StringBuilder codes = new StringBuilder(); foreach (string eventPageId in eventPages) { ContentReference eventPage = new ContentReference(eventPageId).ToPageReference(); EventPageBase eventPageBase = ServiceLocator.Current.GetInstance <IContentRepository>().Get <EventPageBase>(eventPage); if (eventPages.Count > 1) { message.Append("<strong>" + eventPageBase.Name + "</strong><br/>"); } IParticipant participant = null; if (!string.IsNullOrEmpty(participantCode) && !string.IsNullOrEmpty(participantEmail)) { participant = BVNetwork.Attend.Business.API.AttendRegistrationEngine.GetParticipant(participantEmail, participantCode); participant = FormParser.UpdateParticipation(participant, nvc); } if (participant == null) { participant = FormParser.GenerateParticipation(eventPage, nvc); } if (participant.AttendStatus == AttendStatus.Confirmed.ToString()) { if (eventPageBase.CompleteContentXhtml != null) { message.Append(eventPageBase.CompleteContentXhtml.ToHtmlString()); } else { message.Append(EPiServer.Framework.Localization.LocalizationService.Current.GetString("/eventRegistrationPage/confirmed")); } } if (participant.AttendStatus == AttendStatus.Submitted.ToString()) { if (eventPageBase.SubmittedContentXhtml != null) { message.Append(eventPageBase.SubmittedContentXhtml.ToHtmlString()); } else { message.Append(EPiServer.Framework.Localization.LocalizationService.Current.GetString("/eventRegistrationPage/submitted")); } } if (message.Length == 0) { message.Append(EPiServer.Framework.Localization.LocalizationService.Current.GetString("/eventRegistrationPage/error")); } message.Append("<br/><br/>"); codes.Append(participant.Code + ","); } if (formBlock.RedirectToPage != null) { SetPrivatePropertyValue <PropertyData>(false, "IsReadOnly", formBlock.Property["RedirectToPage"]); Url redirectUrl = new Url(formBlock.RedirectToPage.Uri.ToString() + "?code=" + codes.ToString() + "&eventPageID=" + eventPageIds); formBlock.RedirectToPage = redirectUrl; } formBlock.SubmitSuccessMessage = new XhtmlString(message.ToString()); }
public static void Create(Stream template, IParticipant registration, EventPageBase pageData, System.IO.Stream outputStream) { try { PdfReader pr = new PdfReader(template); PdfStamper ps = new PdfStamper(pr, outputStream); AcroFields fields = ps.AcroFields; foreach (string fieldName in fields.Fields.Keys) { string objectName; string propertyName; Match m = databindPattern.Match(fieldName); if (!m.Success) { objectName = "CurrentRegistration"; propertyName = fieldName; } else { objectName = m.Groups[1].Value; propertyName = m.Groups[2].Value; } if (0 == String.Compare("CurrentRegistration", objectName, true)) { if (!string.IsNullOrEmpty(pageData.EventDetails[propertyName] as string)) { fields.SetField(fieldName, pageData.EventDetails[propertyName] as string); } if (!string.IsNullOrEmpty(pageData[propertyName] as string)) { fields.SetField(fieldName, pageData[propertyName] as string); } if (!string.IsNullOrEmpty(AttendRegistrationEngine.GetParticipantInfo(registration, propertyName) as string)) { fields.SetField(fieldName, AttendRegistrationEngine.GetParticipantInfo(registration, propertyName) as string); } } else if (0 == String.Compare(objectName, "CurrentPage", true)) { if (0 == String.Compare(propertyName, "PageLinkUrl", true)) { string linkUrl = pageData.LinkURL; UrlBuilder ub = new UrlBuilder(linkUrl); Global.UrlRewriteProvider.ConvertToExternal(ub, pageData.PageLink, System.Text.Encoding.UTF8); fields.SetField(fieldName, ub.ToString()); } else { if (pageData.EventDetails.Property[propertyName] != null && !string.IsNullOrEmpty(pageData.EventDetails.Property[propertyName].ToString())) { fields.SetField(fieldName, pageData.EventDetails[propertyName] as string); } else { fields.SetField(fieldName, pageData.Property[propertyName].ToString()); } } } else { // unrecognized ObjectName, simply set "" fields.SetField(fieldName, ""); } } ps.FormFlattening = true; ps.Close(); } catch (Exception) { } }
protected static string GetPropertyValue(string objectName, string propertyName, EventPageBase CurrentEvent, IParticipant CurrentParticipant) { object value = null; if (0 == String.Compare("CurrentPage", objectName, true)) { if (0 == String.Compare(propertyName, "PageLinkUrl", true)) { string linkUrl = CurrentEvent.LinkURL; UrlBuilder ub = new UrlBuilder(linkUrl); Global.UrlRewriteProvider.ConvertToExternal(ub, CurrentEvent.PageLink, System.Text.Encoding.UTF8); value = ub.ToString(); } else { value = CurrentEvent.Property[propertyName]; if (value == null) { value = CurrentEvent.EventDetails.Property[propertyName]; } } } else if (0 == String.Compare("CurrentRegistration", objectName, true)) { value = AttendRegistrationEngine.GetParticipantInfo(CurrentParticipant, propertyName); } if (null == value) { return(""); } else { return(value.ToString()); } }
public static DateTime GetSendDate(ScheduledEmailBlock scheduledEmailBlock, EventPageBase EventPageBase) { DateTime dateToSend = DateTime.Now; bool subtract = false; if (scheduledEmailBlock.EmailSendOptions == SendOptions.Specific) { return(scheduledEmailBlock.SpecificDateScheduled); } if (scheduledEmailBlock.EmailSendOptions == SendOptions.Relative) { switch (scheduledEmailBlock.ScheduledRelativeTo) { case RelativeTo.AfterEventStart: subtract = false; dateToSend = EventPageBase.EventDetails.EventStart; break; case RelativeTo.BeforeEventStart: subtract = true; dateToSend = EventPageBase.EventDetails.EventStart; break; case RelativeTo.AfterStartPublish: subtract = false; dateToSend = EventPageBase.StartPublish; break; case RelativeTo.BeforeStartPublish: subtract = true; dateToSend = EventPageBase.StartPublish; break; } int amount = scheduledEmailBlock.ScheduledRelativeAmount; if (subtract) { amount = amount * -1; } switch (scheduledEmailBlock.ScheduledRelativeUnit) { case RelativeUnit.Days: dateToSend = dateToSend.AddDays(amount); break; case RelativeUnit.Hours: dateToSend = dateToSend.AddHours(amount); break; case RelativeUnit.Minutes: dateToSend = dateToSend.AddMinutes(amount); break; case RelativeUnit.Months: dateToSend = dateToSend.AddMonths(amount); break; } return(dateToSend); } return(DateTime.MaxValue); }
public static IEnumerable <ScheduledEmailBlock> GetScheduledEmailsToSend(EventPageBase eventPageBase) { return(GetScheduledEmailsToSend(eventPageBase, DateTime.MinValue, DateTime.Now)); }