public XAuth()
 {
     Test = new Clickable("ctl00_cphDialog_xAuth_btnTest", LocateBy.Id);
     OK = new Clickable("ctl00_cphDialog_saveForm", LocateBy.Id);
     ServiceEndpointURL = new Input("ctl00_cphDialog_xAuth_txtEndpointUrl", LocateBy.Id);
     MessageToRegistration = new Input("ctl00_cphDialog_xAuth_txtMessageToRegistrant", LocateBy.Id);
     TestEmail = new Input("ctl00_cphDialog_xAuth_txtTestEmailAddress", LocateBy.Id);
     TestUserName = new Input("ctl00_cphDialog_xAuth_txtTestUserName", LocateBy.Id);
     TestPassword = new Input("ctl00_cphDialog_xAuth_txtTestPassword", LocateBy.Id);
     DescriptionForIdentifer = new Input("ctl00_cphDialog_xAuth_txtLabel", LocateBy.Id);
     ForgetPasswordUrl = new Input("ctl00_cphDialog_xAuth_txtForgetPasswordUrl", LocateBy.Id);
     TestSuccessMessage = new Label("ctl00_cphDialog_xAuth_lblSuccessMessage", LocateBy.Id);
     ValidateMemberRequirePassword = new CheckBox("ctl00_cphDialog_xAuth_chkPassword", LocateBy.Id);
     ValidateMemberByUserName = new RadioButton("ctl00_cphDialog_xAuth_rdoMembership", LocateBy.Id);
     ValidateMemberByEmail = new RadioButton("ctl00_cphDialog_xAuth_rdoEmail", LocateBy.Id);
     ErrorDIVLocator = new ElementBase("//div[@id='ctl00_cphDialog_xAuth_xAuthValSummary']", LocateBy.XPath);
 }
        public void PerformDefaultActions_Agenda(Registrant reg)
        {
            foreach (CustomFieldResponse responses in reg.CustomField_Responses)
            {
                if (responses is AgendaResponse)
                {
                    AgendaResponse response = responses as AgendaResponse;

                    switch (response.AgendaItem.Type)
                    {
                        case FormData.CustomFieldType.AlwaysSelected:
                            {
                                AgendaResponse_AlwaysSelected resp = response as AgendaResponse_AlwaysSelected;
                                AgendaRow row = PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem(response.AgendaItem);

                                if (resp.Code != null)
                                {
                                    row.DiscountCodeInput.Type(resp.Code.CodeString);
                                }
                            }
                            break;

                        case FormData.CustomFieldType.CheckBox:
                            {
                                AgendaResponse_Checkbox resp = response as AgendaResponse_Checkbox;
                                AgendaRow row = PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem(response.AgendaItem);
                                ((CheckBox)row.AgendaType).Set(resp.Checked.Value);

                                if (resp.Code != null)
                                {
                                    row.DiscountCodeInput.Type(resp.Code.CodeString);
                                }
                            }
                            break;

                        case FormData.CustomFieldType.RadioButton:
                            {
                                AgendaResponse_MultipleChoice_RadioButton resp = response as AgendaResponse_MultipleChoice_RadioButton;
                                Label choiceItemLabel = new Label(string.Format("//*[contains(text(),'{0}')]", resp.ChoiceItem.Name), LocateBy.XPath);
                                resp.ChoiceItem.Id = Convert.ToInt32(choiceItemLabel.GetAttribute("for"));
                                RadioButton radio = new RadioButton(resp.ChoiceItem.Id.ToString(), LocateBy.Id);
                                radio.Click();

                                AgendaRow row = PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem(response.AgendaItem);

                                if (resp.Code != null)
                                {
                                    row.DiscountCodeInput.Type(resp.Code.CodeString);
                                }
                            }
                            break;

                        case FormData.CustomFieldType.Dropdown:
                            {
                                AgendaResponse_MultipleChoice_DropDown resp = response as AgendaResponse_MultipleChoice_DropDown;

                                AgendaRow row = PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem(response.AgendaItem);

                                ((MultiChoiceDropdown)row.AgendaType).SelectWithText(resp.ChoiceItem.Name);

                                if (resp.Code != null)
                                {
                                    row.DiscountCodeInput.Type(resp.Code.CodeString);
                                }
                            }
                            break;

                        case FormData.CustomFieldType.Number:
                        case FormData.CustomFieldType.OneLineText:
                        case FormData.CustomFieldType.Paragraph:
                            {
                                AgendaResponse_TextInput resp = response as AgendaResponse_TextInput;
                                ((Input)PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem(
                                    response.AgendaItem).AgendaType).Type(resp.CharToInput);
                            }
                            break;

                        case FormData.CustomFieldType.Contribution:
                            {
                                AgendaResponse_Contribution resp = response as AgendaResponse_Contribution;
                                ((Input)PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem(
                                    response.AgendaItem).AgendaType).Type(resp.ContributionAmount);
                            }
                            break;

                        case FormData.CustomFieldType.Date:
                            {
                                AgendaResponse_Date resp = response as AgendaResponse_Date;
                                string date = string.Format("{0}/{1}/{2}", resp.Date.Value.Month, resp.Date.Value.Day, resp.Date.Value.Year);
                                ((Input)PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem(
                                    response.AgendaItem).AgendaType).Type(date);
                            }
                            break;

                        case FormData.CustomFieldType.Time:
                            {
                                AgendaResponse_Time resp = response as AgendaResponse_Time;
                                string time = string.Format("{0}:{1}", resp.Time.Value.Hour, resp.Time.Value.Minute);
                                ((Input)PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem(
                                    response.AgendaItem).AgendaType).Type(time);
                            }
                            break;

                        case FormData.CustomFieldType.FileUpload:
                            {
                                AgendaResponse_FileUpload resp = response as AgendaResponse_FileUpload;
                                ((Clickable)PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem(
                                    response.AgendaItem).AgendaType).Click();
                                AutoIt.UploadFile.UploadAFile("File Upload", resp.FileSource);
                            }
                            break;

                        case FormData.CustomFieldType.Duration:
                            {
                                AgendaResponse_Duration resp = response as AgendaResponse_Duration;
                                ((Input)PageObject.PageObjectProvider.Register.RegistationSite.Agenda.GetAgendaItem(response.AgendaItem).AgendaType).Type(resp.Duration.ToString("c"));
                            }
                            break;

                        default:
                            throw new InvalidOperationException(string.Format("No action defined for specified type of agenda item: {0}", response.AgendaItem.Type.ToString()));
                    }
                }
            }
        }