コード例 #1
0
        public static void PrintTransaction(MonetaryTransaction transaction)
        {
            var oper = transaction.Operation.ToLowerInvariant();

            if (oper.StartsWith("налог"))
            {
                PrintTransaction(transaction, Config.TaxAccount);
                return;
            }
            if (oper.Equals("пополнение счета") || oper.Equals("вывод средств"))
            {
                PrintTransaction(transaction, Config.BankAccount);
                return;
            }
            if (oper.Equals("комиссия по тарифу"))
            {
                PrintTransaction(transaction, Config.ComissionAccount);
                return;
            }
            if (oper.Equals("выплата дивидендов"))
            {
                PrintTransaction(transaction, Config.DividendsAccount);
                return;
            }
            if (oper.Equals("выплата купонов"))
            {
                PrintTransaction(transaction, Config.CouponsAccount);
                return;
            }
        }
コード例 #2
0
        private static void PrintTransaction(MonetaryTransaction transaction, string otherAccount)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            Console.WriteLine($"{transaction.Date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)} * \"Брокерский счёт: {transaction.Operation}\"");
            Console.WriteLine($"\t{Config.BrokerAccount}\t{transaction.Amount} {transaction.Currency}");
            Console.WriteLine($"\t{otherAccount}\t{0 - transaction.Amount} {transaction.Currency}");
            Console.WriteLine();
        }