public async Task <ETaskStatus> UpdateAboutYourself(FosteringCaseAboutYourselfUpdateModel model)
        {
            var completed = UpdateAboutYourselfIsValid(model.FirstApplicant);

            var formFields = new FormFieldBuilder()
                             .AddField("previousname", model.FirstApplicant.EverBeenKnownByAnotherName.GetValueOrDefault() ? model.FirstApplicant.AnotherName : "")
                             .AddField("hasanothername",
                                       model.FirstApplicant.EverBeenKnownByAnotherName == null
                        ? ""
                        : model.FirstApplicant.EverBeenKnownByAnotherName.ToString().ToLower())
                             .AddField("ethnicity", model.FirstApplicant.Ethnicity)
                             .AddField("gender", model.FirstApplicant.Gender)
                             .AddField("nationality", model.FirstApplicant.Nationality)
                             .AddField("placeofbirth", model.FirstApplicant.PlaceOfBirth)
                             .AddField("religionorfaithgroup", model.FirstApplicant.Religion);

            if (model.SecondApplicant != null)
            {
                completed = completed && UpdateAboutYourselfIsValid(model.SecondApplicant);

                formFields
                .AddField("previousname_2", model.SecondApplicant.EverBeenKnownByAnotherName.GetValueOrDefault() ? model.SecondApplicant.AnotherName : "")
                .AddField("hasanothername2",
                          model.SecondApplicant.EverBeenKnownByAnotherName == null
                            ? ""
                            : model.SecondApplicant.EverBeenKnownByAnotherName.ToString().ToLower())
                .AddField("ethnicity2", model.SecondApplicant.Ethnicity)
                .AddField("gender2", model.SecondApplicant.Gender)
                .AddField("placeofbirth_2", model.SecondApplicant.PlaceOfBirth)
                .AddField("nationality2", model.SecondApplicant.Nationality)
                .AddField("religionorfaithgroup2", model.SecondApplicant.Religion);
            }

            formFields.AddField(EFosteringHomeVisitForm.TellUsAboutYourself.GetFormStatusFieldName(),
                                completed ? ETaskStatus.Completed.GetTaskStatus() : ETaskStatus.NotCompleted.GetTaskStatus());

            var updateModel = new IntegrationFormFieldsUpdateModel
            {
                IntegrationFormName   = _integrationFormName,
                CaseReference         = model.CaseReference,
                IntegrationFormFields = formFields.Build()
            };


            var response = await _verintServiceGateway
                           .UpdateCaseIntegrationFormField(updateModel);

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

            return(completed ? ETaskStatus.Completed : ETaskStatus.NotCompleted);
        }
Exemplo n.º 2
0
        public async Task UpdateStatus(string caseId, ETaskStatus status, EFosteringApplicationForm form)
        {
            var fields = new FormFieldBuilder()
                         .AddField(form.GetFormStatusFieldName(), status.GetTaskStatus())
                         .Build();

            var response = await _verintServiceGateway.UpdateCaseIntegrationFormField(new IntegrationFormFieldsUpdateModel
            {
                CaseReference         = caseId,
                IntegrationFormName   = _applicationFormName,
                IntegrationFormFields = fields
            });

            if (response.StatusCode != HttpStatusCode.OK)
            {
                throw new Exception(
                          $"Application Service. UpdateStatus: Failed to update status. Verint service response: {response}");
            }
        }