//---------------------------------------------------------------------------------------------------- public static HistorySummary Get_HistorySummary(int tableId, string[] keyValue, int maxReturnCount) { var tableStructure = DbInterfaces.SQLServerInterface.Tables__Get(tableId, false, true, false); var aspdb_Connection = DataAccess.SQLObjectsCRUD.ASPdb_Connection__Get(tableStructure.ConnectionId); var rtn = new HistorySummary() { ConnectionId = tableStructure.ConnectionId, TableId = tableId, ConnectionName = aspdb_Connection.ConnectionName, Schema = tableStructure.Schema, TableName = tableStructure.TableName, KeyValue = keyValue, HistoryCount = Get_HistoryCount(tableId, keyValue), HistoryRecords = Get_HistoryRecords(tableId, keyValue, maxReturnCount) }; return(rtn); }
public void AddEntry(List <ExchangeBalance> balances) { if (_history.Count == _length) { _history.Dequeue(); } _history.Enqueue(new HistoryEntry { Balances = balances, Time = balances.Max(b => b.TimeUtc) }); foreach (var balance in balances) { var summary = _historySummaries.FirstOrDefault(s => s.Currency.Equals(balance.Currency)); if (summary == null) { summary = new HistorySummary { Currency = balance.Currency, High = int.MinValue, Low = int.MaxValue }; _historySummaries.Add(summary); } if (balance.Value > summary.High) { summary.High = balance.Value; } if (balance.Value < summary.Low) { summary.Low = balance.Value; } } }