Esempio n. 1
0
 public TableInfo Get(string tableType)
 {
     try
     {
         return(FindInDictionary(tableType));
     }
     catch (ImpersonationException e)
     {
         _log.Accept(new Execution(e.Message));
         throw;
     }
 }
Esempio n. 2
0
 public void Begin()
 {
     _log.Accept(new InfoResult("Start interaction..."));
     try
     {
         var request = WebRequest.Create(_config.CbrUrl);
         request.Headers.Add(HttpRequestHeader.Accept, "application/javascript");
         HandleResponse(request.GetResponse());
     }
     catch (Exception e)
     {
         _log.Accept(new ErrorResult(e.Message));
     }
 }
Esempio n. 3
0
 public Config(Logging log)
 {
     try
     {
         Deserialize();
     }
     catch (InfrastructureException e)
     {
         log.Accept(new Execution(e.Message));
         throw;
     }
     catch (JsonException e)
     {
         log.Accept(new Execution(e.Message));
         throw;
     }
 }
Esempio n. 4
0
 public void Process(ICollection <SharedParent> parents)
 {
     if (parents.Count == 0)
     {
         return;
     }
     _parents = parents;
     try
     {
         Loop();
     }
     catch (InteractionException e)
     {
         _log.Accept(new Execution(e.Message));
         throw;
     }
 }
Esempio n. 5
0
 public void Process(ICollection <ExtractionModel> extractionModels)
 {
     if (extractionModels.Count == 0)
     {
         return;
     }
     foreach (ExtractionModel extractionModel in extractionModels)
     {
         TableInfo info = _impersonation.Get(extractionModel.TableType);
         try
         {
             FillShareds(extractionModel, info);
         }
         catch (ExtractionException e)
         {
             _log.Accept(new Execution($"{e.Message}"));
             throw;
         }
     }
 }
Esempio n. 6
0
        private void ProcessOrphans()
        {
            if (_exchangeDir.GetFiles("*.dbf").Length == 0)
            {
                _log.Accept(new Execution($"There are no any orphans dbfs in {_config.ExchangeDirectory}",
                                          LoggingType.Info));
                return;
            }
            string date           = DateTime.Now.ToString("yyyy-dd-M--HH-mm-ss");
            string orphansDirPath = Path.Combine(_exchangeDir.FullName, $"{date}_orphans");

            Directory.CreateDirectory(orphansDirPath);
            foreach (FileInfo file in GetDbfs(_exchangeDir.FullName))
            {
                File.Copy(file.FullName, Path.Combine(orphansDirPath, file.Name), true);
                File.Delete(file.FullName);
            }
            ZipFile.CreateFromDirectory(orphansDirPath, $"{orphansDirPath}.zip");
            Directory.Delete(orphansDirPath, true);
        }
Esempio n. 7
0
 public ConfigInitializer(Logging log)
 {
     try
     {
         Deserialize();
     }
     catch (Exception e)
     {
         log.Accept(new ErrorResult(e.Message));
         throw;
     }
 }
Esempio n. 8
0
 public void Run()
 {
     try
     {
         CheckInfrastructure();
         _exchange.Begin();
     }
     catch (InfrastructureException e)
     {
         _log.Accept(new Execution(e.Message));
         throw;
     }
 }
Esempio n. 9
0
        public void Build(SharedParent parent)
        {
            try
            {
                parent.SeedQueries = new List <Query>();
                TableInfo info = _impersonation.Get(parent.TableType);

                Create(info, parent);
                if (info.UniqueColumns.Count > 0)
                {
                    Index(info, parent);
                }
            } catch (Exception e)
            {
                _log.Accept(new Execution($"Failed to build query for {parent.TableType} " +
                                          $"problem: {e.Message}"));
                throw;
            }
        }