예제 #1
0
        public RouteModel CompleteRegistration(OnlineRegController ctl)
        {
            HistoryAdd("CompleteRegistration");

            var ret = CheckSpecialJavascript();

            if (ret != null)
            {
                return(ret);
            }

            ret = CheckAskDonation(ctl);
            if (ret != null)
            {
                return(ret);
            }

            if (List.Count == 0)
            {
                return(RouteModel.ErrorMessage("Can't find any registrants"));
            }

            RemoveLastRegistrantIfEmpty();

            UpdateDatum();

            ret = CheckNoFeesDue();
            if (ret != null)
            {
                return(ret);
            }

            var terms = Util.PickFirst(Terms, "");

            if (terms.HasValue())
            {
                ctl.ViewBag.Terms = terms;
            }

            ret = CheckTermsNoFee(ctl);
            if (ret != null)
            {
                return(ret);
            }

            ret = CheckAlreadyRegistered();
            if (ret != null)
            {
                return(ret);
            }

            var pf = PaymentForm.CreatePaymentForm(this);

#if DEBUG2
            pf.CheckTesting();
#endif
            Log("PaymentForm");
            ctl.ModelState.Clear();
            return(RouteModel.ViewPayment("Payment/Process", pf));
        }
예제 #2
0
        private bool IsCardTester(PaymentForm pf, string from)
        {
            if (!Util.IsHosted || !pf.CreditCard.HasValue())
            {
                return(false);
            }
            var hash = Pbkdf2Hasher.HashString(pf.CreditCard);
            var db   = DbUtil.Db;

            db.InsertIpLog(HttpContext.Current.Request.UserHostAddress, hash);

            if (pf.IsProblemUser())
            {
                return(OnlineRegController.LogRogueUser("Problem User", from));
            }
            var iscardtester = ConfigurationManager.AppSettings["IsCardTester"];

            if (!iscardtester.HasValue())
            {
                return(false);
            }
            var result = db.Connection.ExecuteScalar <string>(iscardtester, new { ip = HttpContext.Current.Request.UserHostAddress });

            if (result.Equal("OK"))
            {
                return(false);
            }
            return(OnlineRegController.LogRogueUser(result, from));
        }
예제 #3
0
        public void GetCouplesBothList_Should_Pull_Proper_HoHPeopleID()
        {
            /* Excel export should pull proper Head of Household PeopleID*/
            var requestManager  = FakeRequestManager.Create();
            var db              = requestManager.CurrentDatabase;
            var controller      = new OnlineRegController(requestManager);
            var routeDataValues = new Dictionary <string, string> {
                { "controller", "OnlineReg" }
            };

            controller.ControllerContext = ControllerTestUtils.FakeControllerContext(controller, routeDataValues);

            var m       = OrganizationModel.Create(db, requestManager.CurrentUser);
            var FakeOrg = FakeOrganizationUtils.MakeFakeOrganization(requestManager);
            var oid     = FakeOrg.org.OrganizationId;

            m.OrgId = oid;
            var wife = CreateUser(RandomString(), RandomString());

            //Create family and then Execute GetCouplesBothList to see if the right HeadOfHouseHoldId is retrieved...
            var p                = CreateFakeFamily(oid, m, controller);
            var mailingModel     = new MailingController(requestManager);
            var ExcelCouplesBoth = mailingModel.GetCouplesBothList(m.QueryId, 500);

            FakeOrganizationUtils.DeleteOrg(FakeOrg.org.OrganizationId);
            RemoveFakePeopleFromDB(ToPeople(ExcelCouplesBoth), db);
        }
예제 #4
0
 private RouteModel CheckTermsNoFee(OnlineRegController ctl)
 {
     ctl.SetHeaders(this);
     if (PayAmount() == 0 && Terms.HasValue())
     {
         Log("ViewTerms");
         return(RouteModel.ViewTerms("Other/Terms"));
     }
     return(null);
 }
예제 #5
0
 private RouteModel CheckAskDonation(OnlineRegController ctl)
 {
     if (AskDonation() && !donor.HasValue && donation > 0)
     {
         ctl.SetHeaders(this);
         ctl.ModelState.AddModelError("donation",
                                      "Please indicate a donor or clear the donation amount");
         Log("AskDonation");
         return(RouteModel.ViewAction("Other/AskDonation"));
     }
     return(null);
 }
