protected List <string> GetFormFields(IParticipant participant) { List <string> fieldsList = new List <string>(); foreach (ListItem checkBox in FormFieldsCheckBoxList.Items) { if (checkBox.Selected) { fieldsList.Add(AttendRegistrationEngine.GetParticipantInfo(participant, checkBox.Value) ?? " "); } } return(fieldsList); }
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()); } }
private static string GetParticipantData(IParticipant participant, List <string> formFields) { string data = participant.AttendStatus.ToString() + ";" + participant.Email + ";" + participant.Code + ";"; NameValueCollection allFormFields = AttendRegistrationEngine.GetFormData(participant); if (formFields == null) { foreach (var key in allFormFields.AllKeys) { data += allFormFields.Get(key).Replace(System.Environment.NewLine, ", ") + ";"; } } else { foreach (string formField in formFields) { if (!string.IsNullOrEmpty(formField)) { data += AttendRegistrationEngine.GetParticipantInfo(participant, formField).Replace(System.Environment.NewLine, ", ") + ";"; } } } return(data); }
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 string GetFormData(IParticipant participant, string fieldname) { return(AttendRegistrationEngine.GetParticipantInfo(participant, fieldname)); }