Beispiel #1
0
        public async Task <ETaskStatus> UpdateReferences(FosteringCaseReferenceUpdateModel model)
        {
            var formFields = new FormFieldBuilder()
                             .AddField("prffirstname", model.FamilyReference.FirstName)
                             .AddField("prflastname", model.FamilyReference.LastName)
                             .AddField("prfrelation", model.FamilyReference.RelationshipToYou)
                             .AddField("prfyears", model.FamilyReference.NumberOfYearsKnown)
                             .AddField("prfemail", model.FamilyReference.EmailAddress)
                             .AddField("prfcontact", model.FamilyReference.PhoneNumber)
                             .AddField("prf11firstname", model.FirstPersonalReference.FirstName)
                             .AddField("prf1lastname", model.FirstPersonalReference.LastName)
                             .AddField("prf1relation", model.FirstPersonalReference.RelationshipToYou)
                             .AddField("prf1years", model.FirstPersonalReference.NumberOfYearsKnown)
                             .AddField("prf1email", model.FirstPersonalReference.EmailAddress)
                             .AddField("prf1contact", model.FirstPersonalReference.PhoneNumber)
                             .AddField("prf2firstname", model.SecondPersonalReference.FirstName)
                             .AddField("prf2lastname", model.SecondPersonalReference.LastName)
                             .AddField("prf2relation", model.SecondPersonalReference.RelationshipToYou)
                             .AddField("prf2years", model.SecondPersonalReference.NumberOfYearsKnown)
                             .AddField("prf2email", model.SecondPersonalReference.EmailAddress)
                             .AddField("prf2contact", model.SecondPersonalReference.PhoneNumber)
                             .AddField(EFosteringApplicationForm.References.GetFormStatusFieldName(), ETaskStatus.Completed.GetTaskStatus())
                             .Build();

            formFields.AddRange(AddressMapper.MapToVerintAddress(model.FamilyReference.Address, "prfaddress",
                                                                 "prfplaceref", "prfpostcode"));

            formFields.AddRange(AddressMapper.MapToVerintAddress(model.FirstPersonalReference.Address, "prf1address",
                                                                 "prf1placeref", "prf1postcode"));

            formFields.AddRange(AddressMapper.MapToVerintAddress(model.SecondPersonalReference.Address, "prf2address",
                                                                 "prf2placeref", "prf2postcode"));

            var updateModel = new IntegrationFormFieldsUpdateModel
            {
                IntegrationFormName   = _applicationFormName,
                CaseReference         = model.CaseReference,
                IntegrationFormFields = formFields
            };

            var response = await _verintServiceGateway
                           .UpdateCaseIntegrationFormField(updateModel);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                throw new Exception("Update references failure");
            }

            return(ETaskStatus.Completed);
        }
Beispiel #2
0
        public async Task <ETaskStatus> UpdateGpDetails(FosteringCaseGpDetailsUpdateModel model)
        {
            var firstApplicantFormFields = new FormFieldBuilder()
                                           .AddField("nameofgp", model.FirstApplicant.NameOfGp)
                                           .AddField("nameofpractice", model.FirstApplicant.NameOfGpPractice)
                                           .AddField("gpphonenumber", model.FirstApplicant.GpPhoneNumber)
                                           .AddField(EFosteringApplicationForm.GpDetails.GetFormStatusFieldName(), ETaskStatus.Completed.GetTaskStatus())
                                           .Build();

            firstApplicantFormFields.AddRange(AddressMapper.MapToVerintAddress(model.FirstApplicant.GpAddress, "addressofpractice", "placerefofpractice", "postcodeofpractice"));

            var secondApplicantFormFields = new List <IntegrationFormField>();

            if (model.SecondApplicant != null)
            {
                secondApplicantFormFields = new FormFieldBuilder()
                                            .AddField("nameofgp2", model.SecondApplicant.NameOfGp)
                                            .AddField("nameofpractice2", model.SecondApplicant.NameOfGpPractice)
                                            .AddField("gpphonenumber2", model.SecondApplicant.GpPhoneNumber)
                                            .Build();
                secondApplicantFormFields.AddRange(AddressMapper.MapToVerintAddress(model.SecondApplicant.GpAddress, "addressofpractice2", "placerefofpractice2", "postcodeofpractice2"));
            }

            var result = await _verintServiceGateway.UpdateCaseIntegrationFormField(new IntegrationFormFieldsUpdateModel
            {
                CaseReference         = model.CaseReference,
                IntegrationFormFields = firstApplicantFormFields.Concat(secondApplicantFormFields).ToList(),
                IntegrationFormName   = _applicationFormName
            });

            if (result.StatusCode != HttpStatusCode.OK)
            {
                throw new Exception("Update Gp details failure");
            }

            return(ETaskStatus.Completed);
        }