示例#1
0
        public Guid StorePrintContent(List <String> trialIDs, DateTime date, CTSSearchParams searchTerms)
        {
            // Retrieve the collections given the ID's
            //TODO: THese dependencies should be passed in!
            BasicCTSManager manager = new BasicCTSManager(APIClientHelper.GetV1ClientInstance());

            List <ClinicalTrial> results = manager.GetMultipleTrials(trialIDs).ToList();

            // Send results to Velocity template
            var formattedPrintContent = FormatPrintResults(results, date, searchTerms);

            // Save result to cache table
            Guid guid = CTSPrintResultsDataManager.SavePrintResult(formattedPrintContent, trialIDs, searchTerms, Settings.IsLive);

            if (guid == Guid.Empty)
            {
                // Something went wrong with the save/return from the DB
                ErrorPageDisplayer.RaisePageByCode(this.GetType().ToString(), 500);
                throw new DbConnectionException("Unable to connect to the database. ");
            }

            return(guid);
        }
 /// <summary>
 /// Checks whether the given trial ID exists in the API.
 /// </summary>
 /// <param name="idString">NCT ID</param>
 /// <returns>True if trial is found in API.</returns>
 private bool IsValidTrial(string idString)
 {
     // If the ID is a valid NCTID, go to web service and see if trial exists
     try
     {
         ClinicalTrialsAPIClient client = APIClientHelper.GetV1ClientInstance();
         ClinicalTrial           trial  = client.Get(idString);
         if (trial != null)
         {
             return(true);
         }
     }
     catch (ArgumentNullException nx)
     {
         log.DebugFormat("Error retrieving trial - value cannot be null. idString = " + idString, nx);
         return(false);
     }
     catch (Exception ex)
     {
         log.Error("Error retrieving trial object from API", ex);
         return(false);
     }
     return(false);
 }
示例#3
0
 public BasicCTSManager(string host)
     : this(APIClientHelper.GetV1ClientInstance())
 {
 }