Ejemplo n.º 1
0
        //*** SIMPLIFY THIS METHOD

        /**
         * public void CheckGuidesForUpdate(FtpClient ftpClient)
         * {
         *  if (ftpClient == null)
         *  {
         *      throw new ArgumentNullException(nameof(ftpClient));
         *  }
         *
         *  var guidesConfiguration = _guidesConfigurationManager.Get();
         *
         *  var latestEntity = GetLatestFileMetadata(ftpClient);
         *
         *  var lastUpdateDate = guidesConfiguration.LastUpdateDate;
         *  if (latestEntity != null && !string.Equals(latestEntity.Date, lastUpdateDate))
         *  {
         *      try
         *      {
         *          var localPath = guidesConfiguration.Path;
         *          var fileName = latestEntity.Name;
         *
         *          ftpClient.DownloadFile(fileName, localPath);
         *
         *          UnZip(latestEntity.Name, guidesConfiguration.Path, true);
         *          DeleteFile(guidesConfiguration.Path, latestEntity.Name);
         *
         *          guidesConfiguration.LastUpdateDate = latestEntity.Date;
         *          _guidesConfigurationManager.Update(guidesConfiguration);
         *      }
         *      catch (IOException ex)
         *      {
         *          throw new FileSaveException(ex.Message, ex);
         *      }
         *      catch (AggregateException ae)
         *      {
         *          // This is where you can choose which exceptions to handle.
         *          foreach (var ex in ae.InnerExceptions)
         *          {
         *              if (ex is System.Net.WebException)
         *              {
         *                  throw new RemoteServerException(
         *                      "Guides service not respond" + Environment.NewLine + ex.Message, ex);
         *              }
         *
         *              if (ex is System.IO.DirectoryNotFoundException)
         *              {
         *                  throw new FileSaveException(
         *                      "Guides folder not found" + Environment.NewLine + ex.Message, ex);
         *              }
         *
         *              throw ex;
         *          }
         *      }
         *  }
         * }
         */


        public GuidesIdsCollection GetGuidesIds()
        {
            var mnnGuideIds  = _mnnGuideRepository.GetIds("sp_mnn.dbf");
            var tradeNameIds = _tradeNameGuideRepository.GetIds("sp_trn.dbf");
            var drugIds      = _drugGuideRepository.GetIds("sp_tov.dbf");
            var drugformIds  = _drugformGuideRepository.GetIds("sp_lf.dbf");

            var guidesIdsCollection = new GuidesIdsCollection()
            {
                MnnGuideIs        = mnnGuideIds,
                TradeNamesGudeIds = tradeNameIds,
                DrugGuideIds      = drugIds,
                DrugformIds       = drugformIds
            };

            return(guidesIdsCollection);
        }
Ejemplo n.º 2
0
        public HashSet <int> GetTradeNameIds(string guideFileName)
        {
            var tradeNameIds = _tradeNameGuideRepository.GetIds(guideFileName);

            return(tradeNameIds);
        }
Ejemplo n.º 3
0
        public HashSet <int> GetDrugformIds(string guideFileName)
        {
            var drugformIds = _drugformGuideRepository.GetIds(guideFileName);

            return(drugformIds);
        }
Ejemplo n.º 4
0
        public HashSet <int> GetMnnIds(string guideFileName)
        {
            var mnnGuideIds = _mnnGuideRepository.GetIds(guideFileName);

            return(mnnGuideIds);
        }