示例#1
0
 private void FillSettings()
 {
     _ftpSetting.FtpAddress  = _vendorSettingRepo.GetVendorSetting(SapphVendorID, FtpAddressSettingKey);
     _ftpSetting.FtpUsername = _vendorSettingRepo.GetVendorSetting(SapphVendorID, FtpUsernameSettingKey);
     _ftpSetting.FtpPassword = _vendorSettingRepo.GetVendorSetting(SapphVendorID, FtpPasswordSettingKey);
     _ftpSetting.Path        = _vendorSettingRepo.GetVendorSetting(SapphVendorID, PathSettingKey);
 }
示例#2
0
        void FillSettings(FtpSettingTypes type)
        {
            switch (type)
            {
            case FtpSettingTypes.PurchaseOrder:
                _ftpSetting.Path = _vendorSettingRepo.GetVendorSetting(SapphVendorID, PathSettingKey);
                break;

            case FtpSettingTypes.PurchaseOrderReceivedConfirmation:
                _ftpSetting.Path = _vendorSettingRepo.GetVendorSetting(SapphVendorID, PathReceivedConfirmationPurchaseOrderSettingkey);
                break;

            default:
                throw new NotImplementedException();
            }

            _ftpSetting.FtpAddress  = _vendorSettingRepo.GetVendorSetting(SapphVendorID, FtpAddressSettingKey);
            _ftpSetting.FtpUsername = _vendorSettingRepo.GetVendorSetting(SapphVendorID, FtpUsernameSettingKey);
            _ftpSetting.FtpPassword = _vendorSettingRepo.GetVendorSetting(SapphVendorID, FtpPasswordSettingKey);

            var connectorID = _vendorSettingRepo.GetVendorSetting(SapphVendorID, RelatedConnectorID).ParseToInt();

            if (connectorID == null)
            {
                throw new NullReferenceException("ConnectorID cannot be null");
            }

            _sapphConnectorID = connectorID.Value;
        }
示例#3
0
        public void Process()
        {
            var listOfSapphVendors = _vendorRepo.GetVendorAndChildVendorsByID(DefaultVendorID);

            foreach (var vendor in listOfSapphVendors) //todo: REMOVE THIS
            {
                int    connectorID;
                string ILNClientNumber = _vendorSettingRepo.GetVendorSetting(vendor.VendorID, SettingKeyILNClientNumber);
                if (!string.IsNullOrEmpty(ILNClientNumber))
                {
                    if (int.TryParse(_vendorSettingRepo.GetVendorSetting(vendor.VendorID, SettingKeySapphConnectorID), out connectorID))
                    {
                        try
                        {
                            FillSettings(vendor.VendorID);
                        }
                        catch (Exception error)
                        {
                            _log.Info(string.Format("Faild to get settings from database, please check your setting in the vendorsetting table. Error Message: '{2}'", error.Message));
                            continue;
                        }

                        ProcessWebOrders(connectorID, ILNClientNumber);
                        ProcessCancellationWebOrders(connectorID, ILNClientNumber);
                        ProcessReturnedWebOrders(connectorID, ILNClientNumber);
                    }
                    else
                    {
                        _log.Info("RelatedConnectorID setting key does not exists!");
                    }
                }
                else
                {
                    _log.Info(string.Format("ILNClientNumber is missing for vendor '{0}'. Please insert vendor setting '{1}'", vendor, SettingKeyILNClientNumber));
                    continue;
                }
            }
        }
示例#4
0
        public ArchiveService(IVendorSettingRepository vendorSettingRepo)
        {
            _vendorSettingRepo = vendorSettingRepo;

            _archiveDirectoryPath = _vendorSettingRepo.GetVendorSetting(SapphVendorID, ArchiveDirectorySettingKey);
        }
示例#5
0
        private FtpManager GetFtpManager(SaveTo saveTo)
        {
            var ftpSetting = new FtpSetting
            {
                FtpAddress  = _vendorSettingRepo.GetVendorSetting(SapphVendorID, FtpAddressSettingKey),
                FtpUsername = _vendorSettingRepo.GetVendorSetting(SapphVendorID, FtpUsernameSettingKey),
                FtpPassword = _vendorSettingRepo.GetVendorSetting(SapphVendorID, FtpPasswordSettingKey),
                Path        = GetDirectory(saveTo)
            };

            var ftpManager = new FtpManager(ftpSetting.FtpUri, null, false, true);

            return(ftpManager);
        }