示例#1
0
        private void PopulateParticipants()
        {
            List <IParticipant> participants = EPiServer.CacheManager.Get("participants-" + FromDateTime.ToString() + ToDateTime.ToString()) as List <IParticipant>;

            FieldsList = EPiServer.CacheManager.Get("fieldnames-" + FromDateTime.ToString() + ToDateTime.ToString()) as List <String>;
            if (participants == null)
            {
                FieldsList = new List <string>();

                var events = ParticipantProviderManager.Provider.GetEventPages();
                participants = new List <IParticipant>();
                foreach (PageData EventPageBaseData in (events))
                {
                    if ((EventPageBaseData as EventPageBase).EventDetails.EventEnd <= ToDateTime &&
                        (EventPageBaseData as EventPageBase).EventDetails.EventStart >= FromDateTime)
                    {
                        ExtractFieldNames(EventPageBaseData as EventPageBase);
                        foreach (var participant in AttendRegistrationEngine.GetParticipants(EventPageBaseData.ContentLink))
                        {
                            participants.Add(participant as IParticipant);
                        }
                    }
                }
                EPiServer.CacheManager.Insert("fieldnames-" + FromDateTime.ToString() + ToDateTime.ToString(), FieldsList);
                EPiServer.CacheManager.Insert("participants-" + FromDateTime.ToString() + ToDateTime.ToString(), participants);
            }
            participants     = (from p in participants orderby p.DateSubmitted descending select p).ToList();
            ParticipantsList = participants;
            SetupPreviewPropertyControl(ParticipantsList);
        }
示例#2
0
        protected void UnRegisterParticipantButton_Command(object sender, CommandEventArgs e)
        {
            string[]     participantInfo = e.CommandArgument.ToString().Split(',');
            IParticipant participant     = AttendRegistrationEngine.GetParticipant(participantInfo[0], participantInfo[1]);

            RegisterParticipant(participant, true);
        }
 protected void SelectCheckBox_OnCheckedChanged(object sender, EventArgs e)
 {
     if ((sender as CheckBox).Checked)
     {
         AttendRegistrationEngine.CopyParticipants(CurrentData);
     }
 }
示例#4
0
        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);
        }
示例#5
0
        protected void AttendButton_Click(object sender, EventArgs e)
        {
            IParticipant participant;

            if (!string.IsNullOrEmpty(HiddenEmail.Value))
            {
                participant = AttendRegistrationEngine.GetParticipant(HiddenEmail.Value, HiddenCode.Value);
                if (participant != null)
                {
                    participant = (participant as ParticipantBlock).CreateWritableClone() as ParticipantBlock;
                }
            }

            else
            {
                string participantEmail = "";
                foreach (var fragment in DetailsXFormControl.ExtractXFormControls())
                {
                    if (fragment.ID == "epost" || fragment.ID == "email")
                    {
                        participantEmail = fragment.Value;
                    }
                }


                if (string.IsNullOrEmpty(participantEmail) || Business.Email.Validation.IsEmail(participantEmail) == false)
                {
                    return;
                }

                participant = AttendRegistrationEngine.GenerateParticipation(CurrentData.ContentLink, participantEmail, true, DetailsXFormControl.Data.Data.OuterXml, "Participant submitted form");
            }
            if (participant != null)
            {
                participant.XForm    = DetailsXFormControl.Data.Data.OuterXml;
                participant.Sessions = new ContentArea();
                foreach (ContentReference item in GetChosenSessions())
                {
                    participant.Sessions.Items.Add(new ContentAreaItem()
                    {
                        ContentLink = item
                    });
                }
                Locate.ContentRepository().Save(participant as IContent, EPiServer.DataAccess.SaveAction.Publish, EPiServer.Security.AccessLevel.NoAccess);
                string propertyName = "";
                if (participant.AttendStatus == AttendStatus.Confirmed.ToString())
                {
                    propertyName = "CompleteContent";
                }
                if (participant.AttendStatus == AttendStatus.Submitted.ToString())
                {
                    propertyName = "SubmittedContent";
                }
                ContentProperty.PropertyName = propertyName;
                ContentProperty.DataBind();
                DetailsXFormControl.Visible = false;
                AttendButton.Visible        = false;
            }
        }
 protected void ChangeStatus_Click(object sender, EventArgs e)
 {
     if (StatusDropDown.SelectedIndex > 0)
     {
         AttendRegistrationEngine.CopyParticipantsChangeStatus(StatusDropDown.SelectedValue, StatusMailCheckBox.Checked);
     }
     System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "scriptid", "window.parent.location.href='" + EPiServer.Editor.PageEditing.GetEditUrl((CurrentPage as IContent).ContentLink) + "'", true);
 }
