private async void ExcecuteLoadDataCommand()
        {
            RequestIsWorking = true;
            HttpResponseMessage resp = await Client.GetAsync(GlobalVariables.BackendServer_URL + $"/api/auswertung/steuern/Summiert/Steuerart?jahrVon={jahrvon}&jahrBis={jahrbis}");

            if (resp.IsSuccessStatusCode)
            {
                ItemList = await resp.Content.ReadAsAsync <List <SteuerartGesamtentwicklungSummiertModel> >();

                Labels = new string[ItemList.Count];
                IList <Betrag> werte = new List <Betrag>();
                int            index = 0;
                ItemList.ToList().ForEach(item =>
                {
                    item.Steuerarten.ToList().ForEach(steuer => {
                        var wert = werte.ToList().Find(wert => wert.Steuerart.Equals(steuer.Steuerart));
                        if (wert == null)
                        {
                            wert = new Betrag
                            {
                                Betraege  = new List <double>(),
                                Steuerart = steuer.Steuerart
                            };
                            werte.Add(wert);
                        }
                        wert.Betraege.Add(steuer.Betrag);
                    });

                    Labels[index] = item.Datum.ToString("MM.yyyy", CultureInfo.CurrentCulture);
                    index++;
                });


                LineSeries <double>[] series = new LineSeries <double> [werte.Count];
                index = 0;
                werte.ToList().ForEach(wert =>
                {
                    var StackedColoumn = new LineSeries <double>
                    {
                        Values = wert.Betraege,
                        Name   = wert.Steuerart,
                        TooltipLabelFormatter = (point) => wert.Steuerart + " " + point.PrimaryValue.ToString("N2") + "€"
                    };
                    series.SetValue(StackedColoumn, index);
                    index++;
                });


                XAxes.First().Labels = Labels;
                XAxes.First().Name   = "Monat";
                YAxes.First().Name   = "Betrag";
                Series = series;

                RaisePropertyChanged(nameof(Series));
                RaisePropertyChanged(nameof(XAxes));
                RaisePropertyChanged(nameof(YAxes));
            }
            RequestIsWorking = false;
        }
        private async void LoadData()
        {
            RequestIsWorking = true;
            HttpResponseMessage resp = await Client.GetAsync(GlobalVariables.BackendServer_URL + $"/api/auswertung/dividendenErhalten/Gesamt/Wertpapiere/{wertpapierID}/Entwicklung?jahrVon={jahrvon}&jahrBis={jahrbis}");

            if (resp.IsSuccessStatusCode)
            {
                Data = await resp.Content.ReadAsAsync <DividendeWertpapierEntwicklungMonatlichModel>();

                IList <double> NettoChart  = new List <double>();
                IList <double> BruttoChart = new List <double>();
                Labels = new string[Data.Betraege.Count];
                int index = 0;

                Data.Betraege.ToList().ForEach(a =>
                {
                    NettoChart.Add(a.Netto);
                    BruttoChart.Add(a.Brutto);
                    Labels[index] = a.Datum.ToString("MMMM yyyy", CultureInfo.CurrentCulture);
                    index++;
                });

                nettoSeries = new LineSeries <double>
                {
                    Values = NettoChart,
                    Name   = "Netto",
                    TooltipLabelFormatter = (point) => "Netto " + point.PrimaryValue.ToString("N2") + "€"
                };
                bruttoSeries = new LineSeries <double>
                {
                    Values = BruttoChart,
                    Name   = "Brutto",
                    TooltipLabelFormatter = (point) => "Brutto " + point.PrimaryValue.ToString("N2") + "€"
                };

                XAxes.First().Labels = Labels;
                XAxes.First().Name   = "Monat";
                YAxes.First().Name   = "Betrag";
                Series = new LineSeries <double>[2] {
                    bruttoSeries, nettoSeries
                };

                RaisePropertyChanged(nameof(Series));
                RaisePropertyChanged(nameof(XAxes));
                RaisePropertyChanged(nameof(YAxes));
                RaisePropertyChanged(nameof(Data));
            }
            RequestIsWorking = false;
        }
        private async void ExcecuteLoadDataCommand()
        {
            RequestIsWorking = true;
            HttpResponseMessage resp = await Client.GetAsync(GlobalVariables.BackendServer_URL + $"/api/auswertung/steuern/Monate/Jahresvergleich?jahrVon={jahrvon}&jahrBis={jahrbis}");

            if (resp.IsSuccessStatusCode)
            {
                ItemList = await resp.Content.ReadAsAsync <List <SteuerMonatJahresVergleichAuswertungModel> >();

                Labels = new string[12];
                ColumnSeries <double>[] series = new ColumnSeries <double> [ItemList.Count];
                int index = 0;
                ItemList.ToList().ForEach(item =>
                {
                    ColumnSeries <double> coloumn = new ColumnSeries <double>
                    {
                        Name   = item.Jahr.ToString(),
                        Values = new List <double>(),
                        TooltipLabelFormatter = (point) => item.Jahr + " " + point.PrimaryValue.ToString("N2") + "€"
                    };

                    var betraege = new List <double>();
                    item.Monatswerte.ToList().ForEach(mw =>
                    {
                        betraege.Add(mw.Betrag);
                    });
                    coloumn.Values = betraege;
                    series.SetValue(coloumn, index);
                    index++;
                });

                for (int monat = 1; monat <= 12; monat++)
                {
                    Labels[monat - 1] = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(monat);
                }

                XAxes.First().Labels = Labels;
                XAxes.First().Name   = "Monat";
                YAxes.First().Name   = "Betrag";

                Series = series;

                RaisePropertyChanged(nameof(Series));
                RaisePropertyChanged(nameof(XAxes));
                RaisePropertyChanged(nameof(YAxes));
            }
            RequestIsWorking = false;
        }
