Ejemplo n.º 1
0
        public void GetCurrentExchangeRates()
        {
            var mnbService = new MNBArfolyamServiceSoapClient();
            var request    = new GetCurrentExchangeRatesRequestBody();
            var response   = mnbService.GetCurrentExchangeRates(request);
            var result     = response.GetCurrentExchangeRatesResult;

            var xml = new XmlDocument();

            xml.LoadXml(result);

            foreach (XmlElement element in xml.DocumentElement)
            {
                //DocumentElement - MNBCurrentExchangeRates
                //element         - Day (has only 1 attribute (current date))
                // element childNodes - Rate (every Rate is a node with attributes )

                foreach (XmlElement item in element.ChildNodes)
                {
                    var rate = new RateData();
                    Rates.Add(rate);

                    rate.Currency = item.GetAttribute("curr");

                    var unit  = decimal.Parse(item.GetAttribute("unit"));
                    var value = decimal.Parse(item.InnerText.ToString().Replace(',', '.')); //default separator conflict
                    if (unit != 0)
                    {
                        rate.Value = value / unit;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public GetCurrentExchangeRatesResponseBody GetCurrentExchangeRates([System.Xml.Serialization.XmlElementAttribute("GetCurrentExchangeRates", Namespace = "http://www.mnb.hu/webservices/", IsNullable = true)] GetCurrentExchangeRatesRequestBody GetCurrentExchangeRates1)
        {
            object[] results = this.Invoke("GetCurrentExchangeRates", new object[] {
                GetCurrentExchangeRates1
            });

            return((GetCurrentExchangeRatesResponseBody)(results[0]));
        }
Ejemplo n.º 3
0
 /// <remarks/>
 public void GetCurrentExchangeRatesAsync(GetCurrentExchangeRatesRequestBody GetCurrentExchangeRates1, object userState)
 {
     if ((this.GetCurrentExchangeRatesOperationCompleted == null))
     {
         this.GetCurrentExchangeRatesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetCurrentExchangeRatesOperationCompleted);
     }
     this.InvokeAsync("GetCurrentExchangeRates", new object[] {
         GetCurrentExchangeRates1
     }, this.GetCurrentExchangeRatesOperationCompleted, userState);
 }
Ejemplo n.º 4
0
 /// <remarks/>
 public void GetCurrentExchangeRatesAsync(GetCurrentExchangeRatesRequestBody GetCurrentExchangeRates1)
 {
     this.GetCurrentExchangeRatesAsync(GetCurrentExchangeRates1, null);
 }