示例#7
0
        protected void CreateParticipant(string participantString, ContentReference EventPageBase)
        {
            IParticipant NewParticipant = null;

            foreach (string ParticipantData in DelimitContent(participantString, "[PARTICIPANTFIELDDELIMITER]"))
            {
                string[] ParticipantDataValues = DelimitContent(ParticipantData, "[PARTICIPANTVALUEDELIMITER]");
                switch (ParticipantDataValues[0])
                {
                case "Email":
                    NewParticipant = AttendRegistrationEngine.GenerateParticipation(EventPageBase, ParticipantDataValues[1], false, string.Empty, "Imported participant");
                    break;
                }
            }
            if (NewParticipant != null)
            {
                StatusLiteral.Text += "<br><ul>";
                foreach (string ParticipantData in DelimitContent(participantString, "[PARTICIPANTFIELDDELIMITER]"))
                {
                    string[] ParticipantDataValues = DelimitContent(ParticipantData, "[PARTICIPANTVALUEDELIMITER]");
                    if (ParticipantDataValues.Length > 1)
                    {
                        string dataKey   = ParticipantDataValues[0];
                        string dataValue = ParticipantDataValues[1];

                        StatusLiteral.Text += "<li>" + dataKey + ": " + dataValue + "</li>";
                        switch (ParticipantDataValues[0])
                        {
                        case "Email":
                            break;

                        case "Status":
                            NewParticipant.AttendStatus = dataValue;
                            break;

                        case "XForm":
                            NewParticipant.XForm = dataValue;
                            break;

                        case "Code":
                            NewParticipant.Code = dataValue;
                            break;

                        case "Submitted":
                            NewParticipant.DateSubmitted = GetDateSafe(dataValue);
                            break;

                        case "Username":
                            NewParticipant.Username = dataValue;
                            break;
                        }
                    }
                }

                StatusLiteral.Text += "</ul>";
                EPiServer.DataFactory.Instance.Save(NewParticipant as IContent, EPiServer.DataAccess.SaveAction.Publish);
            }
        }
示例#8
0
        protected void RegisterByCodeButton_Click(object sender, EventArgs e)
        {
            string       code        = TextBoxBarCode.Text;
            IParticipant participant = AttendRegistrationEngine.GetParticipant(code);

            RegisterParticipant(participant);
            TextBoxBarCode.Text = "";
            TextBoxBarCode.Focus();
        }
示例#9
0
        protected void RegisterAllParticipantsButton_Click(object sender, EventArgs e)
        {
            IEnumerable <IParticipant> allConfirmed = AttendRegistrationEngine.GetParticipants(CurrentEvent.ContentLink, Business.Text.AttendStatus.Confirmed);

            foreach (IParticipant participant in allConfirmed)
            {
                RegisterParticipant(AttendRegistrationEngine.GetParticipant(participant.Code), false);
            }
            AddStatusText("All participants registered!");
        }
        protected override void OnDataBinding(EventArgs e)
        {
            int numberOfCopied = AttendRegistrationEngine.GetOrCreateParticipantsClipboard().Count;

            CopyMovePlaceHolder.Visible = numberOfCopied > 0;
            CopyMovePlaceHolder.DataBind();
            SelectedRepeater.DataSource = AttendRegistrationEngine.GetOrCreateParticipantsClipboard();
            SelectedRepeater.DataBind();
            base.OnDataBinding(e);
        }
        protected void DeleteParticipantsCopy_OnClick(object sender, EventArgs e)
        {
            foreach (IParticipant IParticipant in AttendRegistrationEngine.GetOrCreateParticipantsClipboard())
            {
                ServiceLocator.Current.GetInstance <IContentRepository>().Delete((IParticipant as IContent).ContentLink, true, AccessLevel.NoAccess);
            }

            AttendRegistrationEngine.CopyParticipantsRemoveAll();
            System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "scriptid", "window.parent.location.href='" + EPiServer.Editor.PageEditing.GetEditUrl((CurrentPage as IContent).ContentLink) + "'", true);
        }