Пример #4
0
        private async void ExcecuteLoadDataCommand()
        {
            RequestIsWorking = true;
            HttpResponseMessage resp = await Client.GetAsync(GlobalVariables.BackendServer_URL + $"/api/auswertung/dividendenErhalten/Summiert/Monat?monat={monat}&jahrVon={jahrvon}&jahrBis={jahrbis}");

            if (resp.IsSuccessStatusCode)
            {
                ItemList = await resp.Content.ReadAsAsync <List <DividendeMonatentwicklungSummiertModel> >();

                IList <double> NettoChart  = new List <double>();
                IList <double> BruttoChart = new List <double>();
                Labels = new string[ItemList.Count];
                int index = 0;

                ItemList.ToList().ForEach(a =>
                {
                    NettoChart.Add(a.Netto);
                    BruttoChart.Add(a.Brutto);
                    Labels[index] = a.Jahr.ToString();
                    index++;
                });

                nettoSeries = new LineSeries <double>
                {
                    Values = NettoChart,
                    Name   = "Netto",
                    TooltipLabelFormatter = (point) => "Netto " + point.PrimaryValue.ToString("N2") + "€"
                };
                bruttoSeries = new LineSeries <double>
                {
                    Values = BruttoChart,
                    Name   = "Brutto",
                    TooltipLabelFormatter = (point) => "Brutto " + point.PrimaryValue.ToString("N2") + "€"
                };

                XAxes.First().Labels = Labels;
                XAxes.First().Name   = "Monat";
                YAxes.First().Name   = "Betrag";
                Series = new LineSeries <double>[2] {
                    bruttoSeries, nettoSeries
                };

                RaisePropertyChanged(nameof(Series));
                RaisePropertyChanged(nameof(XAxes));
                RaisePropertyChanged(nameof(YAxes));
            }
            RequestIsWorking = false;
        }
        private void SetDataIntoChart()
        {
            Labels = new string[12];
            ColumnSeries <double>[] series = new ColumnSeries <double> [ItemList.Count];
            int index = 0;

            ItemList.ToList().ForEach(item =>
            {
                ColumnSeries <double> coloumn = new ColumnSeries <double>
                {
                    Name   = item.Jahr.ToString(),
                    Values = new List <double>(),
                    TooltipLabelFormatter = (point) => point.Label + point.PrimaryValue.ToString("N2") + "€",
                };
                coloumn.TooltipLabelFormatter = (point) => item.Jahr + " " + point.PrimaryValue.ToString("N2") + "€";
                List <double> betraege        = new List <double>();
                item.Monatswerte.ToList().ForEach(mw =>
                {
                    double Betrag = typ.Equals(DividendenBetragTyp.Brutto) ? mw.Brutto : mw.Netto;
                    betraege.Add(Betrag);
                });
                coloumn.Values = betraege;
                series.SetValue(coloumn, index);
                index++;
            });

            for (int monat = 1; monat <= 12; monat++)
            {
                Labels[monat - 1] = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(monat);
            }

            XAxes.First().Labels = Labels;
            XAxes.First().Name   = "Monat";
            YAxes.First().Name   = "Betrag";
            Series = series;

            RaisePropertyChanged(nameof(Series));
            RaisePropertyChanged(nameof(Labels));
            RaisePropertyChanged(nameof(XAxes));
            RaisePropertyChanged(nameof(YAxes));
        }
        private async void ExcecuteLoadDataCommand()
        {
            RequestIsWorking = true;
            HttpResponseMessage resp = await Client.GetAsync(GlobalVariables.BackendServer_URL + $"/api/auswertung/steuern/Summiert/Steuer?jahrVon={jahrvon}&jahrBis={jahrbis}");

            if (resp.IsSuccessStatusCode)
            {
                ItemList = await resp.Content.ReadAsAsync <List <SteuerGesamtentwicklungSummiertModel> >();

                IList <double> Values = new List <double>();
                Labels = new string[ItemList.Count];
                int index = 0;

                ItemList.ToList().ForEach(a =>
                {
                    Values.Add(a.Betrag);
                    Labels[index] = a.Datum.ToString("MM.yyyy", CultureInfo.CurrentCulture);
                    index++;
                });

                LineSeries <double> series = new LineSeries <double>
                {
                    Values = Values,
                    Name   = "Betrag",
                    TooltipLabelFormatter = (point) => point.PrimaryValue.ToString("N2") + "€"
                };

                XAxes.First().Labels = Labels;
                XAxes.First().Name   = "Monat";
                YAxes.First().Name   = "Betrag";
                Series = new LineSeries <double>[1] {
                    series
                };

                RaisePropertyChanged(nameof(Series));
                RaisePropertyChanged(nameof(XAxes));
                RaisePropertyChanged(nameof(YAxes));
            }
            RequestIsWorking = false;
        }