public MainWindow() : base(Gtk.WindowType.Toplevel) { Build(); var currency = new ReadCurrency("http://www.cbr.ru/scripts/XML_daily.asp"); Currencies = currency.GetCurrencyList(); }
private void SetDefaults(UserSettings settings) { SelectedCountry = CountryList?.FirstOrDefault( country => country.CountryCode == settings.ReceiveSettings.CountryCode) ?? CountryList?.FirstOrDefault(); SelectedCountrySubdivision = CountrySubdivisionList.FirstOrDefault( countrySubdivision => countrySubdivision.CountrySubdivisionCode == settings.ReceiveSettings.CountrySubdivisionCode) ?? CountrySubdivisionList.FirstOrDefault(); SelectedCurrency = CurrencyList?.FirstOrDefault(curr => curr.CurrencyCode == settings.ReceiveSettings.CurrencyCode) ?? CurrencyList?.FirstOrDefault(); SelectedAmountRange = AmountRangeList?.FirstOrDefault(ar => ar.Code == settings.ReceiveSettings.AmountRange) ?? AmountRangeList?.FirstOrDefault(); CustomAmount = settings.ReceiveSettings.CustomAmount; SelectedItemChoice = ItemChoiceList?.FirstOrDefault(ic => ic.Code == settings.ReceiveSettings.ItemChoice) ?? ItemChoiceList?.FirstOrDefault(); SelectedServiceOption = ServiceOptionList?.FirstOrDefault(so => so.Key == settings.ReceiveSettings.ServiceOption) ?? ServiceOptionList?.FirstOrDefault(); SelectedThirdPartyType = ThirdPartyTypeList?.FirstOrDefault(tp => tp == settings.ReceiveSettings.ThirdPartyType) ?? ThirdPartyTypeList?.FirstOrDefault(); }
private void SetDefaults(UserSettings settings) { SelectedRefundReason = RefundReasonList?.FirstOrDefault(reason => reason.Identifier == settings.SendReversalSettings.RefundReasonCode) ?? RefundReasonList?.FirstOrDefault(); RefundFee = settings.SendReversalSettings.RefundFee; SelectedCountry = CountryList?.FirstOrDefault(country => country.CountryCode == settings.SendReversalSettings.CountryCode); SelectedCountrySubdivision = CountrySubdivisionList.FirstOrDefault(countrySubdivision => countrySubdivision.CountrySubdivisionCode == settings.SendReversalSettings.CountrySubdivisionCode) ?? CountrySubdivisionList.FirstOrDefault(); SelectedCurrency = CurrencyList?.FirstOrDefault(curr => curr.CurrencyCode == settings.SendReversalSettings.CurrencyCode) ?? CurrencyList?.FirstOrDefault(); SelectedAmountRange = AmountRangeList?.FirstOrDefault(ar => ar.Code == settings.SendReversalSettings.AmountRange) ?? AmountRangeList?.FirstOrDefault(); SelectedItemChoice = ItemChoiceList?.FirstOrDefault(ic => ic.Code == settings.SendReversalSettings.ItemChoice) ?? ItemChoiceList?.FirstOrDefault(); SelectedServiceOption = ServiceOptionList?.FirstOrDefault(so => so.Key == settings.SendReversalSettings.ServiceOption) ?? ServiceOptionList?.FirstOrDefault(); SelectedThirdPartyType = ThirdPartyTypeList?.FirstOrDefault(tp => tp == settings.SendReversalSettings.ThirdPartyType) ?? ThirdPartyTypeList?.FirstOrDefault(); }
/// <summary> /// Edit Agent. /// </summary> /// <param name="agent"></param> public void EditAgent(EnvironmentAgent agent) { if (agent == null) { return; } SelectedEnvironment = agent.Environment; SelectedCountry = CountryList?.Find(x => x.CountryCode == agent.AgentCountryIsoCode); var selectedSub = CountrySubdivisionList?.Find(x => x.CountrySubdivisionName != null && agent.AgentState != null && x.CountrySubdivisionName.ToUpper().Contains(agent.AgentState.ToUpper())); if (selectedSub != null && selectedSub.CountrySubdivisionCode.Contains("-")) { selectedSub.CountrySubdivisionCode = selectedSub.CountrySubdivisionCode.Split('-')[1]; } SelectedCountrySubdivision = selectedSub; AgentId = agent.AgentId; AgentPos = agent.AgentSequence; AgentPassword = agent.AgentPassword; Language = agent.Language; SelectedCurrency = CurrencyList?.Find(x => x.CurrencyCode == agent.SendCurrencies?.First()); }
/// <summary> /// Initialises static members of the <see cref="CurrencyRepository"/> class. /// </summary> static CurrencyRepository() { Cache = new CurrencyList(); var alreadyLoadedCurrencies = new HashSet <string>(); // Load currencies var data = new Currencies(); var currencies = data.CurrencyList.Root?.Element("CcyTbl")?.Elements("CcyNtry"); if (currencies == null) { // Should not happen... return; } foreach (var entry in currencies) { var currency = new Currency() { Name = entry.Element("CcyNm")?.Value, Code = entry.Element("Ccy")?.Value, }; if (alreadyLoadedCurrencies.Contains(currency.Code)) { continue; } Cache.Add(currency); alreadyLoadedCurrencies.Add(currency.Code); } }
private void FillFromSettings() { Name = PlugInSettings.Default.Name; Strasse = PlugInSettings.Default.Strasse; Plz = PlugInSettings.Default.Plz; Ort = PlugInSettings.Default.Ort; Phone = PlugInSettings.Default.TelNr; Kontakt = PlugInSettings.Default.Contact; Email = PlugInSettings.Default.Email; VatId = PlugInSettings.Default.Vatid; Gln = PlugInSettings.Default.BillerGln; Save2Form = false; CountryCodeSelected = CountryCodes.Find(p => p.Code == PlugInSettings.Default.Land); VatDefaultList = PlugInSettings.Default.VatDefaultValues; VatSelected = VatDefaultList.Find(p => p.MwStSatz == PlugInSettings.Default.MwStDefault); VatText = PlugInSettings.Default.VStText; IsVatBerechtigt = PlugInSettings.Default.VStBerechtigt; CurrSelected = CurrencyList.Find(p => p.Code == PlugInSettings.Default.Currency); CSel = PlugInSettings.Default.Currency; Bank = PlugInSettings.Default.Bank; Inhaber = PlugInSettings.Default.Kontowortlaut; Iban = PlugInSettings.Default.Iban; Bic = PlugInSettings.Default.Bic; AnyTextChanged = false; }
public CurrencyPage() { InitializeComponent(); // Determine the visibility of the dark background. Visibility darkBackgroundVisibility = (Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"]; // Icon dark or light if (darkBackgroundVisibility == Visibility.Visible) { BitmapImage bm = new BitmapImage(new Uri(@"/Assets/dollar.png", UriKind.RelativeOrAbsolute)); iconApp.Source = bm; } else { BitmapImage bm = new BitmapImage(new Uri(@"/Assets/dollarblack.png", UriKind.RelativeOrAbsolute)); iconApp.Source = bm; } if (Models.CurrencyUpdate.firstTime == false) { Models.CurrencyUpdate.first(); } if (isCreated == false) { CurrencyBoxList.ItemsSource = CurrencyList.GetCurrencyStart(); isCreated = true; } else { CurrencyBoxList.ItemsSource = CurrencyList.GetCurrency(); } }
protected override void Init() { _symbolGraph = new BarMarketGraph(this) { Name = "Bar market graph" }; _pathLogic = new PathLogic <CurrencyNode>(1000); foreach (var symbol in Symbols) { if (symbol.IsNull || !symbol.IsTradeAllowed) { continue; } var barSymbol = new BarSymbol(symbol, this); var commission = symbol.CalculateCommission(Account.Type, false); if (double.IsNaN(commission)) { commission = 0; } _symbolGraph.AddEdge(symbol.BaseCurrency, symbol.CounterCurrency, barSymbol, commission); _symbolGraph.AddEdge(symbol.CounterCurrency, symbol.BaseCurrency, barSymbol, commission); } _currencyId = _symbolGraph[Currency]?.Id ?? -1; _currencyListIds = new List <int>(); foreach (var currency in CurrencyList.ParseCsvLine()) { var node = _symbolGraph[currency]; if (node != null) { _currencyListIds.Add(node.Id); } } }
void CurrencyList_Refreshing(object sender, EventArgs e) { Console.WriteLine("refreshing"); createList(); CurrencyList.ItemsSource = productArray; CurrencyList.EndRefresh(); }
public override void FeatureActivated(SPFeatureReceiverProperties properties) { base.FeatureActivated(properties); SalesOrderDiagnosticService.LogMessage(CategoryID.Activation, String.Format("Activating feature: {0}", properties.Definition.DisplayName)); try { SPWeb spWeb = (SPWeb)properties.Feature.Parent; // Create currency list for custom lookup. CurrencyList currencyList = new CurrencyList(); currencyList.Activate(spWeb); //Enable list customizations. ListCustomizations listCustomizations = new ListCustomizations(externalListTitles); listCustomizations.Activate(spWeb); // Enable reporting. Reporting reporting = new Reporting(); reporting.Activate(spWeb); SalesOrderDiagnosticService.LogMessage(CategoryID.Activation, String.Format("Feature activation succeeded for {0}", properties.Definition.DisplayName)); } catch (Exception exception) { SalesOrderDiagnosticService.LogError(CategoryID.Activation, String.Format("Failed to activate {0}: {1}", properties.Definition.DisplayName, exception.Message)); } }
public void GetMarkUpdata(bool header) { var client = new WarehouseService.WarehouseServiceClient(); TransactionHeader.MarkUpTransList.Clear(); client.GetTblSalesOrderRequestInvoiceMarkupTransProdAsync(0, TransactionHeader.Iserial, LoggedUserInfo.DatabasEname); client.GetTblSalesOrderRequestInvoiceMarkupTransProdCompleted += (s, sv) => { foreach (var row in sv.Result) { var newrow = new TblMarkupTranProdViewModel(); newrow.InjectFrom(row); newrow.CurrencyPerRow = new CRUDManagerService.GenericTable(); newrow.CurrencyPerRow.InjectFrom(CurrencyList.FirstOrDefault(w => w.Iserial == newrow.TblCurrency)); newrow.TblMarkupProd1 = new CRUDManagerService.TblMarkupProd(); newrow.TblMarkupProd1.InjectFrom(MarkupList.FirstOrDefault(w => w.Iserial == row.TblMarkupProd)); newrow.JournalAccountTypePerRow = JournalAccountTypeList.FirstOrDefault(w => w.Iserial == newrow.TblJournalAccountType); newrow.EntityPerRow = new GlService.Entity().InjectFrom(sv.entityList.FirstOrDefault(w => w.Iserial == row.EntityAccount && w.TblJournalAccountType == row.TblJournalAccountType)) as GlService.Entity; newrow.TblJournalAccountType = row.TblJournalAccountType; newrow.EntityAccount = row.EntityAccount; TransactionHeader.MarkUpTransList.Add(newrow); } Loading = false; if (TransactionHeader.MarkUpTransList.Count == 0) { AddNewMarkUpRow(false, true); } }; Loading = true; }
public MainForm() { data_set_CalanderReports = new DataSet(); data_set_salesman_list = new DataSet(); data_set_salesman_report = new DataSet(); mycurrencylist = new CurrencyList(); loginform = new Login(); viewrates = new ViewRates(); calanderreports = new CalanderReports(); salesmanreports = new SalesManReports(); simpl = new ServerImplementation(); curlist = new CurrencyList(); simpl.Start_Server_Manually(); RefreshSalesManList(); InitializeComponent(); this.menuStrip1.Visible = false; this.toolStrip1.Visible = false; LoadLoginForm(); Add_All_Action_Listners(); // for bypass login window in devlopment mode loginform.textBoxUsername.Text = "admin"; //-- loginform.textBoxPass.Text = "admin"; //-- LoginForm_Button_Login(); //-- }
public override global::System.Data.DataSet Clone() { CurrencyList cln = ((CurrencyList)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return(cln); }
public MainForm() { InitializeComponent(); CurrencyList curencyList = new CurrencyList(); client = new CurrencyConverterClient(); curencyList = client.GetCurrentcyList(); this.currencyListComboBox.DataSource = curencyList; }
public CurrencyList GetCurrentcyList() { CurrencyList currencyList = new CurrencyList(); foreach (MoneyModel moneyModel in currentList) { currencyList.Add(moneyModel.CharacterCode); } return currencyList; }
public CurrencyList GetCurrentcyList() { CurrencyList currencyList = new CurrencyList(); foreach (MoneyModel moneyModel in currentList) { currencyList.Add(moneyModel.CharacterCode); } return(currencyList); }
private async void Init() { rvCurrencies.SetLayoutManager(new LinearLayoutManager(this)); var data = await GetData(); currencyList = ConvertXmlToObject(data); currencyAdapter = new CurrencyAdapter(currencyList); rvCurrencies.SetAdapter(currencyAdapter); tvDateTime.Text = currencyList.DateTime; tvSource.Text = currencyList.Source; }
public void getCurrency() { API Request = new API("https://free.currconv.com/api/v7/currencies?apiKey=83bc82312153c2b7933c"); CurrencyList currencyList = CurrencyList.Deserialize(Request.SendAndGetResponse()); CurrencyData[] datas = currencyList.ToArray(); foreach (CurrencyData currency in datas) { fromComboBox.Items.Add(currency.id + " - " + currency.currencyName); toComboBox.Items.Add(currency.id + " - " + currency.currencyName); } }
/// <summary> /// To assign values to CurrencyTypeTotalEstBudget dropdownlist /// </summary> private void LoadCurrencyTotalEstimate() { MasterBLL objMasterBLL = new MasterBLL(); CurrencyList objCurrencyList = new CurrencyList(); objCurrencyList = objMasterBLL.LoadCurrency(); ddlCurrencyTypeTotalEstBudget.DataTextField = "CurrencyCode"; ddlCurrencyTypeTotalEstBudget.DataValueField = "CurrencyID"; ddlCurrencyTypeTotalEstBudget.DataSource = objCurrencyList; ddlCurrencyTypeTotalEstBudget.DataBind(); ddlCurrencyTypeTotalEstBudget.SelectedIndex = 0; }
public void getCurrencyList() { APIRequester currencyListRequest = new APIRequester("https://free.currconv.com/api/v7/currencies?apiKey=8a6251713f19f409c37d"); CurrencyList currencyList = CurrencyList.Deserialize(currencyListRequest.SendAndGetResponse()); CurrencyData[] datas = currencyList.ToArray(); foreach (CurrencyData currency in datas) { comboBox1.Items.Add(currency.id); comboBox2.Items.Add(currency.id); } }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { CurrencyList ds = new CurrencyList(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
public CurrencyList GetCurrentcyList() { CurrencyList currencyList = new CurrencyList(); List<Currency> courrencyList = new List<Currency>(); Currency currency = new Currency(); courrencyList = currency.ReadHtmlSite(str); foreach (Currency cur in courrencyList) { currencyList.Add(cur.LetterCode); } return currencyList; }
public static decimal Convert(string from, string to, decimal value) { try { Currency fromC = CurrencyList.GetCurrency(from); Currency toC = CurrencyList.GetCurrency(to); return(toC.CurrencyToUSD / fromC.CurrencyToUSD * value); // get to / from * value } catch { } return(value); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { List <string> list = new List <string>() { "USD", "GPB", "EUR", "CAD", "JPY", "AUD", "CHF", "DKK", "NZD", "NOK", "SGD", "ZAR", "SEK" }; CurrencyList.DataSource = list; CurrencyList.SelectedIndex = 0; CurrencyList.DataBind(); } }
public CurrencyList GetCurrentcyList() { CurrencyList currencyList = new CurrencyList(); List <Currency> courrencyList = new List <Currency>(); Currency currency = new Currency(); courrencyList = currency.ReadHtmlSite(str); foreach (Currency cur in courrencyList) { currencyList.Add(cur.LetterCode); } return(currencyList); }
/// <summary> /// To assign values to CurrencyDropdownList /// </summary> private void LoadCurrencyEstimate() { MasterBLL objMasterBLL = new MasterBLL(); CurrencyList objCurrencyList = new CurrencyList(); objCurrencyList = objMasterBLL.LoadCurrency(); ddlCurrencyTypeEstBudget.Items.Clear(); ddlCurrencyTypeEstBudget.DataTextField = "CurrencyCode"; ddlCurrencyTypeEstBudget.DataValueField = "CurrencyID"; ddlCurrencyTypeEstBudget.DataSource = objCurrencyList; ddlCurrencyTypeEstBudget.DataBind(); //ddlCurrencyTypeEstBudget.Items.Insert(0, "--Select--"); ddlCurrencyTypeEstBudget.SelectedIndex = 0; }
/// <summary> /// Initialises a new instance of the <see cref="CreateNewBudgetViewModel"/> class. /// </summary> /// <param name="readRepositories">Repositories for read models</param> public CreateNewBudgetViewModel(ReadRepositories readRepositories) { this.currencyList = readRepositories.CurrencyRepository.GetAll(); this.CreateNewBudget = new RelayCommand( () => { var budgetId = new BudgetId(Guid.NewGuid()); var currencyCode = this.SelectedCurrency?.Code; ServiceLocatorWrapper.Current.GetInstance <Kernel>().CommandBus.Submit(new AddBudgetCommand(budgetId, this.Name, currencyCode)); // TODO: navigate? }, () => !string.IsNullOrWhiteSpace(this.Name) && this.selectedCurrency != null); }
private CurrencyList LoadCurrecyListFromWeb() { CurrencyList CurrencyList = new CurrencyList(); WebDataReader WDR = new WebDataReader(); var jCurrencyList = WDR.LoadJCurrency(); if (jCurrencyList != null) { CurrencyList = GetCurrencyListFromJCurrencyList(jCurrencyList); } else { throw new Exception("Can't find currency data."); } return(CurrencyList); }
private CurrencyList GetCurrencyListFromJCurrencyList(List <JCurrency> ListOfJCurrency) { CurrencyList curlist = new CurrencyList(); foreach (var item in ListOfJCurrency) { curlist.Add(new Currency() { Id = item.Cur_ID, Name = item.Cur_Name_Eng, Rate = item.Cur_OfficialRate / item.Cur_Scale, ShortName = item.Cur_Abbreviation }); } return(curlist); }
private Currency GetInputCurrency(CurrencyList currencyList) { while (true) { string input = Console.ReadLine(); try { return(currencyList.FindCurrencyByCode(input)); } catch (ArgumentNullException) { Console.WriteLine("Can't find currency with given code. Try again."); continue; } } }
public MainWindowViewModel() { var curTime = DateTime.UtcNow; StartTimeList.Add(new KeyValuePair <int, string>(0, "Now")); for (var i = 0; i < 673; i++) { curTime = curTime.AddMinutes(5); var curTimeS = curTime.ToLocalTime().ToString("HH:mm \"GMT\"K, ddd"); var unixTimestamp = (int)(curTime.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; StartTimeList.Add(new KeyValuePair <int, string>(unixTimestamp, curTimeS)); } SelectedStartTime = StartTimeList[0]; SelectedBasis = BasisList[0]; CurrencyList.Add(new KeyValuePair <string, string>("USD", "USD")); SelectedCurrency = CurrencyList[0]; SelectedTimeUnit = TimeUnitList[1]; }
// Constructors public MainVM() { SelectedCurrency = Currencies.EUR; foreach (var ccy in Enum.GetValues(typeof(Currencies))) { CurrencyList.Add((Currencies)ccy); } SelectedPackage = null; foreach (var stockEntry in (new SampleManager().CurrentStock.OnStock)) { SoftwarePackages.Add(new StockEntryVM(stockEntry)); } AddCommand = new Command(new Action(AddSoftwarePackage), new Func <bool>(CanAdd)); EditCommand = new Command(new Action(EditSoftwarePackage), new Func <bool>(CanEdit)); DeleteCommand = new Command(new Action(DeleteSoftwarePackage), new Func <bool>(CanDelete)); }
public CurrencyList GetCurrentcyList() { CurrencyList currencyList = null; if (currentList != null) { currencyList = new CurrencyList(); foreach (MoneyModel moneyModel in currentList) { currencyList.Add(moneyModel.CharacterCode); } } else { throw new FaultException<ServiceFault>(new ServiceFault(serverError)); } return currencyList; }
internal static CurrencyList getCurrencyList(HttpResponseMessage response) { var currencylist = new CurrencyList(); var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(response.Content.ReadAsStringAsync().Result); if (jsonObj.ContainsKey("currencies")) { var currencyArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["currencies"].ToString()); foreach(var currencyObj in currencyArray) { var currency = new Currency(); currency = JsonConvert.DeserializeObject<Currency>(currencyObj.ToString()); currencylist.Add(currency); } } if (jsonObj.ContainsKey("page_context")) { var pageContext = new PageContext(); pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString()); currencylist.page_context = pageContext; } return currencylist; }
// # ConvertCurrency API Operation // The ConvertCurrency API operation to request the current foreign exchange (FX) rate for a specific amount and currency public ConvertCurrencyResponse ConvertCurrencyAPIOperation() { // Create the ConvertCurrencyResponse object ConvertCurrencyResponse responseConvertCurrency = new ConvertCurrencyResponse(); try { // # ConvertCurrencyRequest // The ConvertCurrencyRequest message enables you to have your // application get an estimated exchange rate for a list of amounts // This API operation does not affect PayPal balances // The code for the language in which errors are returned RequestEnvelope envelopeRequest = new RequestEnvelope(); envelopeRequest.errorLanguage = "en_US"; // CurrencyTypeList which takes two arguments: // // * `CurrencyCodeType` - The currency code. Allowable values are: // * Australian Dollar - AUD // * Brazilian Real - BRL // `Note: // The Real is supported as a payment currency and currency balance only for Brazilian PayPal accounts.` // // * Canadian Dollar - CAD // * Czech Koruna - CZK // * Danish Krone - DKK // * Euro - EUR // * Hong Kong Dollar - HKD // * Hungarian Forint - HUF // * Israeli New Sheqel - ILS // * Japanese Yen - JPY // * Malaysian Ringgit - MYR // `Note: // The Ringgit is supported as a payment currency and currency balance only for Malaysian PayPal accounts.` // // * Mexican Peso - MXN // * Norwegian Krone - NOK // * New Zealand Dollar - NZD // * Philippine Peso - PHP // * Polish Zloty - PLN // * Pound Sterling - GBP // * Singapore Dollar - SGD // * Swedish Krona - SEK // * Swiss Franc - CHF // * Taiwan New Dollar - TWD // * Thai Baht - THB // * Turkish Lira - TRY // `Note: // The Turkish Lira is supported as a payment currency and currency balance only for Turkish PayPal accounts.` // // * U.S. Dollar - USD // * `amount` List<CurrencyType> currencyTypeList = new List<CurrencyType>(); CurrencyType currency = new CurrencyType("USD", Convert.ToDecimal("4.00")); currencyTypeList.Add(currency); CurrencyList baseAmountList = new CurrencyList(currencyTypeList); // CurrencyCodeList which contains // // * `Currency Code` - Allowable values are: // * Australian Dollar - AUD // * Brazilian Real - BRL // `Note: // The Real is supported as a payment currency and currency balance only for Brazilian PayPal accounts.` // * Canadian Dollar - CAD // * Czech Koruna - CZK // * Danish Krone - DKK // * Euro - EUR // * Hong Kong Dollar - HKD // * Hungarian Forint - HUF // * Israeli New Sheqel - ILS // * Japanese Yen - JPY // * Malaysian Ringgit - MYR // `Note: // The Ringgit is supported as a payment currency and currency balance only for Malaysian PayPal accounts.` // * Mexican Peso - MXN // * Norwegian Krone - NOK // * New Zealand Dollar - NZD // * Philippine Peso - PHP // * Polish Zloty - PLN // * Pound Sterling - GBP // * Singapore Dollar - SGD // * Swedish Krona - SEK // * Swiss Franc - CHF // * Taiwan New Dollar - TWD // * Thai Baht - THB // * Turkish Lira - TRY // `Note: // The Turkish Lira is supported as a payment currency and currency balance only for Turkish PayPal accounts.` // // * U.S. Dollar - USD List<String> currencyCodeList = new List<String>(); currencyCodeList.Add("GBP"); CurrencyCodeList convertToCurrencyList = new CurrencyCodeList(currencyCodeList); // ConvertCurrencyRequest which takes params: // // * `Request Envelope` - Information common to each API operation, such // as the language in which an error message is returned // * `BaseAmountList` - A list of amounts with associated currencies to // be converted. // * `ConvertToCurrencyList` - A list of currencies to convert to. ConvertCurrencyRequest requestConvertCurrency = new ConvertCurrencyRequest(envelopeRequest, baseAmountList, convertToCurrencyList); // # Create the service wrapper object to make the API call AdaptivePaymentsService service = new AdaptivePaymentsService(); // # API call // Invoke the ConvertCurrency method in service wrapper object responseConvertCurrency = service.ConvertCurrency(requestConvertCurrency); if (responseConvertCurrency != null) { // Response envelope acknowledgement string acknowledgement = "ConvertCurrency API operation - "; acknowledgement += responseConvertCurrency.responseEnvelope.ack.ToString(); logger.Info(acknowledgement + "\n"); Console.WriteLine(acknowledgement + "\n"); // # Success values if (responseConvertCurrency.responseEnvelope.ack.ToString().Trim().ToUpper().Equals("SUCCESS")) { if (responseConvertCurrency.estimatedAmountTable.currencyConversionList != null && responseConvertCurrency.estimatedAmountTable.currencyConversionList.Count > 0) { IEnumerator<CurrencyConversionList> iterator = responseConvertCurrency.estimatedAmountTable.currencyConversionList.GetEnumerator(); while (iterator.MoveNext()) { CurrencyConversionList currencyConversion = iterator.Current; logger.Info("Amount to be Converted : " + currencyConversion.baseAmount.amount + currencyConversion.baseAmount.code + "\n"); Console.WriteLine("Amount to be Converted : " + currencyConversion.baseAmount.amount + currencyConversion.baseAmount.code + "\n"); IEnumerator<CurrencyType> currencyIterator = currencyConversion.currencyList.currency.GetEnumerator(); while (currencyIterator.MoveNext()) { CurrencyType currencyType = currencyIterator.Current; logger.Info("Converted amount : " + currencyType.amount + currencyType.code + "\n"); Console.WriteLine("Converted amount : " + currencyType.amount + currencyType.code + "\n"); } } } } // # Error Values else { List<ErrorData> errorMessages = responseConvertCurrency.error; foreach (ErrorData error in errorMessages) { logger.Debug("API Error Message : " + error.message); Console.WriteLine("API Error Message : " + error.message + "\n"); } } } } // # Exception log catch (System.Exception ex) { // Log the exception message logger.Debug("Error Message : " + ex.Message); Console.WriteLine("Error Message : " + ex.Message); } return responseConvertCurrency; }
public async Task<CurrencyList.response> CurrencyList(CurrencyList.request request, CancellationToken? token = null) { return await SendAsync<CurrencyList.response>(request.ToXmlString(), token.GetValueOrDefault(CancellationToken.None)); }