Ejemplo n.º 1
0
        public static async Task <List <XmlNode> > WebServiceCallAsync(string date)
        {
            var ws      = new ExchangeRatesService.ExchangeRatesSoapClient("ExchangeRatesSoap");
            var xmlDoc1 = ws.getExchangeRatesByDateAsync(date);
            var xmlDoc2 = ws.getExchangeRatesByDateAsync(ParseDate.GetYesterdayDate(date));
            await Task.WhenAll(xmlDoc1, xmlDoc2).ConfigureAwait(false);

            List <XmlNode> results = new List <XmlNode>
            {
                xmlDoc1.Result,
                xmlDoc2.Result
            };

            return(results);
        }
Ejemplo n.º 2
0
        public static List <Item> SortedList(string date)
        {
            ParseDate.CheckDate(date);
            var results      = CachedData.GetCachedData(date);
            var firstObject  = GetDataFromXml.GetDataFromXmlNode(results[0]);
            var secondObject = GetDataFromXml.GetDataFromXmlNode(results[1]);

            foreach (var item in firstObject.Items)
            {
                var matching = secondObject.Items.Find(q => q.Currency == item.Currency);
                item.Difference = item.Rate - matching.Rate;
            }
            var sortedlist = firstObject.Items.OrderByDescending(o => o.Difference).ToList();

            return(sortedlist);
        }