public static List <Document> GetMapperDocuments(int externalSourceId, WcmSettings wcmConfig)
        {
            string finalUri = $"{wcmConfig.GetDocumentMapperDocumentsUrl}?externalSourceId={externalSourceId}&includeFieldMappings=true&enabledOnlyDocs={false}";
            HttpResponseMessage httpResponse = WyndhamClientManager.GetAuthHttpClient().GetResponseMessage(finalUri);

            if (httpResponse.IsSuccessStatusCode)
            {
                Task <string> responseString = httpResponse.Content.ReadAsStringAsync();
                var           docs           = JsonConvert.DeserializeObject <List <Document> >(responseString.Result);
                return(docs);
            }
            else
            {
                throw new Exception($"Error retrieving external source documents!'{httpResponse.StatusCode}'");
            }
        }
        private void UpdateDocumentMapperDoc()
        {
            string url  = $"{_settings.UpdateDocumentMapperDocumentUrl}?userId={EncompassApplication.CurrentUser.ID}";
            string json = JsonConvert.SerializeObject(TheDocument);

            var httpResponse = WyndhamClientManager.GetAuthHttpClient().Post(url, TheDocument);

            if (httpResponse.IsSuccessStatusCode)
            {
                Task <string> responseString = httpResponse.Content.ReadAsStringAsync();
                TheDocument = JsonConvert.DeserializeObject <Document>(responseString.Result);
            }
            else
            {
                throw new Exception($"Error retrieving external source documents!'{httpResponse.StatusCode}'");
            }
        }
        internal static async Task <List <ExternalSource> > GetDocumentImporterExternalSourcesAsync(WcmSettings wcmSettings)
        {
            string url = wcmSettings.GetDocumentImporterSourcesUrl;
            HttpResponseMessage httpResponse = WyndhamClientManager.GetAuthHttpClient().GetResponseMessage(url);
            var rawJson = await httpResponse.Content.ReadAsStringAsync();

            if (httpResponse.IsSuccessStatusCode)
            {
                var response = JsonConvert.DeserializeObject <List <ExternalSource> >(rawJson);
                return(response);
            }
            else
            {
                throw new Exception($"Major error getting Document Importer Settings. " +
                                    "Please restart Encompass and if the error persists submit a help desk ticket. " +
                                    $"{Environment.NewLine}{Environment.NewLine}Status Code: '{httpResponse.StatusCode}'");
            }
        }
Exemple #4
0
        private async System.Threading.Tasks.Task GetExternalSourcesAsync()
        {
            try
            {
                HttpResponseMessage httpResponse = WyndhamClientManager.GetAuthHttpClient().GetResponseMessage(WcmSettings.GetDocumentMapperExternalSourcesUrl);
                var rawJson = await httpResponse.Content.ReadAsStringAsync();

                if (httpResponse.IsSuccessStatusCode)
                {
                    _externalImportSources = JsonConvert.DeserializeObject <List <ExternalDocumentSource> >(rawJson);
                }
                else
                {
                    throw new Exception($"Major error getting Document Importer Settings. " +
                                        "Please restart Encompass and if the error persists submit a help desk ticket. " +
                                        $"{Environment.NewLine}{Environment.NewLine}Status Code: '{httpResponse.StatusCode}'");
                }
            }
            catch (Exception e)
            {
                MessageBox.Show($"Error: {e.ToString()}");
                throw;
            }
        }
Exemple #5
0
 private void GetLoanExtractedDataFieldsAsync()
 {
     try
     {
         var url = WcmConfig.GetFieldExtractionDataForLoanUrl + $"?loanGuid={EncompassApplication.CurrentLoan.Guid}";
         HttpResponseMessage httpResponse = WyndhamClientManager.GetAuthHttpClient().GetResponseMessage(url);
         var rawJson = httpResponse.Content.ReadAsStringAsync();
         if (httpResponse.IsSuccessStatusCode)
         {
             _fieldExtractedDocs = JsonConvert.DeserializeObject <List <ClassifiedDocument> >(rawJson.Result);
         }
         else
         {
             throw new Exception($"Major error getting Loan Field Extraction Data. " +
                                 "Please restart Encompass and if the error persists submit a help desk ticket. " +
                                 $"{Environment.NewLine}{Environment.NewLine}Status Code: '{httpResponse.StatusCode}'");
         }
     }
     catch (Exception e)
     {
         MessageBox.Show($"Error: {e.ToString()}");
         throw;
     }
 }