private void CreateAndUploadDocument(string filePath, string CaseID) { FileInfo info = new FileInfo(filePath); if (info.Extension == ".db") { logger.Debug("File extension is .db, skipping."); } else if (info.Extension == ".efx") { logger.Debug("file extension is .efx, skipping"); TrackFileError(info.Name, "[]", "file extension is .efx and was skipped."); } else { var doc = CreateDocument(filePath, CaseID.ToString()); eSupportInterface eSupport = new eSupportInterface(); var documentJson = JsonConvert.SerializeObject(doc, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); logger.Trace(documentJson); var result = eSupport.CreateDocument(documentJson); doc = JsonConvert.DeserializeObject <Document>(result); // upload doc eSupport.UploadDocument(doc.id.ToString(), filePath); } }
// eSupport Methods private List <Person> VerifyNameIDExistsInEsupport(int?NameID) { try { eSupportInterface eSupport = new eSupportInterface(); return(JsonConvert.DeserializeObject <List <Person> >(eSupport.GetPersonsFromPersonSource(NameID))); } catch { TrackPersonError(NameID.ToString(), "Failed to load person via NameID from eSupport."); return(null); } }
private void CreateAndUploadPersonDocument(string filePath, Person person) { var doc = CreatePersonDocument(filePath, person); eSupportInterface eSupport = new eSupportInterface(); var documentJson = JsonConvert.SerializeObject(doc, Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); logger.Trace(documentJson); var result = eSupport.CreatePersonDocument(documentJson); doc = JsonConvert.DeserializeObject <PersonDocument>(result); // upload doc eSupport.UploadPersonDocument(doc.id.ToString(), filePath); }
private int CreateContractCase(Person agency) { try { // create case Case theCase = new Case(); theCase.caseName = agency.lastName; theCase.caseType = CONTRACT_CASE_TYPE; theCase.description = "Conversion data from Evolution"; // create agency party Party agencyParty = new Party(); agencyParty.person = agency.id; agencyParty.nonMonApplication = NON_MON_APPLICATION; agencyParty.partyType = AGENCY_PARTY_TYPE; theCase.parties.Add(agencyParty); // submit case eSupportInterface eSupport = new eSupportInterface(); var caseJson = JsonConvert.SerializeObject(theCase); logger.Trace(caseJson); var result = eSupport.CreateCaseWithParty(caseJson); theCase = JsonConvert.DeserializeObject <Case>(result); // get result int CaseID; if (Int32.TryParse(theCase.id, out CaseID)) { logger.Info("Case created with ID {CaseID}", CaseID); return(CaseID); } else { logger.Error("Failed to create contract case"); return(-1); } } catch (Exception e) { logger.Error("Failed to create contract case!!"); logger.Error(e); } return(-1); }
private bool TestEsupportConnection() { try { eSupportInterface eSupport = new eSupportInterface(); var success = eSupport.TestConnection(); if (success) { logger.Info("Connected to eSupport Successfully"); return(true); } else { logger.Error("Failed to connect to eSupport!"); return(false); } } catch (Exception e) { logger.Error("Failed to connect to eSupport!"); logger.Error(e); return(false); } }