public CityStatisticsView(PersistedCityStatisticsWithFinancialData cityStatistics) { if (cityStatistics == null) { throw new ArgumentNullException(nameof(cityStatistics)); } _cityStatistics = cityStatistics; _issueDataMeterResultsLazy = new Lazy <IList <DataMeterResult> >(() => DataMeterInstances.GetDataMeterResults(cityStatistics, x => x.RepresentsIssue).ToList()); }
private void UpdatePrivate(IEnumerable <PersistedCityStatisticsWithFinancialData> statistics, PersistedCityStatisticsWithFinancialData current) { if (!IsHandleCreated) { return; } Update(statistics, current); }
public PersistedCityStatisticsWithFinancialData ProcessFinances(PersistedCityStatistics persistedCityStatistics, ICityBudgetConfiguration cityBudgetConfiguration) { var financialData = new PersistedCityStatisticsWithFinancialData( persistedCityStatistics: persistedCityStatistics, currentAmountOfFunds: CurrentAmount, currentProjectedAmountOfFunds: ProjectedIncome, cityBudgetConfiguration: cityBudgetConfiguration ); AddProjectedIncome(financialData.GetTotal()); return(financialData); }
public override void Update( IEnumerable <PersistedCityStatisticsWithFinancialData> statistics, PersistedCityStatisticsWithFinancialData current) { var bitmapsAndControls = _graphControlDefinitions .Select(graph => new { GraphControl = graph, Bitmap = _chartDrawer.Value.Draw(graph.GraphDefinition, statistics, graph.TabPage.Font, graph.TabPage.Size) }) .ToList(); if (!IsHandleCreated) { return; } BeginInvoke(new MethodInvoker(() => { foreach (var bitmapAndGraphControl in bitmapsAndControls) { bitmapAndGraphControl.GraphControl.DrawImage(bitmapAndGraphControl.Bitmap); } })); }
public virtual void Update(IEnumerable <PersistedCityStatisticsWithFinancialData> statistics, PersistedCityStatisticsWithFinancialData current) { throw new NotImplementedException(); }
public static IEnumerable <DataMeterResult> GetDataMeterResults(PersistedCityStatisticsWithFinancialData statistics, Func <DataMeter, bool> predicate) { return(DataMeters.Where(predicate).Select(meter => meter.GetDataMeterResult(statistics))); }
public void RestoreFrom(PersistedCityStatisticsWithFinancialData persistedCityStatisticsWithFinancialData) { _currentAmount = persistedCityStatisticsWithFinancialData.CurrentAmountOfFunds; _projectedIncome = persistedCityStatisticsWithFinancialData.CurrentProjectedAmountOfFunds; }
public int GetValue(PersistedCityStatisticsWithFinancialData citytStatistics) => _valueGetterFunc(citytStatistics);
public DataMeterResult GetDataMeterResult(PersistedCityStatisticsWithFinancialData statistics) { return(GetDataMeterResult(_getValue(statistics))); }
public override void Update(IEnumerable <PersistedCityStatisticsWithFinancialData> statistics, PersistedCityStatisticsWithFinancialData current) { if (!IsHandleCreated) { return; } var yearMates = new HashSet <PersistedCityStatisticsWithFinancialData>(current .CombineWithYearMates(statistics)); textBox1.BeginInvoke(new MethodInvoker(() => { _taxDefinitionGridViewController.UpdateWith(yearMates); _cityServiceDefinitionGridViewController.UpdateWith(yearMates); _totalsGridViewController.UpdateWith(yearMates); })); }
public override void Update(IEnumerable <PersistedCityStatisticsWithFinancialData> statistics, PersistedCityStatisticsWithFinancialData current) { var cityStatistics = new CityStatisticsView(current); groupBox1.BeginInvoke(new MethodInvoker(() => { AddLabelValue("Population", cityStatistics.Population.ToString("N0"), dataGridView1); AddLabelValue("Assessed value", cityStatistics.AssessedValue.ToString("C"), dataGridView1); AddLabelValue("Category", cityStatistics.CityCategory, dataGridView1); AddLabelValue("Current funds", cityStatistics.CurrentAmountOfFunds.ToString("C"), dataGridView2); AddLabelValue("Projected income", cityStatistics.CurrentProjectedAmountOfFunds.ToString("C"), dataGridView2); listBox1.DataSource = cityStatistics.GetIssueDataMeterResults() .Select(x => $"{x.Name} - {x.ValueCategory} ({x.PercentageScoreString}%)") .ToList(); listBox2.DataSource = new[] { new { Percentage = cityStatistics.GetNegativeOpinion().ToString("P"), Name = "Negative" }, new { Percentage = cityStatistics.GetPositiveOpinion().ToString("P"), Name = "Positive" } } .OrderByDescending(x => x.Percentage) .Select(x => x.Name + ' ' + x.Percentage) .ToList(); })); }