// ---------------------------------------------------------------------------------------------------- // Method add price to hash table private void AddPriceToHashtable(string zipcode, double price) { double[] arrayForAverage = { 0, 0 }; if (PricesByZip.ContainsKey(zipcode)) { object objArray = PricesByZip[zipcode]; if (objArray != null) { arrayForAverage = (double[])objArray; arrayForAverage[0] = arrayForAverage[0] + price; //keeps the sum of the prices per zipcode arrayForAverage[1] = arrayForAverage[1] + 1; //keeps the sum of the number of sales per zipcode PricesByZip[zipcode] = arrayForAverage; } } else { arrayForAverage[0] = price; arrayForAverage[1] = 1; PricesByZip.Add(zipcode, arrayForAverage); } }
// ---------------------------------------------------------------------------------------------------- // Method update filtered data public void UpdateFilteredData() { FilteredData = Data.DataFiltered.ToTable(); QuantityPerYear.Clear(); PricesByZip.Clear(); UpdateQuantityPerYear(); UpdatePricesByZip(); }