public void Delete(string value) { var dataQuery = new CurrencyDataModel(); dataQuery.CurrencyId = int.Parse(value); CurrencyDataManager.Delete(dataQuery, SessionVariables.RequestProfile); }
private SingleEntityDataServiceResponse <Currency> GetCurrencyByCode(GetCurrencyByCodeDataRequest request) { CurrencyDataManager manager = this.GetDataManagerInstance(request.RequestContext); Currency currency = manager.GetCurrencyByCode(request.CurrencyCode, request.Columns); return(new SingleEntityDataServiceResponse <Currency>(currency)); }
private EntityDataServiceResponse <CurrencyAmount> GetChannelCurrencies(GetChannelCurrenciesDataRequest request) { CurrencyDataManager manager = this.GetDataManagerInstance(request.RequestContext); PagedResult <CurrencyAmount> currencies = manager.GetChannelCurrencies(request.QueryResultSettings); return(new EntityDataServiceResponse <CurrencyAmount>(currencies)); }
public PortfolioLogic(YahooFinanceClient yahooFinanceClient, TransactionDataManager transactionDataManager, ILogger <PortfolioLogic> logger, CurrencyClient currencyClient, CurrencyDataManager currencyDataManager) { _yahooFinanceClient = yahooFinanceClient; _transactionDataManager = transactionDataManager; _logger = logger; _currencyClient = currencyClient; _currencyDataManager = currencyDataManager; }
public CurrencyDataModel GetById(string value) { var dataQuery = new CurrencyDataModel(); dataQuery.CurrencyId = int.Parse(value); var result = CurrencyDataManager.GetEntityDetails(dataQuery, SessionVariables.RequestProfile, 1); return(result[0]); }
// GET api/summary/GetList public IEnumerable <CurrencyDataModel> GetList(string value, string value1) { var settingCategory = value1; var searchString = value; var dictionaryObject = JsonConvert.DeserializeObject <Dictionary <string, string> >(searchString); // save search filter parameters in user preference if (dictionaryObject != null) { foreach (var searchFilterColumnName in dictionaryObject.Keys) { var searchFilterValue = dictionaryObject[searchFilterColumnName]; PerferenceUtility.UpdateUserPreference(settingCategory, searchFilterColumnName, dictionaryObject[searchFilterColumnName]); } } var dataQuery = JsonConvert.DeserializeObject <CurrencyDataModel>(searchString); return(CurrencyDataManager.GetEntityDetails(dataQuery, SessionVariables.RequestProfile)); }
/// <summary> /// Gets the exchange rate active on given date between these currencies on this channel. /// </summary> /// <param name="request">The data service request with the to and from currencies and active date.</param> /// <returns>The data service response with up to two exchange rates, which are forward and backward rates between the currencies.</returns> public EntityDataServiceResponse <ExchangeRate> GetExchangeRates(GetExchangeRatesDataRequest request) { ThrowIf.Null(request, "request"); ThrowIf.NullOrWhiteSpace(request.FromCurrency, "fromCurrency"); ThrowIf.NullOrWhiteSpace(request.ToCurrency, "toCurrency"); ReadOnlyCollection <ExchangeRate> result; CurrencyDataManager manager = new CurrencyDataManager(request.RequestContext); CurrencyL2CacheDataStoreAccessor level2CacheDataAccessor = (CurrencyL2CacheDataStoreAccessor)manager.DataStoreManagerInstance.RegisteredAccessors[DataStoreType.L2Cache]; bool updateL2Cache = DataStoreManager.DataStores[DataStoreType.L2Cache].Policy.MustUpdateOnMiss; result = level2CacheDataAccessor.GetExchangeRates(request.FromCurrency, request.ToCurrency, request.ActiveDate); updateL2Cache &= result == null; if (result == null) { ParameterSet parameters = new ParameterSet(); parameters[FromCurrencyVariable] = request.FromCurrency; parameters[ToCurrencyVariable] = request.ToCurrency; parameters[ActiveDateVariable] = request.ActiveDate; using (SqlServerDatabaseContext sqlServerDatabaseContext = new SqlServerDatabaseContext(request)) { result = sqlServerDatabaseContext.ExecuteNonPagedStoredProcedure <ExchangeRate>(GetExchangeRateProcedureName, parameters); } updateL2Cache &= result != null; } if (updateL2Cache) { level2CacheDataAccessor.PutExchangeRates(request.FromCurrency, request.ToCurrency, request.ActiveDate, result); } return(new EntityDataServiceResponse <ExchangeRate>(result.AsPagedResult())); }
public void Update([FromBody] CurrencyDataModel data) { CurrencyDataManager.Update(data, SessionVariables.RequestProfile); }
private void RefreshTariff() { if (_isPopulatingForm) { return; } if (CurrentModel == null) { return; } if (((ShipmentModel)CurrentModel).Posted || ((ShipmentModel)CurrentModel).Voided) { return; } tbxTariff.Value = 0; tbxHandlingFee.Value = 0; cbxRa.Checked = false; using (var dm = new DeliveryTariffDataManager()) { DeliveryTariffModel dlvTariff = null; if (lkpPackage.Value != null) { if (lkpDestination.Value != null) { dlvTariff = dm.GetByPackageTypeAndWeight((int)lkpPackage.Value, (int)lkpDestination.Value, tbxTtlGrossWeight.Value); } } if (dlvTariff != null) { ((ShipmentModel)CurrentModel).DeliveryFee = dlvTariff.Tariff; DeliveryTariffMinimumWeight = dlvTariff.MinWeight; } else { ((ShipmentModel)CurrentModel).DeliveryFee = 0; DeliveryTariffMinimumWeight = 0; } } if (((ShipmentModel)CurrentModel).PricingPlanId != PRICING_PLAN_DOMESTIC) { using (var tariffInternationalDataManager = new TariffInternationalDataManager()) { var tariffIntModel = tariffInternationalDataManager.GetTariff( ((ShipmentModel)CurrentModel).PricingPlanId ?? 0, lkpPackage.Value ?? 0, tbxTtlChargeable.Value ); if (tariffIntModel != null) { tbxTariff.Value = 0; tbxTtlTariff.Value = tariffIntModel.Tariff; tbxHandlingFee.Value = tariffIntModel.HandlingFee ?? 0; ((ShipmentModel)CurrentModel).CurrencyId = tariffIntModel.CurrencyId; using (var currencyDm = new CurrencyDataManager()) { var currencyModel = currencyDm.GetFirst <CurrencyModel>(WhereTerm.Default(tariffIntModel.CurrencyId, "id")); if (currencyModel != null) { ((ShipmentModel)CurrentModel).Currency = currencyModel.Name; ((ShipmentModel)CurrentModel).CurrencyRate = currencyModel.Rate; } } RefreshGrandTotal(); return; } } } else { using (var currencyDm = new CurrencyDataManager()) { var currencyModel = currencyDm.GetFirst <CurrencyModel>(WhereTerm.Default(CURRENCY_IDR, "code")); if (currencyModel != null) { ((ShipmentModel)CurrentModel).CurrencyId = currencyModel.Id; ((ShipmentModel)CurrentModel).Currency = currencyModel.Name; ((ShipmentModel)CurrentModel).CurrencyRate = currencyModel.Rate; } } } using (var customerTariffDataManager = new CustomerTariffDataManager()) { if (lkpDestination.Value != null) { var customerTariffModel = customerTariffDataManager.GetTariff( BaseControl.CityId, (int)lkpDestination.Value, lkpService.Value ?? 0, lkpPackage.Value ?? 0, BaseControl.CorporateId, tbxTtlChargeable.Value ); if (customerTariffModel != null) { tbxTariff.Value = customerTariffModel.Tariff; tbxHandlingFee.Value = customerTariffModel.HandlingFee; cbxRa.Checked = customerTariffModel.Ra ?? false; MinWeight = customerTariffModel.MinWeight; if (MinWeight > 0 && tbxTtlGrossWeight.Value < MinWeight) { tbxTtlGrossWeight.Value = MinWeight; } RefreshGrandTotal(); return; } } } using (var tariffDataManager = new TariffDataManager()) { if (lkpDestination.Value != null) { var tariffModel = tariffDataManager.GetTariff( BaseControl.CityId, (int)lkpDestination.Value, lkpService.Value ?? 0, lkpPackage.Value ?? 0, tbxTtlChargeable.Value ); if (tariffModel != null) { tbxTariff.Value = tariffModel.Tariff; tbxHandlingFee.Value = tariffModel.HandlingFee; cbxRa.Checked = tariffModel.Ra ?? false; MinWeight = tariffModel.MinWeight; if (MinWeight > 0 && tbxTtlGrossWeight.Value < MinWeight) { tbxTtlGrossWeight.Value = MinWeight; } RefreshGrandTotal(); return; } } } tbxTariff.Text = @"0"; tbxHandlingFee.Text = @"0"; MinWeight = 0; RefreshGrandTotal(); }