示例#12
0
        private string GetParticipantData(IParticipant participant)
        {
            string data = participant.Email + ";" + participant.Code + ";" + participant.AttendStatus + ";";
            NameValueCollection formfields = AttendRegistrationEngine.GetFormData(participant);

            foreach (var key in formfields.AllKeys)
            {
                data += formfields.Get(key) + ";";
            }
            return(data);
        }
        protected void Copy_OnClick(object sender, EventArgs e)
        {
            if (IsChecked())
            {
                AttendRegistrationEngine.CopyParticipantsRemove(CurrentData);
            }
            else
            {
                AttendRegistrationEngine.CopyParticipants(CurrentData);
            }

            Copy.DataBind();
        }
示例#14
0
        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) ?? "&nbsp;");
                }
            }
            return(fieldsList);
        }
示例#15
0
        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();
            }
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            Participants           = AttendRegistrationEngine.GetParticipants(CurrentPage.ContentLink).ToList();
            NoParticipants.Visible = !(Participants.Count <IParticipant>() > 0);
            Sessions = AttendSessionEngine.GetSessions(CurrentPage.ContentLink).ToList();

            PopulateStatusDropDown();
            PopulateEMailDropDown();
            PopulateSessionDropDown();

            DeleteParticipantsCopy.OnClientClick = "return confirm('" + DeleteConfirmation() + "');";

            NoParticipants.DataBind();
        }
示例#17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string propertyName = "DetailsContent";

            if (AttendRegistrationEngine.GetNumberOfSeats(CurrentData.ContentLink) < 1)
            {
                propertyName = "NoSeatsContent";
            }
            if (AttendRegistrationEngine.RegistrationOpen(CurrentData.ContentLink) == false)
            {
                propertyName = "ClosedContent";
            }
            ContentProperty.PropertyName = propertyName;
        }
        protected void CreateParticipant_Click(object sender, EventArgs e)
        {
            IParticipant newParticipant = null;

            EmailPlaceHolder.Visible = false;
            if (Business.Email.Validation.IsEmail(EMailTextBox.Text) == false)
            {
                EmailPlaceHolder.Visible = true;
            }
            else
            {
                newParticipant = AttendRegistrationEngine.GenerateParticipation(CurrentPage.ContentLink, EMailTextBox.Text, string.Empty);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "scriptid", "window.parent.location.href='" + EPiServer.Editor.PageEditing.GetEditUrl((newParticipant as IContent).ContentLink) + "'", true);
            }
        }
示例#19
0
        private EventRegistrationModel CreateEventRegistrationModel(EventPageBase currentPage, string contentLink)
        {
            var model               = new EventRegistrationModel(currentPage);
            var repository          = ServiceLocator.Current.GetInstance <IContentLoader>();
            var localizationService = ServiceLocator.Current.GetInstance <LocalizationService>();

            var           pageRouteHelper = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance <EPiServer.Web.Routing.PageRouteHelper>();
            PageReference currentPageLink = pageRouteHelper.PageLink;

            model.HostPageData   = pageRouteHelper.Page;
            model.EventPageBase  = currentPage;
            model.Sessions       = BVNetwork.Attend.Business.API.AttendSessionEngine.GetSessionsList(model.EventPageBase.PageLink);
            model.AvailableSeats = AttendRegistrationEngine.GetAvailableSeats(model.EventPageBase.PageLink);
            model.PriceText      = model.EventPageBase.EventDetails.Price > 0 ? model.EventPageBase.EventDetails.Price + " " + localizationService.GetString("/eventRegistrationTemplate/norwegianCurrencey") : localizationService.GetString("/eventRegistrationTemplate/freeOfCharge");
            return(model);
        }
示例#20
0
        public static List <IParticipant> GetRegistrations(string email)
        {
            List <IParticipant> participations = new List <IParticipant>();
            var registrations = from r in RegistrationDataStore.Items <Registration>()
                                where r.Email == email
                                select r;

            foreach (Registration r in registrations)
            {
                IParticipant p = AttendRegistrationEngine.GetParticipant(r.ParticipantBlock);
                if (p != null)
                {
                    participations.Add(p);
                }
            }
            return(participations);
        }
示例#21
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");
        }
示例#22
0
        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());
        }
示例#23
0
        protected string GetClass(PageData EventPageBase)
        {
            if ((EventPageBase as EventPageBase).EventDetails.Cancelled == true)
            {
                return("event-cancelled");
            }
            if ((EventPageBase as EventPageBase).EventDetails.Private)
            {
                return("event-private");
            }
            int participants = AttendRegistrationEngine.GetNumberOfParticipants(EventPageBase.ContentLink);

            if (participants == 0)
            {
                return("event-empty");
            }
            int seats = AttendRegistrationEngine.GetNumberOfSeats(EventPageBase.ContentLink);

            if (seats > 0)
            {
                if (participants >= seats)
                {
                    return("event-full");
                }
                if (((double)participants / (double)seats) > 0.7)
                {
                    return("event-many");
                }
                if (((double)participants / (double)seats) > 0.4)
                {
                    return("event-some");
                }
                if (((double)participants / (double)seats) > 0)
                {
                    return("event-few");
                }
            }
            return("event-unknown");
        }