예제 #6
0
        private List <Person> CreateFakeFamily(int oid, OrganizationModel om, OnlineRegController orc)
        {
            var family = new List <Person>();

            var husband = CreateFamilyMember(GenderCode.Male, MaritalStatusCode.Married, PositionInFamily.PrimaryAdult);
            var orm     = FakeOrganizationUtils.GetFakeOnlineRegModel(oid, husband.UserId);
            var resultSubmitQuestions      = orc.SubmitQuestions(0, orm);
            var resultCompleteRegistration = orc.CompleteRegistration(orm);

            family.Add(husband.Person);

            var wife = CreateFamilyMember(GenderCode.Female, MaritalStatusCode.Married, PositionInFamily.PrimaryAdult, husband.Person.Family);

            orm = FakeOrganizationUtils.GetFakeOnlineRegModel(oid, wife.UserId);
            resultSubmitQuestions      = orc.SubmitQuestions(0, orm);
            resultCompleteRegistration = orc.CompleteRegistration(orm);
            family.Add(wife.Person);

            var child1 = CreateFamilyMember(GenderCode.Female, MaritalStatusCode.Single, PositionInFamily.Child, husband.Person.Family);

            orm = FakeOrganizationUtils.GetFakeOnlineRegModel(oid, child1.UserId);
            resultSubmitQuestions      = orc.SubmitQuestions(0, orm);
            resultCompleteRegistration = orc.CompleteRegistration(orm);
            family.Add(child1.Person);

            var child2 = CreateFamilyMember(GenderCode.Male, MaritalStatusCode.Single, PositionInFamily.Child, husband.Person.Family);

            orm = FakeOrganizationUtils.GetFakeOnlineRegModel(oid, child2.UserId);
            resultSubmitQuestions      = orc.SubmitQuestions(0, orm);
            resultCompleteRegistration = orc.CompleteRegistration(orm);
            family.Add(child2.Person);

            var secAdult = CreateFamilyMember(GenderCode.Male, MaritalStatusCode.Single, PositionInFamily.SecondaryAdult, husband.Person.Family);

            orm = FakeOrganizationUtils.GetFakeOnlineRegModel(oid, secAdult.UserId);
            resultSubmitQuestions      = orc.SubmitQuestions(0, orm);
            resultCompleteRegistration = orc.CompleteRegistration(orm);
            family.Add(secAdult.Person);

            return(family);
        }
예제 #7
0
        public void Application_Export_Should_Pull_HoHPeopleID()
        {
            var requestManager  = FakeRequestManager.Create();
            var db              = requestManager.CurrentDatabase;
            var controller      = new OnlineRegController(requestManager);
            var routeDataValues = new Dictionary <string, string> {
                { "controller", "OnlineReg" }
            };

            controller.ControllerContext = ControllerTestUtils.FakeControllerContext(controller, routeDataValues);

            var m       = OrganizationModel.Create(db, requestManager.CurrentUser);
            var FakeOrg = FakeOrganizationUtils.MakeFakeOrganization(requestManager);
            var oid     = FakeOrg.org.OrganizationId;

            m.OrgId = oid;
            var wife = CreateUser(RandomString(), RandomString());

            username = RandomString();
            password = RandomString();
            string roleName = "role_" + RandomString();
            var    user     = CreateUser(username, password, roles: new string[] { "Access", "Edit", "Admin", "Membership" });

            Login();

            //Create family and then Execute GetCouplesBothList to see if the right HeadOfHouseHoldId is retrieved...
            var p                = CreateFakeFamily(oid, m, controller);
            var mailingModel     = new MailingController(requestManager);
            var ExcelCouplesBoth = mailingModel.GetCouplesBothList(m.QueryId, 500);

            //assert

            //Finalize
            FakeOrganizationUtils.DeleteOrg(FakeOrg.org.OrganizationId);
            RemoveFakePeopleFromDB(ToPeople(ExcelCouplesBoth), db);
            Logout();
        }