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
                });
            }
        }
예제 #2
0
        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);
                }
            }
        }
예제 #3
0
        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");
        }
예제 #4
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            UnifiedFile selectedFile = FileManager.SingleSelectedFile;

            // Init the XForm.
            SerializableXmlDocument rawFile = new SerializableXmlDocument();
            VirtualFile             vf      = HostingEnvironment.VirtualPathProvider.GetFile(selectedFile.Parent.CustomFileSummaryVirtualPath);

            using (Stream stream = vf.Open())
            {
                rawFile.Load(stream);
            }
            XForm form = new XForm();

            form.Document = rawFile;
            _data         = form.CreateFormData();

            // Populate the XForm.
            IDictionary dict = selectedFile.Summary.Dictionary;

            foreach (DictionaryEntry entry in dict)
            {
                if (entry.Value != null)
                {
                    _data.SetValue(entry.Key.ToString(), entry.Value.ToString());
                }
            }
            XFormCtrl.Data           = _data;
            XFormCtrl.FormDefinition = form;

            if (!FileSystemUtility.CanEdit(selectedFile))
            {
                SaveButton.Enabled = false;
                Page.Validators.Add(new StaticValidator(Translate("/filemanager/errormessage/cannotchange")));
            }
        }