示例#24
0
        private void RegisterParticipant(IParticipant participant, bool unregister)
        {
            if (participant != null)
            {
                if (unregister)
                {
                    participant.AttendStatus = Attend.Business.Text.AttendStatus.Confirmed.ToString();
                }
                else
                {
                    participant.AttendStatus = Attend.Business.Text.AttendStatus.Participated.ToString();
                }

                AttendRegistrationEngine.SaveParticipant(participant);
                AddStatusText(string.Format("Participant {0} with code {1} is now unregistered.", participant.Email, participant.Code));
            }
            else
            {
                AddStatusText(string.Format("ERROR REGISTERING PARTICIPANT"));
            }
            DataBindTables();
        }
示例#25
0
        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());
            }
        }
示例#26
0
        protected string GetAvailableSeatsText()
        {
            int available = AttendRegistrationEngine.GetAvailableSeats(CurrentPage.ContentLink);

            if (available > 3 && !string.IsNullOrEmpty(CurrentData.ManyAvailableSeats))
            {
                return(string.Format(CurrentData.ManyAvailableSeats, available));
            }
            if (available == 3)
            {
                return(CurrentData.ThreeSeats);
            }
            if (available == 2)
            {
                return(CurrentData.TwoSeats);
            }
            if (available == 1)
            {
                return(CurrentData.OneSeat);
            }
            return(string.Empty);
        }
        protected void CheckAll_OnClick(object sender, EventArgs e)
        {
            int numberOfCopied = AttendRegistrationEngine.GetOrCreateParticipantsClipboard().Count;

            if (numberOfCopied > 0)
            {
                AttendRegistrationEngine.CopyParticipantsRemoveAll();
            }
            if (numberOfCopied == 0)
            {
                List <IParticipant> contents = Participants;
                contents = FilterStatus(contents);
                contents = FilterEmail(contents);
                contents = FilterSessions(contents);
                contents = FilterSearch(contents);

                foreach (var IParticipant in contents)
                {
                    AttendRegistrationEngine.CopyParticipants(IParticipant as IParticipant);
                }
            }
        }
示例#28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IEnumerable <IParticipant> participants = AttendRegistrationEngine.GetParticipants(new EPiServer.Core.ContentReference(HttpContext.Current.Request.QueryString["EventPageBase"]));

            string attachment = "attachment; filename=ParticipantList.csv";

            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.ClearHeaders();
            HttpContext.Current.Response.ClearContent();
            HttpContext.Current.Response.AddHeader("content-disposition", attachment);
            HttpContext.Current.Response.ContentType = "text/csv";
            HttpContext.Current.Response.AddHeader("Attend", "public");

            var sb = new StringBuilder();

            foreach (var participant in participants)
            {
                sb.AppendLine(GetParticipantData(participant));
            }

            HttpContext.Current.Response.Write(sb.ToString());
            HttpContext.Current.Response.End();
        }
示例#29
0
        protected void SearchEvents()
        {
            var events = ParticipantProviderManager.Provider.GetEventPages();


            var upcomingEvents = (from PageData p in events orderby((EventPageBase)p).EventDetails.EventStart where ((EventPageBase)p).EventDetails.EventStart >= FromDateTime && ((EventPageBase)p).EventDetails.EventEnd <= ToDateTime select p);
            List <IParticipant> participants = new List <IParticipant>();

            foreach (PageData EventPageBaseData in upcomingEvents)
            {
                if ((EventPageBaseData as EventPageBase).EventDetails.EventEnd <= ToDateTime &&
                    (EventPageBaseData as EventPageBase).EventDetails.EventStart >= FromDateTime)
                {
                    //ExtractFieldNames(EventPageBaseData as EventPageBase);
                    foreach (var participant in AttendRegistrationEngine.GetParticipants(EventPageBaseData.ContentLink))
                    {
                        participants.Add(participant as IParticipant);
                    }
                }
            }
            Participants = participants;
            (AttendInvoiceList as Attend.Admin.Partials.InvoiceList).ParticipantList = participants;
            AttendInvoiceList.DataBind();
        }
示例#30
0
        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);
        }