Exemple #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.");
            }
        }
Exemple #2
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);
            }
        }
        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);
        }
Exemple #4
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");
        }