public void Save(object value, System.IO.Stream s) { SerializableXmlDocument doc; if (value is SerializableXmlDocument) { doc = value as SerializableXmlDocument; } else { doc = new SerializableXmlDocument(); doc.LoadXml((value as XmlDocument).InnerXml); // FIXME: very inefficient. Common.Warning(typeof(XmlLoadableFactory), "Unefficient saving of object, " + "try using SerializableXmlDocument instead of XmlDocument."); } try { doc.Save(s); } catch (Exception e) { Common.WarningFormatted(typeof(XmlLoadableFactory), "Could not save Xml document to stream '{0}': {1}", s, e); throw; } }
protected override void OnInit(EventArgs e) { DetailsXFormControl.FormDefinition = XForm.CreateInstance(new Guid((CurrentData as EventPageBase).RegistrationForm.Id.ToString())); string email = Request.QueryString["email"]; string code = Request.QueryString["code"]; HiddenCode.Value = code; HiddenEmail.Value = email; if (!string.IsNullOrEmpty(email) && !string.IsNullOrEmpty(code)) { IParticipant participant = AttendRegistrationEngine.GetParticipant(email, code); if (participant != null) { SerializableXmlDocument xmlDoc = new SerializableXmlDocument(); xmlDoc.LoadXml(participant.XForm); DetailsXFormControl.Data.Data = xmlDoc; } } SessionsPanel.Controls.Add(AttendSessionEngine.GetSessionsControl(CurrentData.ContentLink, null)); SessionsPanel.DataBind(); base.OnInit(e); }
protected void PopulateForm() { if (!string.IsNullOrEmpty(CurrentData.XForm)) { SerializableXmlDocument xmlDoc = new SerializableXmlDocument(); xmlDoc.LoadXml(CurrentData.XForm); DetailsXFormControl.Data.Data = xmlDoc; } }
public static NameValueCollection GetFormData(IParticipant participant) { NameValueCollection _formControls = new NameValueCollection(); if (participant.XForm != null) { SerializableXmlDocument xmlDoc = new SerializableXmlDocument(); xmlDoc.LoadXml(participant.XForm); XFormData data = new XFormData(); data.Data = xmlDoc; NameValueCollection formControls = data.GetValues(); _formControls = formControls; } return(_formControls); }
public static string GetParticipantInfo(IParticipant participant, string propertyname) { if (participant == null) return string.Empty; { if (String.IsNullOrEmpty(propertyname)) return String.Empty; propertyname = propertyname.ToLower(); switch (propertyname) { case "editurl": var internalUrl = UrlResolver.Current.GetUrl(participant.EventPage); UrlBuilder relativeUrl = new UrlBuilder(internalUrl); Global.UrlRewriteProvider.ConvertToExternal(relativeUrl, null, System.Text.Encoding.UTF8); string url = UriSupport.AbsoluteUrlBySettings(relativeUrl.ToString()); url = EPiServer.UriSupport.AddQueryString(url, "code", participant.Code); url = EPiServer.UriSupport.AddQueryString(url, "email", participant.Email); return url; case "username": return participant.Username; case "registrationcode": return participant.Code; case "email": return participant.Email; case "price": return participant.Price.ToString(); case "eventname": case "coursename": return DataFactory.Instance.Get<EventPageBase>(participant.EventPage).Name; case "submitted": return participant.DateSubmitted.ToString("yyyy-MM-dd HH:mm"); case "status": return participant.AttendStatus.ToString(); case "fullname": return GetParticipantInfo(participant, "FirstName") + " " + GetParticipantInfo(participant, "LastName"); case "datestring": return GetEventDates(participant.EventPage); case "coursedatestring": return string.Format(LocalizationService.Current.GetString("/attend/diploma/datetext"), GetEventDates(participant.EventPage)); default: { try { SerializableXmlDocument xmlDoc = new SerializableXmlDocument(); xmlDoc.LoadXml(participant.XForm); foreach (XmlNode formNode in xmlDoc.SelectNodes("instance/*")) { if (propertyname == formNode.Name.ToLower()) return formNode.InnerText; } } catch (Exception) { } } break; } return String.Empty; } }
public static NameValueCollection GetFormData(IParticipant participant) { NameValueCollection _formControls = new NameValueCollection(); if (participant.XForm != null) { SerializableXmlDocument xmlDoc = new SerializableXmlDocument(); xmlDoc.LoadXml(participant.XForm); XFormData data = new XFormData(); data.Data = xmlDoc; NameValueCollection formControls = data.GetValues(); _formControls = formControls; } return _formControls; }
public static string GetParticipantInfo(IParticipant participant, string propertyname) { if (participant == null) { return(string.Empty); } { if (String.IsNullOrEmpty(propertyname)) { return(String.Empty); } propertyname = propertyname.ToLower(); switch (propertyname) { case "editurl": var internalUrl = UrlResolver.Current.GetUrl(participant.EventPage); UrlBuilder relativeUrl = new UrlBuilder(internalUrl); Global.UrlRewriteProvider.ConvertToExternal(relativeUrl, null, System.Text.Encoding.UTF8); string url = UriSupport.AbsoluteUrlBySettings(relativeUrl.ToString()); url = EPiServer.UriSupport.AddQueryString(url, "code", participant.Code); url = EPiServer.UriSupport.AddQueryString(url, "email", participant.Email); return(url); case "username": return(participant.Username); case "registrationcode": return(participant.Code); case "email": return(participant.Email); case "price": return(participant.Price.ToString()); case "eventname": case "coursename": return(DataFactory.Instance.Get <EventPageBase>(participant.EventPage).Name); case "submitted": return(participant.DateSubmitted.ToString("yyyy-MM-dd HH:mm")); case "status": return(participant.AttendStatus.ToString()); case "fullname": return(GetParticipantInfo(participant, "FirstName") + " " + GetParticipantInfo(participant, "LastName")); case "datestring": return(GetEventDates(participant.EventPage)); case "coursedatestring": return(string.Format(LocalizationService.Current.GetString("/attend/diploma/datetext"), GetEventDates(participant.EventPage))); default: { try { SerializableXmlDocument xmlDoc = new SerializableXmlDocument(); xmlDoc.LoadXml(participant.XForm); foreach (XmlNode formNode in xmlDoc.SelectNodes("instance/*")) { if (propertyname == formNode.Name.Replace('_', ' ').ToLower()) { return(formNode.InnerText); } } foreach (XmlNode formNode in xmlDoc.SelectNodes("FormData/*")) { if (propertyname == formNode.Name.ToLower()) { return(formNode.InnerText); } } } catch (Exception) { } } break; } return(String.Empty); } }