private void PopulateOptions()
        {
            ParleyOptions options = ParleyOptions.ForParley(_parley);

            string spacer = string.Empty;

            for (int loop = 0; loop < options.Count; loop++)
            {
                spacer += "&nbsp;<br/>";
            }

            this.LiteralOptionsSpacer.Text = spacer;

            string currencyCode = _parley.Organization.DefaultCountry.Currency.Code;

            CheckBox boxAttendance = new CheckBox();

            boxAttendance.Text    = "Attendance, " + currencyCode + " " + (_parley.AttendanceFeeCents / 100).ToString();
            boxAttendance.Checked = true;
            boxAttendance.Enabled = false;
            boxAttendance.ID      = "CheckOptionAttendance";

            this.PlaceholderOptions.Controls.Add(boxAttendance);

            this.PlaceholderOptions.Controls.Add(GetLiteral("&nbsp;<br/>"));

            foreach (ParleyOption option in options)
            {
                CheckBox boxOption = new CheckBox();
                boxOption.Text = option.Description + ", " + currencyCode + " " + (option.AmountCents / 100).ToString();
                boxOption.ID   = "CheckOption" + option.Identity.ToString();
                this.PlaceholderOptions.Controls.Add(boxOption);
                this.PlaceholderOptions.Controls.Add(GetLiteral("&nbsp;<br/>"));
            }
        }
        protected void ButtonSignup_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                return; // no action
            }

            // Sign up this attendee, and create event to send confirmation mail

            ParleyAttendee newAttendee = _parley.CreateAttendee(this.TextNameFirst.Text, this.TextNameLast.Text, this.TextEmail.Text, false);

            // Add options

            ParleyOptions options = _parley.Options;

            foreach (ParleyOption option in options)
            {
                CheckBox checkOption = (CheckBox)this.PlaceholderOptions.FindControl("CheckOption" + option.Identity.ToString());
                if (checkOption.Checked)
                {
                    newAttendee.AddOption(option);
                }
            }

            PWEvents.CreateEvent(EventSource.SignupPage, EventType.ParleyAttendeeCreated, newAttendee.PersonId,
                                 _parley.OrganizationId, _parley.GeographyId, newAttendee.PersonId, newAttendee.Identity,
                                 string.Empty);

            if (Request.UserLanguages.Length > 0)
            {
                newAttendee.Person.PreferredCulture = Request.UserLanguages[0];
            }

            this.PanelSignupCompleted.Visible = true;
            this.PanelSignup.Visible          = false;
        }
Exemple #3
0
        private void CreateDynamicControls()
        {
            this.PlaceHolderSummary.Controls.Clear();
            this.PlaceHolderGuests.Controls.Clear();

            string tableStart =
                "<table border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"100%\" style=\"line-height:120%\">";

            this.PlaceHolderSummary.Controls.Add(GetLiteral(tableStart));
            this.PlaceHolderGuests.Controls.Add(GetLiteral(tableStart));

            ParleyAttendees attendees     = _parley.Attendees;
            ParleyOptions   parleyOptions = _parley.Options;

            int activeAttendeeCount = 0;

            Dictionary <int, int> optionLookup = new Dictionary <int, int>();

            foreach (ParleyAttendee attendee in attendees)
            {
                if (attendee.Active)
                {
                    activeAttendeeCount++;

                    bool paid = false;

                    if (attendee.Invoiced && attendee.Invoice.Open == false)
                    {
                        paid = true;
                    }

                    this.PlaceHolderGuests.Controls.Add(
                        GetTableRow(new string[] { attendee.Person.Name, paid ? "ok" : "--" }));

                    ParleyOptions attendeeOptions = attendee.Options;
                    foreach (ParleyOption attendeeOption in attendeeOptions)
                    {
                        if (!optionLookup.ContainsKey(attendeeOption.Identity))
                        {
                            optionLookup[attendeeOption.Identity] = 0;
                        }

                        optionLookup[attendeeOption.Identity]++;
                    }
                }
            }

            this.PlaceHolderSummary.Controls.Add(GetTableRow(new string[] { "Attendees", activeAttendeeCount.ToString() }));


            this.PlaceHolderGuests.Controls.Add(GetLiteral("</table>"));

            foreach (ParleyOption parleyOption in parleyOptions)
            {
                if (optionLookup.ContainsKey(parleyOption.Identity))
                {
                    this.PlaceHolderSummary.Controls.Add(GetTableRow(new string[] { parleyOption.Description, optionLookup[parleyOption.Identity].ToString() }));
                }
                else
                {
                    this.PlaceHolderSummary.Controls.Add(GetTableRow(new string[] { parleyOption.Description, "0" }));
                }
            }

            this.PlaceHolderSummary.Controls.Add(GetLiteral("</table>"));
        }