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());
 }
예제 #2
0
        private void UpdatePrivate(IEnumerable <PersistedCityStatisticsWithFinancialData> statistics,
                                   PersistedCityStatisticsWithFinancialData current)
        {
            if (!IsHandleCreated)
            {
                return;
            }

            Update(statistics, current);
        }
예제 #3
0
        public PersistedCityStatisticsWithFinancialData ProcessFinances(PersistedCityStatistics persistedCityStatistics, ICityBudgetConfiguration cityBudgetConfiguration)
        {
            var financialData = new PersistedCityStatisticsWithFinancialData(
                persistedCityStatistics: persistedCityStatistics,
                currentAmountOfFunds: CurrentAmount,
                currentProjectedAmountOfFunds: ProjectedIncome,
                cityBudgetConfiguration: cityBudgetConfiguration
                );

            AddProjectedIncome(financialData.GetTotal());

            return(financialData);
        }
예제 #4
0
        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);
                }
            }));
        }
예제 #5
0
 public virtual void Update(IEnumerable <PersistedCityStatisticsWithFinancialData> statistics,
                            PersistedCityStatisticsWithFinancialData current)
 {
     throw new NotImplementedException();
 }
예제 #6
0
 public static IEnumerable <DataMeterResult> GetDataMeterResults(PersistedCityStatisticsWithFinancialData statistics, Func <DataMeter, bool> predicate)
 {
     return(DataMeters.Where(predicate).Select(meter => meter.GetDataMeterResult(statistics)));
 }
예제 #7
0
 public void RestoreFrom(PersistedCityStatisticsWithFinancialData persistedCityStatisticsWithFinancialData)
 {
     _currentAmount   = persistedCityStatisticsWithFinancialData.CurrentAmountOfFunds;
     _projectedIncome = persistedCityStatisticsWithFinancialData.CurrentProjectedAmountOfFunds;
 }
예제 #8
0
 public int GetValue(PersistedCityStatisticsWithFinancialData citytStatistics) => _valueGetterFunc(citytStatistics);
예제 #9
0
 public DataMeterResult GetDataMeterResult(PersistedCityStatisticsWithFinancialData statistics)
 {
     return(GetDataMeterResult(_getValue(statistics)));
 }
예제 #10
0
        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);
            }));
        }
예제 #11
0
        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();
            }));
        }