public void ShuffleTransfers(IEnumerable <TransferBase> newOrder) { lock (_transferLock) { var newSet = newOrder.Union(Transfers); if (Transfers.Count() != newSet.Count()) { throw new ArgumentException("newOrder does not include all of the existing transfers"); } Transfers = new ObservableCollection <TransferBase>(newSet); } }
/// <summary> /// The ToString() method /// </summary> /// <returns> /// Concatenate Index, CreationDate, Transaction list and sum of the amount and biscuit /// </returns> /// <example> /// 42 (03/06/2010 13:52:45) | 14 transfers | 10 coins /// </example> public override string ToString() { return($"{Index} ({CreationDate}) | {Transfers.Count()} transfers | {Transfers.Sum(t => t.Amount + t.Biscuit)} coins"); }
public static void ShowResults(string title, Transfers[] transactions) { var count = 0; ShowHeader(title, transactions.Count()); foreach (var trans in transactions) { Console.WriteLine( "{0} {1} {2} {3}", trans.SourceAccountNumber.PadRight(16), trans.DestinationAccountNumber.PadRight(16), trans.TransactionTypeId, trans.Amount.ToString("C") ); count += 1; if (count > 5) { Console.WriteLine(); return; } } Console.WriteLine(); }