comparison MetroWpf/Stocks.Service/StocksService.cs @ 21:dfc81f8bb838

working version for sttocks except ui within metrowpf
author adminsh@apollo
date Tue, 20 Mar 2012 15:07:31 +0000
parents 6109bc268b90
children 399398841fd0
comparison
equal deleted inserted replaced
20:6109bc268b90 21:dfc81f8bb838
47 _serviceUrl = _configurationService.GetServiceUrl(symbolsCsv); 47 _serviceUrl = _configurationService.GetServiceUrl(symbolsCsv);
48 } 48 }
49 49
50 public IList<Price> GetFullCurrentPrices() 50 public IList<Price> GetFullCurrentPrices()
51 { 51 {
52 return _companies.Select(company => new Price(company.Symbol, 0, 0)).ToList(); 52 return _companies.Select(company => new Price(company.Name, company.Symbol, 0, 0)).ToList();
53 } 53 }
54 54
55 public event PriceChangedEventHandler PriceChanged; 55 public event PriceChangedEventHandler PriceChanged;
56 public delegate void PriceChangedEventHandler(object sender, PriceChangedEventArgs e); 56 public delegate void PriceChangedEventHandler(object sender, PriceChangedEventArgs e);
57 protected virtual void OnPriceChanged(Price price) 57 protected virtual void OnPriceChanged(Price price)
113 StringSplitOptions.RemoveEmptyEntries); 113 StringSplitOptions.RemoveEmptyEntries);
114 114
115 foreach (var webPriceData in webPrices) 115 foreach (var webPriceData in webPrices)
116 { 116 {
117 var webPrice = Factory.CreatePrice(webPriceData); 117 var webPrice = Factory.CreatePrice(webPriceData);
118 var localPrice = _currentPrices.Find(x => x.Symbol == webPrice.Symbol); 118
119 var localPrice = _currentPrices.Find(
120 x => x.Symbol == webPrice.Symbol);
119 121
120 if (localPrice == null) 122 if (localPrice == null)
121 { 123 {
122 _currentPrices.Add(new Price(webPrice.Symbol, webPrice.CurrentPrice, webPrice.PreviousPrice)); 124 _currentPrices.Add(
125 new Price(
126 webPrice.CompanyName,
127 webPrice.Symbol,
128 webPrice.CurrentPrice,
129 webPrice.PreviousPrice));
123 continue; 130 continue;
124 } 131 }
125 132
126 if (!localPrice.Equals(webPrice)) 133 if (!localPrice.Equals(webPrice))
127 UpdateLocalPrice(webPrice, localPrice); 134 UpdateLocalPrice(webPrice, localPrice);