public void GroupEventFeeGroupDiscount()
        {
            Event groupEventFeeGroupDiscount = new Event("RI-GroupEventFeeGroupDiscount");
            GroupDiscount groupDiscount = new GroupDiscount();
            groupDiscount.GroupSize = 2;
            groupDiscount.GroupSizeOption = GroupDiscount_GroupSizeOption.SizeOrMore;
            groupDiscount.DiscountAmount = 1;
            groupDiscount.GroupDiscountType = GroupDiscount_DiscountType.USDollar;
            groupDiscount.AddtionalRegOption = GroupDiscount_AdditionalRegOption.AnyAdditional;
            groupEventFeeGroupDiscount.StartPage.GroupDiscount = groupDiscount;
            RegType regType = new RegType("First");
            regType.Price = 50;
            groupEventFeeGroupDiscount.StartPage.RegTypes.Add(regType);
            PaymentMethod paymentMethod = new PaymentMethod(FormData.PaymentMethod.Check);
            groupEventFeeGroupDiscount.CheckoutPage.PaymentMethods.Add(paymentMethod);

            KeywordProvider.SignIn.SignInAndRecreateEventAndGetEventId(EventFolders.Folders.RegistrationInventory, groupEventFeeGroupDiscount);

            Registrant reg1 = new Registrant(groupEventFeeGroupDiscount);
            reg1.EventFee_Response = new EventFeeResponse(groupEventFeeGroupDiscount.StartPage.RegTypes[0]);
            reg1.Payment_Method = paymentMethod;
            Registrant reg2 = new Registrant(groupEventFeeGroupDiscount);
            reg1.EventFee_Response = new EventFeeResponse(groupEventFeeGroupDiscount.StartPage.RegTypes[0]);
            Group group = new Group();
            group.Primary = reg1;
            group.Secondaries.Add(reg2);

            KeywordProvider.RegistrationCreation.GroupRegistration(group);
        }
        public void Add_GroupDiscount(Event evt, GroupDiscount groupDiscount)
        {
            KeywordProvider.ManagerDefault.OpenFormDashboard(evt.Id);
            PageObjectProvider.Manager.Dashboard.EventDetails.EditForm_Click();
            PageObjectProvider.Builder.EventDetails.FormPages.StartPage.AddGroupDiscount_Click();
            PageObjectProvider.Builder.EventDetails.FormPages.StartPage.GroupDiscountDefine.SelectByName();

            PageObjectProvider.Builder.EventDetails.FormPages.StartPage.GroupDiscountDefine.GroupSize.Type(groupDiscount.GroupSize);
            PageObjectProvider.Builder.EventDetails.FormPages.StartPage.GroupDiscountDefine.GroupSizeOption.SelectWithText(
                CustomStringAttribute.GetCustomString(groupDiscount.GroupSizeOption));
            PageObjectProvider.Builder.EventDetails.FormPages.StartPage.GroupDiscountDefine.DiscountAmount.Type(groupDiscount.DiscountAmount);
            PageObjectProvider.Builder.EventDetails.FormPages.StartPage.GroupDiscountDefine.DiscountType.SelectWithText(
                CustomStringAttribute.GetCustomString(groupDiscount.GroupDiscountType));

            if ((groupDiscount.GroupSizeOption == GroupDiscount_GroupSizeOption.JustSize) && groupDiscount.AddtionalRegOption.HasValue)
            {
                PageObjectProvider.Builder.EventDetails.FormPages.StartPage.GroupDiscountDefine.AddtionalRegOption.SelectWithText(
                    CustomStringAttribute.GetCustomString(groupDiscount.AddtionalRegOption.Value));

                if ((groupDiscount.AddtionalRegOption.Value == GroupDiscount_AdditionalRegOption.Additional)
                    && (groupDiscount.NumberOfAdditionalReg.HasValue))
                {
                    PageObjectProvider.Builder.EventDetails.FormPages.StartPage.GroupDiscountDefine.AdditionalNumber.Type(
                        groupDiscount.NumberOfAdditionalReg.Value);
                }
            }

            PageObjectProvider.Builder.EventDetails.FormPages.StartPage.GroupDiscountDefine.ApplyToSelectedFees_Click();

            if ((groupDiscount.ApplyToAgendaItems.Count != 0) || (groupDiscount.ApplyToRegTypes.Count != 0))
            {
                PageObjectProvider.Builder.EventDetails.FormPages.StartPage.GroupDiscountDefine.All.Set(false);

                if (groupDiscount.ApplyToAgendaItems.Count != 0)
                {
                    foreach (AgendaItem agenda in groupDiscount.ApplyToAgendaItems)
                    {
                        PageObjectProvider.Builder.EventDetails.FormPages.StartPage.GroupDiscountDefine.ApplyToAgendaItem(agenda).Set(true);
                    }
                }

                if (groupDiscount.ApplyToRegTypes.Count != 0)
                {
                    foreach (RegType regType in groupDiscount.ApplyToRegTypes)
                    {
                        PageObjectProvider.Builder.EventDetails.FormPages.StartPage.GroupDiscountDefine.ApplyToRegType(regType).Set(true);
                    }
                }
            }

            PageObjectProvider.Builder.EventDetails.FormPages.StartPage.GroupDiscountDefine.SaveAndClose_Click();
            PageObjectProvider.Builder.EventDetails.SaveAndClose_Click();
            PageObjectProvider.Manager.Dashboard.ReturnToList_Click();
        }
        public void ApplyToSelectedFee()
        {
            GroupDiscount groupDiscount = new GroupDiscount();
            groupDiscount.GroupSize = 2;
            groupDiscount.GroupSizeOption = GroupDiscount_GroupSizeOption.SizeOrMore;
            groupDiscount.DiscountAmount = 10;
            groupDiscount.GroupDiscountType = GroupDiscount_DiscountType.Percent;
            groupDiscount.ApplyToAgendaItems.Add(agenda1);
            groupDiscount.ApplyToRegTypes.Add(regType1);

            this.CreateEventAndAddGroupDiscount(groupDiscount, "GroupDiscount-ApplyToSelected");

            this.GroupRegistrationAndVerifyTotal(this.GenerateGroup(3));
        }
        public void RegistrationWithEventFeeGroupDiscount()
        {
            Event eventWithFeeGroupDiscount = new Event("RI-SingleRegistrationWithEventFeeGroupDiscount");
            RegType regType = new RegType("First");
            regType.Price = 50;
            eventWithFeeGroupDiscount.StartPage.RegTypes.Add(regType);
            GroupDiscount GroupDiscount = new GroupDiscount();
            GroupDiscount.GroupSize = 2;
            GroupDiscount.GroupSizeOption = GroupDiscount_GroupSizeOption.SizeOrMore;
            GroupDiscount.DiscountAmount = 1;
            GroupDiscount.GroupDiscountType = GroupDiscount_DiscountType.USDollar;
            GroupDiscount.AddtionalRegOption = GroupDiscount_AdditionalRegOption.AnyAdditional;
            eventWithFeeGroupDiscount.StartPage.GroupDiscount = GroupDiscount;

            KeywordProvider.SignIn.SignInAndRecreateEventAndGetEventId(EventFolders.Folders.RegistrationInventory, eventWithFeeGroupDiscount);

            Registrant registrant = new Registrant(eventWithFeeGroupDiscount);
            registrant.EventFee_Response = new EventFeeResponse(eventWithFeeGroupDiscount.StartPage.RegTypes[0]);

            KeywordProvider.RegistrationCreation.Checkin(registrant);

            AssertHelper.VerifyOnPage(FormData.RegisterPage.PersonalInfo, true);
        }
        public void ChangeDiscount()
        {
            GroupDiscount groupDiscount = new GroupDiscount();
            groupDiscount.GroupSize = 2;
            groupDiscount.GroupSizeOption = GroupDiscount_GroupSizeOption.SizeOrMore;
            groupDiscount.DiscountAmount = 50;
            groupDiscount.GroupDiscountType = GroupDiscount_DiscountType.Percent;

            this.CreateEventAndAddGroupDiscount(groupDiscount, "GroupDiscount-Change", true);
            Group group = this.GenerateGroup(2);
            this.GroupRegistrationAndVerifyTotal(group);

            KeywordProvider.SignIn.SignIn(EventFolders.Folders.RegistrationInventory);

            GroupDiscount groupDiscount2 = new GroupDiscount();
            groupDiscount2.GroupSize = 2;
            groupDiscount2.GroupSizeOption = GroupDiscount_GroupSizeOption.SizeOrMore;
            groupDiscount2.DiscountAmount = 10;
            groupDiscount2.GroupDiscountType = GroupDiscount_DiscountType.Percent;

            KeywordProvider.AddGroupDiscount.Add_GroupDiscount(evt1, groupDiscount2);

            Registrant reg = new Registrant(evt1);
            reg.Payment_Method = paymentMethod;
            reg.EventFee_Response = resp1;
            reg.CustomField_Responses.Add(resp4);
            group.Secondaries.Add(reg);

            KeywordProvider.RegistrationCreation.Checkin(group.Primary);
            KeywordProvider.RegistrationCreation.Login(group.Primary);
            PageObject.PageObjectProvider.Register.RegistationSite.AddAnotherPerson_Click();
            PageObject.PageObjectProvider.Register.RegistationSite.Checkin.EmailAddress.Type(reg.Email);
            PageObject.PageObjectProvider.Register.RegistationSite.Checkin.SelectRegTypeRadioButton(reg.EventFee_Response.RegType);
            PageObject.PageObjectProvider.Register.RegistationSite.Continue_Click();
            KeywordProvider.RegistrationCreation.PersonalInfo(reg);
            KeywordProvider.RegistrationCreation.Agenda(reg);
            PageObject.PageObjectProvider.Register.RegistationSite.Continue_Click();
            KeywordProvider.RegistrationCreation.Checkout(reg);

            Assert.AreEqual(KeywordProvider.RegisterDefault.GetTotal(FormData.RegisterPage.Confirmation),
                KeywordProvider.CalculateFee.CalculateTotalFee(group));

            PageObject.PageObjectProvider.Register.RegistationSite.Confirmation.ChangeMyRegistration_Click();
            KeywordProvider.RegistrationCreation.Login(group.Primary);
            PageObject.PageObjectProvider.Register.RegistationSite.AttendeeCheck.Cancel_Click(1);
            PageObject.PageObjectProvider.Register.RegistationSite.AttendeeCheck.OK_Click();
            PageObject.PageObjectProvider.Register.RegistationSite.AttendeeCheck.Cancel_Click(2);
            PageObject.PageObjectProvider.Register.RegistationSite.AttendeeCheck.OK_Click();
            PageObject.PageObjectProvider.Register.RegistationSite.Continue_Click();
            PageObject.PageObjectProvider.Register.RegistationSite.Continue_Click();
            KeywordProvider.RegistrationCreation.Checkout(group.Primary);

            Group group1 = this.GenerateGroup(2);
            group1.Primary.Email = group.Primary.Email;

            evt1.StartPage.GroupDiscount = groupDiscount2;

            PageObject.PageObjectProvider.Register.RegistationSite.Confirmation.ChangeMyRegistration_Click();
            KeywordProvider.RegistrationCreation.Login(group1.Primary);
            PageObject.PageObjectProvider.Register.RegistationSite.AddAnotherPerson_Click();
            PageObject.PageObjectProvider.Register.RegistationSite.Checkin.EmailAddress.Type(group1.Secondaries[0].Email);
            PageObject.PageObjectProvider.Register.RegistationSite.Checkin.SelectRegTypeRadioButton(group1.Secondaries[0].EventFee_Response.RegType);
            PageObject.PageObjectProvider.Register.RegistationSite.Continue_Click();
            KeywordProvider.RegistrationCreation.PersonalInfo(group1.Secondaries[0]);
            KeywordProvider.RegistrationCreation.Agenda(group1.Secondaries[0]);
            PageObject.PageObjectProvider.Register.RegistationSite.Continue_Click();
            KeywordProvider.RegistrationCreation.Checkout(group1.Primary);

            Assert.AreEqual(KeywordProvider.RegisterDefault.GetTotal(FormData.RegisterPage.Confirmation),
                KeywordProvider.CalculateFee.CalculateTotalFee(group1));

            this.GroupRegistrationAndVerifyTotal(this.GenerateGroup(3));
        }
        private void CreateEventAndAddGroupDiscount(GroupDiscount groupDiscount, string eventName, bool recreate = false)
        {
            this.evt1 = new Event(eventName);
            this.evt1.CheckoutPage.PaymentMethods.Add(this.paymentMethod);
            this.regType1.Price = 20;
            this.regType2.Price = 30;
            this.evt1.StartPage.RegTypes.Add(this.regType1);
            this.evt1.StartPage.RegTypes.Add(this.regType2);
            this.evt1.StartPage.GroupDiscount = groupDiscount;
            this.evt1.AgendaPage = new AgendaPage();
            this.agenda1.Price = 40;
            this.agenda2.Price = 50;
            this.evt1.AgendaPage.AgendaItems.Add(this.agenda1);
            this.evt1.AgendaPage.AgendaItems.Add(this.agenda2);
            this.evt1.MerchandisePage = new MerchandisePage();
            merch1.Type = FormData.MerchandiseType.Fixed;
            merch1.Price = 60;
            merch2.Type = FormData.MerchandiseType.Variable;
            merch2.MinPrice = 65;
            merch2.MaxPrice = 100;
            this.evt1.MerchandisePage.Merchandises.Add(this.merch1);
            this.evt1.MerchandisePage.Merchandises.Add(this.merch2);

            KeywordProvider.SignIn.SignInAndRecreateEventAndGetEventId(EventFolders.Folders.RegistrationInventory, evt1, recreate);
        }
        public void ShowAndApply()
        {
            GroupDiscount groupDiscount = new GroupDiscount();
            groupDiscount.GroupSize = 2;
            groupDiscount.GroupSizeOption = GroupDiscount_GroupSizeOption.SizeOrMore;
            groupDiscount.DiscountAmount = 50;
            groupDiscount.GroupDiscountType = GroupDiscount_DiscountType.Percent;
            groupDiscount.ShowAndApply = false;

            this.CreateEventAndAddGroupDiscount(groupDiscount, "GroupDiscount-ShowApply");

            this.GroupRegistrationAndVerifyTotal(this.GenerateGroup(3));
            this.GroupRegistrationAndVerifyTotal(this.GenerateGroup(4));
        }
        public void OrMore()
        {
            GroupDiscount groupDiscount = new GroupDiscount();
            groupDiscount.GroupSize = 2;
            groupDiscount.GroupSizeOption = GroupDiscount_GroupSizeOption.SizeOrMore;
            groupDiscount.DiscountAmount = 10;
            groupDiscount.GroupDiscountType = GroupDiscount_DiscountType.Percent;

            this.CreateEventAndAddGroupDiscount(groupDiscount, "GroupDiscount-OrMore");

            this.GroupRegistrationAndVerifyTotal(this.GenerateGroup(3));
        }
        public void JustSizeAndAnyAdditional()
        {
            GroupDiscount groupDiscount = new GroupDiscount();
            groupDiscount.GroupSize = 2;
            groupDiscount.GroupSizeOption = GroupDiscount_GroupSizeOption.JustSize;
            groupDiscount.DiscountAmount = 5;
            groupDiscount.GroupDiscountType = GroupDiscount_DiscountType.USDollar;
            groupDiscount.AddtionalRegOption = GroupDiscount_AdditionalRegOption.AnyAdditional;

            this.CreateEventAndAddGroupDiscount(groupDiscount, "GroupDiscount-AnyAdditional");

            this.GroupRegistrationAndVerifyTotal(this.GenerateGroup(3));
            this.GroupRegistrationAndVerifyTotal(this.GenerateGroup(4));
        }
        public void JustSizeAndAdditional()
        {
            GroupDiscount groupDiscount = new GroupDiscount();
            groupDiscount.GroupSize = 2;
            groupDiscount.GroupSizeOption = GroupDiscount_GroupSizeOption.JustSize;
            groupDiscount.DiscountAmount = 10;
            groupDiscount.GroupDiscountType = GroupDiscount_DiscountType.Percent;
            groupDiscount.AddtionalRegOption = GroupDiscount_AdditionalRegOption.Additional;
            groupDiscount.NumberOfAdditionalReg = 1;

            this.CreateEventAndAddGroupDiscount(groupDiscount , "GroupDiscount-Additional");

            this.GroupRegistrationAndVerifyTotal(this.GenerateGroup(3));
            this.GroupRegistrationAndVerifyTotal(this.GenerateGroup(4));
        }