示例#1
0
        private void GetCurr()
        {
            var mnbService  = new MNBArfolyamServiceSoapClient();
            var currRequest = new GetCurrenciesRequestBody()
            {
            };
            var currResponse = mnbService.GetCurrencies(currRequest);
            var currResult   = currResponse.GetCurrenciesResult;

            var currXml = new XmlDocument();

            currXml.LoadXml(currResult);

            foreach (XmlElement element in currXml.DocumentElement)
            {
                for (int i = 0; i < element.InnerText.Length / 3; i++)
                {
                    string currency;
                    var    currChildElement = (XmlElement)element.ChildNodes[i];
                    currency = currChildElement.InnerText.ToString();
                    CurrenciesInput.Add(currency);
                    CurrenciesOutput.Add(currency);
                }
            }
        }
示例#2
0
        public Form1()
        {
            InitializeComponent();

            var mnbService = new MNBArfolyamServiceSoapClient();
            var request    = new GetCurrenciesRequestBody()
            {
            };
            var response       = mnbService.GetCurrencies(request);
            var currencyresult = response.GetCurrenciesResult;

            var xml = new XmlDocument();

            xml.LoadXml(currencyresult);
            foreach (XmlElement element in xml.DocumentElement)
            {
                foreach (XmlNode item in element)
                {
                    var curr = item.InnerText;
                    Currencies.Add(curr);
                }
            }
            comboBox1.DataSource   = Currencies;
            comboBox1.SelectedItem = "EUR";
            RefreshData();
        }
示例#3
0
        public GetCurrenciesResponseBody GetCurrencies([System.Xml.Serialization.XmlElementAttribute("GetCurrencies", Namespace = "http://www.mnb.hu/webservices/", IsNullable = true)] GetCurrenciesRequestBody GetCurrencies1)
        {
            object[] results = this.Invoke("GetCurrencies", new object[] {
                GetCurrencies1
            });

            return((GetCurrenciesResponseBody)(results[0]));
        }
示例#4
0
 /// <remarks/>
 public void GetCurrenciesAsync(GetCurrenciesRequestBody GetCurrencies1, object userState)
 {
     if ((this.GetCurrenciesOperationCompleted == null))
     {
         this.GetCurrenciesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetCurrenciesOperationCompleted);
     }
     this.InvokeAsync("GetCurrencies", new object[] {
         GetCurrencies1
     }, this.GetCurrenciesOperationCompleted, userState);
 }
示例#5
0
        private void CurrencyList()
        {
            var MNBservice = new MNBArfolyamServiceSoapClient();
            var request    = new GetCurrenciesRequestBody();
            var response   = MNBservice.GetCurrencies(request);
            var result     = response.GetCurrenciesResult;

            var xml = new XmlDocument();

            xml.LoadXml(result);
            foreach (XmlElement element in xml.DocumentElement.ChildNodes[0])
            {
                var currency = element.InnerText;
                Currencies.Add(currency);
            }

            cbCurrency.DataSource = Currencies;
        }
示例#6
0
        private void GetCurrencies()
        {
            var mnbService = new MNBArfolyamServiceSoapClient();

            var request = new GetCurrenciesRequestBody();

            var response = mnbService.GetCurrencies(request);
            var result   = response.GetCurrenciesResult;

            var xml = new XmlDocument();

            xml.LoadXml(result);

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

                var childElement = (XmlElement)element.ChildNodes[0];
                rate.Currency = childElement.GetAttribute("curr");
            }
        }
