Пример #1
0
        /// <summary>
        ///   Landing point, execution starts here
        /// </summary>
        protected override void ExecuteTask()
        {
            EmbeddedResourceHelper.Bind(this);

            if (LoadDefaultVendor() && LoadDefaultLanguage() && LoadDefaultConnector() && LoadProductExporterSettings())
            {
                if (LoadDatabaseCache())
                {
                    IFtpClient ftpClient;

                    try
                    {
                        ftpClient = FtpClientFactory.Create(new Uri(ExportSettings.Server), ExportSettings.UserName, ExportSettings.Password);
                        ftpClient.Update();
                    }
                    catch (Exception ex)
                    {
                        TraceError("Unable to establish FTP connection to remote server \"{0}\" for exporting BizTalk files.", ExportSettings.Server);
                        return;
                    }

                    ExportProducts(ftpClient);
                }
                else
                {
                    TraceError("Could not cache Concentrator database data, further processing not possible now.");
                }
            }
            else
            {
                TraceError("Could not load context data, further processing not possible now.");
            }
        }
Пример #2
0
        private FtpXboxGameRepository CreateSut(FtpXboxSettings settings)
        {
            var ftpClientFactory = new FtpClientFactory(settings);
            var sut = new FtpXboxGameRepository(ftpClientFactory, settings, _policyRegistry);

            return(sut);
        }
Пример #3
0
        private static IXboxGameRepositoryFactory UseFtpAdapter(FtpXboxSettings ftpXboxSettings)
        {
            FtpClientFactory ftpClientFactory = new FtpClientFactory(ftpXboxSettings);

            IXboxGameRepositoryFactory xboxGameRepositoryFactory =
                new FtpXboxGameRepositoryFactory(ftpClientFactory, ftpXboxSettings);

            return(xboxGameRepositoryFactory);
        }
Пример #4
0
        protected override void ExecutePricatTask()
        {
            _pricatLineProcessor = PricatLineProcessorFactory.Create();

            if (LoadProductAttributes() &&
                LoadPricatSettings())
            {
                LoadPricatColorMapping();

                var client = FtpClientFactory.Create(new Uri(PricatSettings.Server), PricatSettings.UserName, PricatSettings.Password);
                ISimpleArchiveService archiver = new SimpleArchiveService(PricatSettings.ArchiveRoot, TraceSource);

                client.Update();

                ProcessPricatFiles(client, archiver);
            }
        }
Пример #5
0
        private Boolean LoadPricatDocument()
        {
            TraceVerbose("Loading PRICAT document...");

            var client = FtpClientFactory.Create(new Uri(PricatDocumentSettings.Server), PricatDocumentSettings.UserName, PricatDocumentSettings.Password);

            using (var stream = client.DownloadFile(PricatDocumentSettings.FileName))
            {
                try
                {
                    PricatDocument = new ExcelPackage(stream);
                }
                catch (Exception exception)
                {
                    TraceError("Unable to load the PRICAT document. {0}", exception.Message);

                    return(false);
                }
            }

            return(true);
        }
Пример #6
0
        private void ConfigureDefaultFtpData()
        {
            FtpClientFactory ftpClientFactory = new FtpClientFactory(new FtpXboxSettings()
            {
                Host     = Settings.XboxFtpHost,
                User     = Settings.XboxFtpUser,
                Password = Settings.XboxFtpPassword
            });

            var ftpClient = ftpClientFactory.Create();

            ftpClient.Connect();

            if (ftpClient.DirectoryExists("F"))
            {
                ftpClient.DeleteDirectory("F");
            }

            ftpClient.CreateDirectory("F/Games/GameA", true);

            ftpClient.SetWorkingDirectory("/F/Games/GameA");
            ftpClient.UploadFile("SampleFile.txt", "SampleFile.txt");
        }