/// <summary> /// Changes the rows. /// </summary> /// <param name="count">The count.</param> private void ChangeRows(int count) { if (data.Count < count) { count = data.Count; } for (int i = 0; i < count; ++i) { int recNo = r.Next(data.Count); PerformanceStockData recRow = data[recNo]; data[recNo].LastTrade = Math.Round((1 + r.NextDouble() * 50)); double d = r.NextDouble(); if (d < .5) { data[recNo].Change = Math.Round(d, 2); } else { data[recNo].Change = Math.Round(d, 2) * -1; } data[recNo].Open = Math.Round(r.NextDouble() * 50, 2); data[recNo].PreviousClose = Math.Round(r.NextDouble() * 30, 2); data[recNo].Volume = r.Next(); } }
/// <summary> /// Initializes the on. /// </summary> /// <param name="other">The other.</param> public void InitializeOn(PerformanceStockData other) { this.Symbol = other.Symbol; this.LastTrade = other.LastTrade; this.Change = other.Change; this.PreviousClose = other.PreviousClose; this.Open = other.Open; this.Volume = other.Volume; }
/// <summary> /// Adds the rows. /// </summary> /// <param name="count">The count.</param> private void AddRows(int count) { for (int i = 0; i < count; ++i) { var newRec = new PerformanceStockData(); newRec.Symbol = ChangeSymbol(); newRec.Account = ChangeAccount(i); newRec.Open = Math.Round(r.NextDouble() * 30, 2); newRec.LastTrade = Math.Round((1 + r.NextDouble() * 50)); double d = r.NextDouble(); if (d < .5) { newRec.Change = Math.Round(d, 2); } else { newRec.Change = Math.Round(d, 2) * -1; } newRec.PreviousClose = Math.Round(r.NextDouble() * 30, 2); newRec.Volume = r.Next(); data.Add(newRec); } }