Ejemplo n.º 1
0
 // Evolution Methods
 private void DownloadFilesFromEvo(int?NameID)
 {
     try
     {
         CreateRootDirectoryIfNotExists();
         using (EvoInterface evo = new EvoInterface())
         {
             try
             {
                 logger.Debug("Getting Name info for NameID {NameID}", NameID);
                 if (NameID != null)
                 {
                     var nameEntity = evo.GetNameWithDocuments(NameID ?? default(int));
                     logger.Info("Downloading files for {AgencyName}:{NameID}", nameEntity.FullName, nameEntity.ID);
                     foreach (var nameDoc in nameEntity.NameDocuments)
                     {
                         var downloadFilePath  = Path.Combine(downloadRootDirectory, nameEntity.ID.ToString(), nameDoc.FileName);
                         var downloadDirectory = Path.GetDirectoryName(downloadFilePath);
                         CreateNamedDirectory(downloadDirectory);
                         try
                         {
                             logger.Debug("Downloading file {fileName}", nameDoc.FileName);
                             evo.DownloadNameFile(nameDoc, downloadFilePath);
                         }
                         catch (Exception e)
                         {
                             logger.Error(e);
                             TrackFileError(nameDoc.FileName, nameEntity.FullName, e.Message);
                         }
                     }
                     logger.Info("Download complete for {AgencyName}:{NameID}", nameEntity.FullName, nameEntity.ID);
                 }
                 else
                 {
                     logger.Error("NameID cannot be null to download files.");
                 }
             }
             catch (Exception e)
             {
                 logger.Error(e);
             }
         }
     }
     catch (Exception e)
     {
         logger.Error("Failed to Downloading files from EVO for NameID {NameID}. Message: {ErrorMessage}", NameID, e.Message);
     }
 }
Ejemplo n.º 2
0
        private bool TestEvoConnection()
        {
            EvoInterface evo       = new EvoInterface();
            int          evoNameID = evo.TestApiConnection();

            if (evoNameID > 0)
            {
                logger.Info("Connected to Evolution Successfully");
                return(true);
            }
            else
            {
                logger.Error("Failed to load NameID for logged in user!");
                return(false);
            }
        }