public PartnershipSummaryReportBuilder(CurrencyService currencyService, ChurchService churchService, IRepository<Partnership> repository) { _service = currencyService; _churchService = churchService; _repository = repository; }
public PostAdminController() { topicService = new ForumTopicService(); boardService = new ForumBoardService(); postService = new ForumPostService(); currencyService = new CurrencyService(); userService = new UserService(); rateService = new ForumRateService(); buyService = new ForumBuyLogService(); userIncomeService = new UserIncomeService(); moderatorService = new ModeratorService(); }
protected void ParseCsvIntoOptionList(TestTicket ticketDetails, Product product) { try { if (string.IsNullOrEmpty(ticketDetails.AdditionalDetailsCsv) || !ticketDetails.AdditionalDetailsCsv.Contains(",")) { return; } var sbTemp = new StringBuilder(); var sbQuantHtml = new StringBuilder(); var sbTotalHtml = new StringBuilder(); var allOptions = ticketDetails.AdditionalDetailsCsv.Split(','); foreach (var option in allOptions) { if (string.IsNullOrEmpty(option)) { continue; } var arr = option.Split('|'); var childSku = arr[0]; var productDimension = product.ProductDimensions.FirstOrDefault(x => x.SysID.Equals(childSku, StringComparison.CurrentCultureIgnoreCase)); if (productDimension == null || productDimension.Prices == null || !productDimension.Prices.Any()) { continue; } var currency = CurrencyService.GetCurrencyByCode(ddlCurrency.SelectedValue); var price = productDimension.Prices.FirstOrDefault(x => x.CurrencyCode.Equals(currency.ISOCode, StringComparison.CurrentCultureIgnoreCase)); sbTemp.AppendLine(string.Format("{0} <b> {1}{2}</b> <br/>", arr[1], currency.Symbol, price.Amount)); sbQuantHtml.AppendLine(string.Format(@"<b class=""minus"" onclick=""ChangeValue('{0}', -1, '{1}')"" >-</b> <b class=""plus"" onclick=""ChangeValue('{0}', 1, '{1}')"" >+ <span id=""sp_quantity_{0}""></span></b><br/>", childSku, product.SysID)); sbTotalHtml.AppendLine(string.Format(@"<input type=""hidden"" id=""hdn_price_{0}"" value=""{1}""/><input type=""hidden"" id=""hdn_currency_{0}"" value=""{2}"" /><span id=""sp_total_{0}""></span><br/>", childSku, price.Amount, currency.Symbol)); } ticketDetails.PriceOptionHtml = sbTemp.ToString(); ticketDetails.QuantityOptionHtml = sbQuantHtml.ToString(); ticketDetails.TotalOptionHtml = sbTotalHtml.ToString(); } catch (Exception ex) { Log(ex.Message); } }
public void CurrencyService_Calling_GetCurrencyConversions_Returns_Data() { //Arrange var currencyService = new CurrencyService(); //Act var rates = currencyService.GetCurrencyConversions(); //Assert Assert.IsNotNull(rates); Assert.IsTrue(rates.Count > 0); }
public CurrencyServiceTest() { _currencyGetterServiceMock = new Mock <ICurrencyGetterService>(); _xmlReaderMock = new Mock <IXmlReader>(); _dateCheckerMock = new Mock <IDateService>(); _cacheDatabaseMock = new Mock <ICacheDatabase>(); _currencyService = new CurrencyService(_currencyGetterServiceMock.Object, _xmlReaderMock.Object, _dateCheckerMock.Object, _cacheDatabaseMock.Object); }
public async Task ConvertendoMoedaBRLToUSD() { var BRLToUSD = CurrencyService.ConvertAmountGivenCurrenCurrencyToExpectedCurrency(12.50m, "BRL", "USD"); Assert.IsTrue(BRLToUSD > 0, "O Valor Não pode ser zero "); Assert.IsTrue(Math.Ceiling(BRLToUSD) == Math.Ceiling(3.23m)); var BRLToEUR = CurrencyService.ConvertAmountGivenCurrenCurrencyToExpectedCurrency(12.50m, "BRL", "EUR"); Assert.IsTrue(BRLToEUR > 0, "O Valor Não pode ser zero "); Assert.IsTrue(Math.Ceiling(BRLToEUR) == Math.Ceiling(2.75131m)); }
public void Create_DisplayMessageNotSupplied_DomainValidationExceptionThrow() { var id = Guid.NewGuid(); var name = "CAD"; var displayMessage = String.Empty; var currencyRepositoryStub = MockRepository.GenerateStub <ICurrencyRepository>(); _currencyService = new CurrencyService(_userContext, currencyRepositoryStub, MockRepository.GenerateStub <IQueueDispatcher <IMessage> >()); CreateCurrency(id, name, displayMessage); Assert.IsTrue(_domainValidationException.ResultContainsMessage(Messages.DisplayMessageNotSupplied)); }
public InvoicesController() { invoiceService = new InvoiceService(); currencyService = new CurrencyService(); categoryService = new CategoryService(); customerService = new CustomersService(); itemService = new ItemService(); taxService = new TaxService(); defaultService = new DefaultService(); branchService = new BranchService(); emailService = new EmailService(); }
public InvoiceTollTariffsController(InvoiceNumberService invoiceNumSvc, ListReleaseInvoiceService listReleaseInvoiceSvc, TemplateInvoiceService templateInvoiceSvc, CustomerService cumtomerSvc, InvoiceService invoiceSvc, BanksService banksSvc, CurrencyService currencySvc, ProductService productSvc, UnitService unitSvc) { _unitSvc = unitSvc; _listReleaseInvoiceSvc = listReleaseInvoiceSvc; _templateInvoiceSvc = templateInvoiceSvc; _invoiceNumberSvc = invoiceNumSvc; _cumtomerSvc = cumtomerSvc; _invoiceSvc = invoiceSvc; _banksSvc = banksSvc; _currencySvc = currencySvc; _productSvc = productSvc; }
public BillsController() { billService = new BillService(); vendorService = new VendorService(); categoryService = new CategoryService(); currencyService = new CurrencyService(); itemService = new ItemService(); taxService = new TaxService(); defaultService = new DefaultService(); branchService = new BranchService(); emailService = new EmailService(); }
public static void Apply(Player player, Action OnApply = null) { CurrencyService.AddCurrency(CurrencyCode.RP, Config.bestScorePrize) .Then(() => CurrencyService.GetCurrency(CurrencyCode.RP)) .Then((result) => { player.SetCurrency(result); if (OnApply != null) { OnApply(); } }); }
public void TestGetAllNoCurrencies() { ILoggerFactory loggerFactory = new LoggerFactory(); using (var sqliteMemoryWrapper = new SqliteMemoryWrapper()) { var currencyService = new CurrencyService(loggerFactory, sqliteMemoryWrapper.DbContext); IEnumerable <Currency> currencies = currencyService.GetAll(); Assert.AreEqual(0, currencies.Count()); } }
public void CurrencyService_Convert_100_GBP_To_USD_Returns_135_58() { //Arrange var currencyService = new CurrencyService(); //Act var result = currencyService.Convert(100, Models.CurrencyType.GBP, Models.CurrencyType.USD); Assert.IsNotNull(result); Assert.IsTrue(result > 0); Assert.IsTrue(result == 135.58m); }
protected void btnUpdateCurrencies_Click(object sender, EventArgs e) { if (SaasDataService.IsSaasEnabled && !SaasDataService.CurrentSaasData.HaveBankIntegration) { lMessage.Text = Resource.Admin_DemoMode_NotAvailableFeature; lMessage.Visible = true; return; } CurrencyService.UpdateCurrenciesFromCentralBank(); CurrencyService.RefreshCurrency(); }
public AnimalRace(RaceOptions options, CurrencyService currency, RaceAnimal[] availableAnimals) { this._currency = currency; this._options = options; this._animalsQueue = new Queue <RaceAnimal>(availableAnimals); this.MaxUsers = availableAnimals.Length; if (this._animalsQueue.Count == 0) { CurrentPhase = Phase.Ended; } }
public override void ProcessForm(Order order) { int index = 0; if (!string.IsNullOrEmpty(order.BillingContact.Name)) { index = order.BillingContact.Name.IndexOf(" "); } string first_name = string.Empty; string last_name = string.Empty; if (index > 0) { first_name = order.BillingContact.Name.Substring(0, index).Trim(); last_name = order.BillingContact.Name.Substring(index + 1).Trim(); } else { first_name = order.BillingContact.Name.Trim(); } new PaymentFormHandler { FormName = "_xclick", Method = FormMethod.POST, Url = GetUrl(), InputValues = new Dictionary <string, string> { { "cmd", Command }, { "business", EMail }, { "charset", "utf-8" }, { "currency_code", CurrencyCode }, { "item_name", string.Format("Order #{0}", order.OrderID) }, { "invoice", order.Number }, { "amount", CurrencyService.ConvertCurrency(ShowTaxAndShipping ? order.Sum - order.TaxCost - order.ShippingCost : order.Sum, CurrencyValue, order.OrderCurrency.CurrencyValue).ToString("F2").Replace(",", ".") }, { "tax", CurrencyService.ConvertCurrency(ShowTaxAndShipping ? order.TaxCost : 0, CurrencyValue, order.OrderCurrency.CurrencyValue).ToString("F2").Replace(",", ".") }, { "shipping", CurrencyService.ConvertCurrency(ShowTaxAndShipping ? order.ShippingCost : 0, CurrencyValue, order.OrderCurrency.CurrencyValue).ToString("F2").Replace(",", ".") }, { "address1", (order.BillingContact.Address ?? string.Empty).Replace("\n", "") }, { "city", order.BillingContact.City ?? string.Empty }, { "country", AdvantShop.Repository.CountryService.GetIso2(order.BillingContact.Country ?? string.Empty) ?? string.Empty }, { "lc", AdvantShop.Repository.CountryService.GetIso2(order.BillingContact.Country ?? string.Empty) ?? string.Empty }, //{"email", order.BillingContact.Email ?? string.Empty}, { "email", order.OrderCustomer.Email ?? string.Empty }, { "first_name", first_name ?? string.Empty }, { "last_name", last_name ?? string.Empty }, { "zip", order.BillingContact.Zip ?? string.Empty }, { "state", order.BillingContact.Zone ?? string.Empty }, { "return", SuccessUrl }, { "notify_url", NotificationUrl }, { "cancel_return", CancelUrl } } }.Post(); }
public CoinMarketTask(IRepository <User> userRepository, Notifyer notifyer, HttpClientWrapper client, CurrencyService currencyService, ILogger <CoinMarketTask> logger, IRepository <Alert> alertRepository) { _userRepository = userRepository; _notifyer = notifyer; _client = client; _currencyService = currencyService; _logger = logger; _alertRepository = alertRepository; }
// GET: SearchAuto public ActionResult Index() { breadcrumbs.Add("#", Resource.Search); ViewBag.breadcrumbs = breadcrumbs; ViewBag.regions = CityService.GetAllAsSelectList(); ViewBag.autoTransportTypes = AutoTransportTypeService.GetAllAsSelectList(); ViewBag.currencies = CurrencyService.GetAllAsSelectList(); ViewBag.years = YearService.GetAllAsSelectList(); return(View()); }
public void TestBalanceSheetNoTransactions() { ILoggerFactory loggerFactory = new LoggerFactory(); using (var sqliteMemoryWrapper = new SqliteMemoryWrapper()) { var currencyFactory = new CurrencyFactory(); var usdCurrencyEntity = currencyFactory.Create(CurrencyPrefab.Usd, true); currencyFactory.Add(sqliteMemoryWrapper.DbContext, usdCurrencyEntity); var accountFactory = new AccountFactory(); Entities.Account incomeAccountEntity = accountFactory.Create(AccountPrefab.Income, usdCurrencyEntity); Entities.Account checkingAccountEntity = accountFactory.Create(AccountPrefab.Checking, usdCurrencyEntity); Entities.Account capitalAccountEntity = accountFactory.Create(AccountPrefab.Capital, usdCurrencyEntity); Entities.Account rentExpenseAccountEntity = accountFactory.Create(AccountPrefab.RentExpense, usdCurrencyEntity); Entities.Account creditCardAccountEntity = accountFactory.Create(AccountPrefab.CreditCard, usdCurrencyEntity); accountFactory.Add(sqliteMemoryWrapper.DbContext, incomeAccountEntity); accountFactory.Add(sqliteMemoryWrapper.DbContext, checkingAccountEntity); accountFactory.Add(sqliteMemoryWrapper.DbContext, capitalAccountEntity); accountFactory.Add(sqliteMemoryWrapper.DbContext, rentExpenseAccountEntity); accountFactory.Add(sqliteMemoryWrapper.DbContext, creditCardAccountEntity); var accountService = new AccountService( loggerFactory, sqliteMemoryWrapper.DbContext ); var currencyService = new CurrencyService( loggerFactory, sqliteMemoryWrapper.DbContext ); var balanceSheetService = new BalanceSheetService( loggerFactory, sqliteMemoryWrapper.DbContext ); BalanceSheet balanceSheet = balanceSheetService.Generate(new DateTime(2018, 1, 1)); List <BalanceSheetItem> balanceSheetAssets = balanceSheet.Assets.ToList(); List <BalanceSheetItem> balanceSheetLiabilities = balanceSheet.Liabilities.ToList(); Assert.AreEqual(usdCurrencyEntity.Symbol, balanceSheet.CurrencySymbol); Assert.AreEqual(0, balanceSheet.TotalAssets); Assert.AreEqual(0, balanceSheet.TotalLiabilities); Assert.AreEqual(0, balanceSheetAssets.Count); Assert.AreEqual(0, balanceSheetLiabilities.Count); } }
static void Main(string[] args) { DbContextOptionsBuilder dbContextOptionsBuilder = new DbContextOptionsBuilder(); var connection = dbContextOptionsBuilder .UseSqlServer("Server=(localdb)\\MSSQLLocalDB;Database=SpaceWeb;Trusted_Connection=True"); SpaceDbContext spaceDbContext = new SpaceDbContext(connection.Options); ExchangeRateToUsdCurrentRepository exchangeRateToUsdCurrentRepository = new ExchangeRateToUsdCurrentRepository(spaceDbContext); ExchangeAccountHistoryRepository exchangeAccountHistoryRepository = new ExchangeAccountHistoryRepository(spaceDbContext); ExchangeRateToUsdHistoryRepository exchangeRateToUsdHistoryRepository = new ExchangeRateToUsdHistoryRepository(spaceDbContext); var configExpression = new MapperConfigurationExpression(); var mapperConfiguration = new MapperConfiguration(configExpression); var mapper = new Mapper(mapperConfiguration); var contextAccessor = new HttpContextAccessor(); TransactionBankRepository transactionBankRepository = new TransactionBankRepository(spaceDbContext); var bankAccountRepository = new BankAccountRepository(spaceDbContext, mapper, contextAccessor, transactionBankRepository); var userRepository = new UserRepository(spaceDbContext, bankAccountRepository); IUserService userService = new UserService(userRepository, contextAccessor); var currencyService = new CurrencyService(userService, exchangeRateToUsdCurrentRepository, exchangeAccountHistoryRepository, exchangeRateToUsdHistoryRepository, mapper); var currentDate = DateTime.Now; while (true) { if ((currentDate.Minute % 3) == 0) { currencyService.MoveCurrentExchangesDbToHistoryDb(exchangeRateToUsdCurrentRepository, exchangeRateToUsdHistoryRepository, mapper); currencyService.DeleteCurrentExchRatesFromDb(exchangeRateToUsdCurrentRepository); currencyService.PutCurrentExchangeRatesToDb( exchangeRateToUsdCurrentRepository, currencyService.GetExchangeRates()); Console.Write($"Current exchanges update for History DB at {currentDate}"); Thread.Sleep(3 * 59 * 1000); // 59 - because updating exchanges takes ~ 1 second and timer gets a displacement. } currentDate = DateTime.Now; currentDate = currentDate.AddSeconds(-currentDate.Second); } }
public async Task Get_CodeIsNull_ShouldThrow() { // Arrange var options = BuildContextOptions(); using (var context = new BorrowBuddyContext(options)) { var service = new CurrencyService(context); // Act // Assert await Assert.ThrowsAsync <ArgumentNullException>(() => service.GetAsync(null)); } }
public ApiController( ILogger <ApiController> log, TickerService tickerService, CurrencyService currencyService, IMemoryCache memoryCache, IOptions <ExplorerSettings> settings) { this.log = log; this.tickerService = tickerService; this.currencyService = currencyService; this.memoryCache = memoryCache; this.settings = settings.Value; }
protected void Page_Load(object sender, EventArgs e) { Log("BookingAddressPayPal => Page_Load() started."); _session = GetSession(); _basket = GetBasket(); GetPayerDetails(); //handle validation make sure there is basket and session available. var currency = CurrencyService.GetCurrencyById(_basket.CurrencyId.ToString()); TotalSummary = currency.Symbol + _basket.Total; DisplayBasketDetails(_basket, ucBasketDisplay, currency.Symbol); }
private void UpdateCurrency() { var cur = CurrencyService.Currency(ddlCurrs.SelectedValue); CurrencyValue = cur.Value; CurrencyCode = cur.Iso3; CurrencySymbol = cur.Symbol; CurrencyNumCode = cur.NumIso3; IsCodeBefore = cur.IsCodeBefore; Currency = cur; OldCurrencyValue = !string.IsNullOrEmpty(hfOldCurrencyValue.Value) ? Convert.ToDecimal(hfOldCurrencyValue.Value) : CurrencyValue; hfOldCurrencyValue.Value = cur.Value.ToString(); }
public UserModule(ILoggingService loggingService, DatabaseService databaseService, UserService userService, PublisherService publisherService, UpdateService updateService, CurrencyService currencyService, Rules rules, Settings.Deserialized.Settings settings) { _loggingService = loggingService; _databaseService = databaseService; _userService = userService; _publisherService = publisherService; _updateService = updateService; _currencyService = currencyService; _rules = rules; _settings = settings; }
public void GetCurrencyTest() { var request = new CurrencyListRequest(this.connectionSettings.AccessToken, this.connectionSettings.ClientSecret); var currency = CurrencyService.GetCurrencyAsync(request, "SEK").GetAwaiter().GetResult(); Assert.AreEqual("SEK", currency.Code); Assert.AreEqual(1, currency.BuyRate); Assert.AreEqual("Svensk krona", currency.Description); Assert.AreEqual(false, currency.IsAutomatic); Assert.AreEqual(1, currency.SellRate); Assert.AreEqual(1, currency.Unit); Assert.AreEqual(null, currency.Url); }
public void Edit_UserHasInsufficientSecurityClearance_DomainValidationExceptionThrow() { var name = "CAD"; var displayMessage = "All prices in Canadian Dollars"; _userContext = TestUserContext.Create( "*****@*****.**", "Graham Robertson", "Operations Manager", UserRole.Member); var currencyRepositoryStub = MockRepository.GenerateMock <ICurrencyRepository>(); _currencyService = new CurrencyService(_userContext, currencyRepositoryStub, MockRepository.GenerateStub <IQueueDispatcher <IMessage> >()); EditCurrency(_currencyForEditId, name, displayMessage); Assert.IsTrue(_domainValidationException.ResultContainsMessage(Messages.InsufficientSecurityClearance)); }
public ActionResult Create(int id) //auto ID { User user = UserService.GetUserByEmail(User.Identity.Name); Auto auto = user?.Autoes.FirstOrDefault(a => a.ID == id && a.StatusID == 2); if (auto == null) { return(HttpNotFound()); } Auction auction = new Auction() { AutoID = auto.ID, DateCreated = DateTime.Now, StartPrice = 0, CurrentPrice = 0, PriceUSDSearch = 0, PriceUAHSearch = 0, CurrencyID = 1, StatusID = 1, //draft Deadline = DateTime.Now }; AuctionService.Create(auction); //string jobID = HangfireService.CreateJobForAuctionDeletion(auction); //auction.DeletionJobID = jobID; //AuctionService.Edit(auction); ViewBag.currencies = CurrencyService.GetAllAsSelectList(); ViewBag.recommendedPrice = AuctionService.GetRecommendedPrice(auto.PriceUSD, auto.PriceUAH); AuctionCreateVM auctionCreateVM = auction; AutoDetailsVM autoVM = auto; List <AutoPhotoVM> orderedPhotos = autoVM.AutoPhotoes.OrderByDescending(p => p.IsMain).ToList(); AutoPhotoVM mainPhoto = orderedPhotos[0]; ViewBag.mainPhoto = mainPhoto; ViewBag.autoVM = autoVM; breadcrumbs.Add("#", Resource.AuctionCreate); ViewBag.breadcrumbs = breadcrumbs; int limit = 2000; int.TryParse(XCarsConfiguration.AutoDescriptionMaxLength, out limit); ViewBag.autoDescriptionMaxLength = limit; return(View(auctionCreateVM)); }
public CurrencyServiceTests() { _marketMock = new Mock <IMarket>(); _marketMock.Setup(x => x.Currencies).Returns(() => new[] { new Currency("USD"), new Currency("SEK") }); _marketMock.Setup(x => x.DefaultCurrency).Returns(new Currency("USD")); _cookieServiceMock = new Mock <CookieService>(); _cookieServiceMock.Setup(x => x.Get(It.IsAny <string>())).Returns("USD"); _currentMarketMock = new Mock <ICurrentMarket>(); _currentMarketMock.Setup(x => x.GetCurrentMarket()).Returns(_marketMock.Object); _subject = new CurrencyService(_currentMarketMock.Object, _cookieServiceMock.Object); }
public PatreonRewardsService(IBotCredentials creds, DbService db, CurrencyService currency, DiscordSocketClient client) { _creds = creds; _db = db; _currency = currency; if (string.IsNullOrWhiteSpace(creds.PatreonAccessToken)) { return; } _log = LogManager.GetCurrentClassLogger(); Updater = new Timer(async(load) => await RefreshPledges((bool)load), client.ShardId == 0, client.ShardId == 0 ? TimeSpan.Zero : TimeSpan.FromMinutes(2), Interval); }
public TopicController() { boardService = new ForumBoardService(); topicService = new ForumTopicService(); postService = new ForumPostService(); incomeService = new UserIncomeService(); attachService = new AttachmentService(); userService = new UserService(); rateService = new ForumRateService(); currencyService = new CurrencyService(); buylogService = new ForumBuyLogService(); moderatorService = new ModeratorService(); }
public PartnersPartnershipReportBuilder(CurrencyService currencyService, IRepository<Partnership> repository) { _currencyService = currencyService; _repository = repository; }
public PartnershipArmDrillDownReportBuilder(IRepository<Partnership> repository, CurrencyService currencyService) { _repository = repository; _currencyService = currencyService; }
public PartnersRankingBuilder(ChurchService churchService, CurrencyService currencyService, IRepository<Partnership> repository) { _churchService = churchService; _currencyService = currencyService; _repository = repository; }
public YearReportBuilder(IRepository<Partnership> repository, CurrencyService currencyService) { _repository = repository; _currencyService = currencyService; }