Beispiel #1
0
        public NextSection AddGuardianPartnerDetails(RelationDetails guardianPartnerDetails)
        {
            Validate(guardianPartnerDetails);

            GuardianPartnerDetails = guardianPartnerDetails;
            return(OnSectionCompleted(Sections.GuardianPartnerDetails));
        }
Beispiel #2
0
        public NextSection AddPartnerDetails(RelationDetails partnerDetails)
        {
            partnerDetails.RelationshipToApplicant = "Partner";

            Validate(partnerDetails);

            PartnerDetails = partnerDetails;
            return(OnSectionCompleted(Sections.PartnerDetails));
        }
Beispiel #3
0
 private ActionResult GuardianPartnerDetails_Render(string formId, RelationDetails details)
 {
     return(NavigableView <RelationDetailsModel>(formId, BsgViews.RelationDetails, Sections.GuardianPartnerDetails, (m, f) =>
     {
         m.Title = BsgText.GuardianPartnerDetailsTitle();
         m.Heading = BsgText.GuardianPartnerDetailsHeading();
         m.RelationDetails = details ?? f.GuardianPartnerDetails;
     }));
 }
Beispiel #4
0
 private ActionResult PartnerDetails_Render(string formId, RelationDetails details)
 {
     return(NavigableView <RelationDetailsModel>(formId, BsgViews.RelationDetails, Sections.PartnerDetails, (m, f) =>
     {
         m.Title = BsgText.PartnerDetailsTitle();
         m.Heading = BsgText.PartnerDetailsHeading();
         m.HideRelationship = true;
         m.RelationDetails = details ?? f.PartnerDetails;
         m.InheritedAddress = f.ApplicantDetails?.CurrentAddress;
     }));
 }
Beispiel #5
0
        public ActionResult GuardianPartnerDetails(string id, RelationDetails guardianPartnerDetails)
        {
            var cmd = new AddGuardianPartnerDetails
            {
                FormId = id,
                GuardianPartnerDetails = guardianPartnerDetails,
            };

            return(Exec(cmd,
                        success: next => RedirectNext(next),
                        failure: () => GuardianPartnerDetails_Render(id, guardianPartnerDetails)));
        }
Beispiel #6
0
        public ActionResult PartnerDetails(string id, RelationDetails partnerDetails)
        {
            var cmd = new AddPartnerDetails
            {
                FormId         = id,
                PartnerDetails = partnerDetails,
            };

            return(Exec(cmd,
                        success: next => RedirectNext(next),
                        failure: () => PartnerDetails_Render(id, partnerDetails)));
        }
        public void CopyTo_CoversAllDetails()
        {
            var src  = RelationDetailsBuilder.NewValid();
            var dest = new RelationDetails();

            src.CopyTo(dest);

            dest.Title.Should().Be(src.Title);

            src.CopyTo(dest);

            dest.ShouldBeEquivalentTo(src);
        }
        public void CopyTo_OnlyCopiesUninheritedAddress()
        {
            var src = RelationDetailsBuilder.NewValid(rd =>
            {
                rd.InheritAddress = true;
                rd.Address        = AddressBuilder.NewValid();
            });

            var dest = new RelationDetails();

            src.CopyTo(dest);

            dest.InheritAddress.Should().BeTrue();
            dest.Address.Should().BeNull();
        }
Beispiel #9
0
        private static void Validate(RelationDetails relationDetails)
        {
            var ctx = new ValidationContext <RelationDetails>(relationDetails);

            ctx.Required(m => m.FullName, "Please supply a Full name");
            ctx.Required(m => m.DateOfBirth, "Please supply a Date of Birth");
            ctx.InPast(m => m.DateOfBirth, "Please supply a Date of Birth in the past");
            ctx.Custom(m => m.NationalInsuranceNumber, ni => ValidateNationalInsuranceNumber(relationDetails));
            ctx.Required(m => m.RelationshipToApplicant, "Please supply your Relationship to the applicant");

            if (!relationDetails.InheritAddress)
            {
                ctx.Required(m => m.Address.Line1, "Please supply an Address line 1");
                ctx.Required(m => m.Address.Postcode, "Please supply a Postcode");
            }

            ctx.ThrowIfError();
        }
        public static RelationDetails NewValid(string relation = "relation ", Action <RelationDetails> mutator = null)
        {
            var value = new RelationDetails
            {
                Title                   = "relation title",
                FullName                = "relation name",
                DateOfBirth             = DomainRegistry.NowUtc().Date.AddYears(-45),
                NationalInsuranceNumber = "BC123456D",
                RelationshipToApplicant = "Parent",

                InheritAddress = false,
                Address        = AddressBuilder.NewValid(relation),
            };

            if (mutator != null)
            {
                mutator(value);
            }

            return(value);
        }