protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Literal litEvent = e.Row.FindControl("litEvent") as Literal; Literal litAnzahl = e.Row.FindControl("litAnzahl") as Literal; //Chart bakChart = e.Row.FindControl("bakChart") as Chart; //Series bakstockCourse = courseChart.Series["stockCourse"]; AktienSimulatorDataSet.AktieRow aktie = e.Row.DataItem as AktienSimulatorDataSet.AktieRow; var kurse = LogicAnzeige.dictKurse[aktie.ID]; for (int i = 0; i < kurse.Count; i++) { // var kurs in kurse if (countRefresh == 0) { Chart courseChart = e.Row.FindControl("courseChart") as Chart; Series courseChartSeries = courseChart.Series["stockCourse"]; countRefresh = 20; courseChartSeries.Points.AddXY(i, kurse[i]); } countRefresh--; //bakstockCourse.Points.AddXY(i, kurse[i]); } //LogicAnzeige.dictKurse[aktie.ID] litEvent.Text = aktie.EventRow.Bezeichnung; var depot = Depots?.FirstOrDefault(x => x.Aktie == aktie.ID); if (depot != null) { litAnzahl.Text = depot.Anzahl.ToString(); } else { litAnzahl.Text = "0"; } } }
/// <summary> /// Wechselt das Event einer Aktie mit einem neuen zufälligen Event aus. /// </summary> public static void ChangeEvent(AktienSimulatorDataSet.AktieRow aktie, Random random) { int i = random.Next() % Database.DataSet.Event.Count; aktie.Event = Database.DataSet.Event.ElementAt(i).ID; }