Пример #1
0
        private static Transaction ToTransaction(ComsecTransactionCsv comsecTransactionCsv)
        {
            var transaction = new Transaction();

            // Detail field has format
            // <B or S> <quanity> <share code> @ <share price>
            // For example
            // B 269 VTS @ 148.620000

            string[] detailComponents = comsecTransactionCsv.Details.Split(new Char[] { ' ' });

            transaction.TransactionDate = comsecTransactionCsv.TransactionDate;
            transaction.ShareCode = detailComponents[2];
            transaction.Quantity = int.Parse(detailComponents[1]);

            if (detailComponents[0] == "S")
            {
                transaction.Amount = comsecTransactionCsv.Credit;
            }
            else
            {
                transaction.Amount = -1 * comsecTransactionCsv.Debit;
            }

            transaction.Reference = comsecTransactionCsv.Reference;

            return transaction;
        }
Пример #2
0
        private static Transaction ToTransaction(ComsecTransactionCsv comsecTransactionCsv)
        {
            var transaction = new Transaction();

            // Detail field has format
            // <B or S> <quanity> <share code> @ <share price>
            // For example
            // B 269 VTS @ 148.620000

            string[] detailComponents = comsecTransactionCsv.Details.Split(new Char[] { ' ' });

            transaction.TransactionDate = comsecTransactionCsv.TransactionDate;
            transaction.ShareCode       = detailComponents[2];
            transaction.Quantity        = int.Parse(detailComponents[1]);

            if (detailComponents[0] == "S")
            {
                transaction.Amount = comsecTransactionCsv.Credit;
            }
            else
            {
                transaction.Amount = -1 * comsecTransactionCsv.Debit;
            }

            transaction.Reference = comsecTransactionCsv.Reference;

            return(transaction);
        }