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); }
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; }
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; } } }
public ArchiveService(IVendorSettingRepository vendorSettingRepo) { _vendorSettingRepo = vendorSettingRepo; _archiveDirectoryPath = _vendorSettingRepo.GetVendorSetting(SapphVendorID, ArchiveDirectorySettingKey); }
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); }