示例#7
0
        private void getExchangeRates()
        {
            var mnbService = new MNBArfolyamServiceSoapClient();
            var request    = new GetCurrenciesRequestBody()
            {
            };
            var response = mnbService.GetCurrencies(request);
            var result   = response.GetCurrenciesResult;
            var xml      = new XmlDocument();

            xml.LoadXml(result);
            int sorszam = 0;                                           //ha ide 3-at írnék, akkor a HUF-t be se olvassa

            while (sorszam + 2 < xml.DocumentElement.InnerText.Length) //data-nál alkalmazott foreach csak egy elemet számít, HUF után kiugrik a ciklusból, ez végigmegy a teljes listán, még ha nem is szép megoldás
            {
                string curr;
                curr = (xml.DocumentElement.InnerText[sorszam]).ToString() + (xml.DocumentElement.InnerText[sorszam + 1]).ToString() + (xml.DocumentElement.InnerText[sorszam + 2]).ToString();
                Currencies.Add(curr);
                sorszam += 3;
            }
            comboBox1.DataSource = Currencies;
        }
示例#8
0
            private void FillDataToExcel(Excel.Worksheet sheet, MNBArfolyamServiceSoapClient soapClient) //Fill excel worksheet
            {
                GetCurrenciesRequestBody    getCurrenciesBody = new GetCurrenciesRequestBody();
                GetExchangeRatesRequestBody getRatesBody      = new GetExchangeRatesRequestBody();

                var range      = sheet.get_Range("A1", "A1");
                var currencies = soapClient.GetCurrencies(getCurrenciesBody);

                int           DayID = 0, countRates = 0;
                string        xmlResult      = currencies.GetCurrenciesResult;
                DataTable     table          = XmlToDataTable(xmlResult, 1);
                DataTable     dataRates      = new DataTable();
                DataTable     dataDays       = new DataTable();
                List <string> currenciesList = new List <string>();

                ((Excel.Range)range.Cells[1, 1]).Value = "Dátum/ISO";
                ((Excel.Range)range.Cells[2, 1]).Value = "Egység";

                //Fill and get all currencies//
                int columnIndex = 2;

                foreach (DataRow items in table.Rows)
                {
                    ((Excel.Range)range.Cells[1, columnIndex]).Value = items[0];
                    currenciesList.Add(items[0].ToString());
                    columnIndex++;
                }
                //////////////////////////////

                //Fill days//
                var exchRates = soapClient.GetExchangeRates(getRatesBody);

                xmlResult = exchRates.GetExchangeRatesResult;
                table     = XmlToDataTable(xmlResult, 0);

                columnIndex = 3;
                foreach (DataRow item in table.Rows)
                {
                    ((Excel.Range)range.Cells[columnIndex, 1]).Value2 = item[0];
                    columnIndex++;
                }
                /////////////

                //Fill Rates//
                getRatesBody = new GetExchangeRatesRequestBody();
                dataRates    = new DataTable();
                dataDays     = new DataTable();

                for (int k = 0; k < currenciesList.Count; k++)//Loop all currencies and fill rates value
                {
                    //if (k > 2) break;  Set how many item will appaer
                    range.Cells[1, k + 2].Select();
                    DayID       = 0;
                    countRates  = 0;
                    columnIndex = 3;

                    getRatesBody.currencyNames = currenciesList[k];
                    exchRates = soapClient.GetExchangeRates(getRatesBody);
                    xmlResult = exchRates.GetExchangeRatesResult;
                    dataRates = XmlToDataTable(xmlResult, 1);
                    dataDays  = XmlToDataTable(xmlResult, 0);

                    if (dataRates != null)
                    {
                        ((Excel.Range)range.Cells[2, k + 2]).Value = dataRates.Rows[countRates][0]; //Fill unit
                        while (countRates < dataRates.Rows.Count)
                        {
                            if (dataRates.Rows[countRates][3].ToString() == dataDays.Rows[DayID][0].ToString())                                    //Date ID check
                            {
                                ((Excel.Range)range.Cells[columnIndex, k + 2]).Value = dataRates.Rows[countRates][2].ToString().Replace(",", "."); //Change string format
                                columnIndex++;
                                DayID++;
                                countRates++;
                            }
                            else
                            {
                                columnIndex++; DayID++;
                            }
                        }
                    }
                }
            }
示例#9
0
 /// <remarks/>
 public void GetCurrenciesAsync(GetCurrenciesRequestBody GetCurrencies1)
 {
     this.GetCurrenciesAsync(GetCurrencies1, null);
 }