public async Task <ETaskStatus> UpdateCouncillorsDetails(FosteringCaseCouncillorsUpdateModel model) { var builder = new FormFieldBuilder(); CreateCouncillorsDetailsIntegratedFormFields(builder, model.FirstApplicant.HasContactWithCouncillor ? model.FirstApplicant.CouncillorRelationshipDetails : new List <CouncillorRelationshipDetailsUpdateModel>()); CreateCouncillorsDetailsIntegratedFormFields(builder, model.SecondApplicant?.HasContactWithCouncillor != null && model.SecondApplicant.HasContactWithCouncillor ? model.SecondApplicant.CouncillorRelationshipDetails : new List <CouncillorRelationshipDetailsUpdateModel>(), true); builder .AddField("contactwithcouncillor1", model.FirstApplicant.HasContactWithCouncillor.ToString().ToLower()) .AddField("contactwithcouncillor2", model.SecondApplicant?.HasContactWithCouncillor.ToString().ToLower() ?? string.Empty) .AddField(EFosteringApplicationForm.CouncillorsOrEmployees.GetFormStatusFieldName(), ETaskStatus.Completed.GetTaskStatus()); var response = await _verintServiceGateway.UpdateCaseIntegrationFormField(new IntegrationFormFieldsUpdateModel { CaseReference = model.CaseReference, IntegrationFormFields = builder.Build(), IntegrationFormName = _applicationFormName }); if (response.StatusCode != HttpStatusCode.OK) { throw new Exception($"Application Service. UpdateCouncillorsDetails: Failed to update. Verint service response: {response}"); } return(ETaskStatus.Completed); }
public async Task <ETaskStatus> UpdateAddressHistory(FosteringCaseAddressHistoryUpdateModel model) { var builder = new FormFieldBuilder(); CreateAddressHistoryIntegratedFormFields(builder, model.FirstApplicant.AddressHistory); if (model.SecondApplicant != null) { CreateAddressHistoryIntegratedFormFields(builder, model.SecondApplicant != null ? model.SecondApplicant?.AddressHistory : new List <PreviousAddress>(), true); } var addressHistoryTaskStatus = AddressHistoryTaskStatus(model.FirstApplicant.AddressHistory) && (model.SecondApplicant == null || AddressHistoryTaskStatus(model.SecondApplicant.AddressHistory)); builder.AddField(EFosteringApplicationForm.AddressHistory.GetFormStatusFieldName(), addressHistoryTaskStatus ? ETaskStatus.Completed.GetTaskStatus() : ETaskStatus.NotCompleted.GetTaskStatus()); var response = await _verintServiceGateway.UpdateCaseIntegrationFormField(new IntegrationFormFieldsUpdateModel { CaseReference = model.CaseReference, IntegrationFormFields = builder.Build(), IntegrationFormName = _applicationFormName }); if (response.StatusCode != HttpStatusCode.OK) { throw new Exception($"Application Service. UpdateAddressHistory: Failed to update. Verint service response: {response}"); } return(addressHistoryTaskStatus ? ETaskStatus.Completed : ETaskStatus.NotCompleted); }
public async Task <ETaskStatus> UpdateLanguagesSpokenInYourHome(FosteringCaseLanguagesSpokenInYourHomeUpdateModel model) { var formFields = new FormFieldBuilder(); var completed = UpdateLanguagesSpokenInYourHomeIsValid(model); formFields .AddField("primarylanguage", model.PrimaryLanguage) .AddField("otherlanguages", model.OtherLanguages); formFields.AddField(EFosteringHomeVisitForm.LanguageSpokenInYourHome.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 language-spoken-in-your-home failure"); } return(completed ? ETaskStatus.Completed : ETaskStatus.NotCompleted); }
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); }
public async Task <ETaskStatus> UpdateHealthStatus(FosteringCaseHealthUpdateModel model) { var completed = UpdateHealthStatusIsCompleted(model); var formFields = new FormFieldBuilder(); if (model.FirstApplicant.RegisteredDisabled != null) { formFields .AddField("registereddisabled", model.FirstApplicant.RegisteredDisabled.GetValueOrDefault() ? "Yes" : "No"); } if (model.FirstApplicant.Practitioner != null) { formFields .AddField("practitioner", model.FirstApplicant.Practitioner.GetValueOrDefault() ? "Yes" : "No"); } if (model.SecondApplicant != null) { if (model.SecondApplicant.RegisteredDisabled != null) { formFields .AddField("registereddisabled2", model.SecondApplicant.RegisteredDisabled.GetValueOrDefault() ? "Yes" : "No"); } if (model.SecondApplicant.Practitioner != null) { formFields .AddField("practitioner2", model.SecondApplicant.Practitioner.GetValueOrDefault() ? "Yes" : "No"); } } formFields.AddField(EFosteringHomeVisitForm.YourHealth.GetFormStatusFieldName(), completed ? ETaskStatus.Completed.GetTaskStatus() : ETaskStatus.NotCompleted.GetTaskStatus()); var response = await _verintServiceGateway.UpdateCaseIntegrationFormField(new IntegrationFormFieldsUpdateModel { CaseReference = model.CaseReference, IntegrationFormFields = formFields.Build(), IntegrationFormName = _integrationFormName }); if (response.StatusCode != HttpStatusCode.OK) { throw new Exception("Update health-status failure"); } return(completed ? ETaskStatus.Completed : ETaskStatus.NotCompleted); }
public async Task UpdateStatus(string caseId, ETaskStatus status, EFosteringHomeVisitForm form) { var formStatusFieldName = form.GetFormStatusFieldName(); var formFields = new FormFieldBuilder() .AddField(formStatusFieldName, status.GetTaskStatus()); var updateModel = new IntegrationFormFieldsUpdateModel { IntegrationFormName = _integrationFormName, CaseReference = caseId, IntegrationFormFields = formFields.Build() }; var response = await _verintServiceGateway .UpdateCaseIntegrationFormField(updateModel); if (response.StatusCode != HttpStatusCode.OK) { throw new Exception("Passive update-status failure"); } }
public async Task <ETaskStatus> UpdateYourEmploymentDetails(FosteringCaseYourEmploymentDetailsUpdateModel model) { var formFields = new FormFieldBuilder(); var completed = UpdateAboutEmploymentIsCompleted(model.FirstApplicant); if (model.FirstApplicant.AreYouEmployed != null) { formFields .AddField("employed", model.FirstApplicant.AreYouEmployed.Value ? "Yes" : "No") .AddField("jobtitle", model.FirstApplicant.JobTitle) .AddField("currentemployer", model.FirstApplicant.CurrentEmployer) .AddField("hoursofwork", Enum.GetName(typeof(EHoursOfWork), model.FirstApplicant.CurrentHoursOfWork)); } else { formFields .AddField("jobtitle", string.Empty) .AddField("currentemployer", string.Empty) .AddField("hoursofwork", Enum.GetName(typeof(EHoursOfWork), 0)); } if (model.SecondApplicant != null) { if (model.SecondApplicant.AreYouEmployed != null) { formFields .AddField("employed2", model.SecondApplicant.AreYouEmployed.Value ? "Yes" : "No") .AddField("jobtitle2", model.SecondApplicant.JobTitle) .AddField("currentemployer2", model.SecondApplicant.CurrentEmployer) .AddField("hoursofwork2", Enum.GetName(typeof(EHoursOfWork), model.SecondApplicant.CurrentHoursOfWork)); } else { formFields .AddField("jobtitle2", string.Empty) .AddField("currentemployer2", string.Empty) .AddField("hoursofwork2", Enum.GetName(typeof(EHoursOfWork), 0)); } completed = completed && UpdateAboutEmploymentIsCompleted(model.SecondApplicant); } formFields.AddField(EFosteringHomeVisitForm.YourEmploymentDetails.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-your employment details failure"); } return(completed ? ETaskStatus.Completed : ETaskStatus.NotCompleted); }