public Record NewTransaction(IRecordRepository recordRepository, string bankBookOrCashBook, ChequeInfo chequeInfo = null) { Record transaction = default(Record); switch (bankBookOrCashBook) { case "BankBook": if (chequeInfo == null) { throw new Exception("chequeInfo can not be null"); } transaction = new TransactionInCheque(recordRepository) { ChequeInfo = chequeInfo }; break; case "CashBook": transaction = new TransactionInCash(recordRepository); break; default: throw new Exception("bankBookOrCashBook can be only BankBook or CashBook"); } return(transaction); }
public Record NewTransaction(IRecordRepository recordRepository, string bankBookOrCashBook, ChequeInfo chequeInfo = null) { Record transaction = default(Record); switch (bankBookOrCashBook) { case "BankBook": if (chequeInfo == null) throw new Exception("chequeInfo can not be null"); transaction = new TransactionInCheque(recordRepository) { ChequeInfo = chequeInfo }; break; case "CashBook": transaction = new TransactionInCash(recordRepository); break; default: throw new Exception("bankBookOrCashBook can be only BankBook or CashBook"); } return transaction; }
private TransactionInCheque GetTransactionInCheque(double debit, double credit) { var transactionInCheque = new TransactionInCheque(_recordRepository, _bankBookRepository) { ProjectHead = _projectHead, Date = _massVoucher.VoucherDate, Narration = _massVoucher.Narration, Tag = _massVoucher.Tag, VoucherSerialNo = _massVoucher.VoucherSerialNo, Link = _massVoucher.LinkedVoucherNo, VoucherType = _massVoucher.VoucherType, FinancialYear = _massVoucher.FinancialYear, Debit = debit, Credit = credit, IsActive = true, BankBook = _massVoucher.IsCheque ? GetBankBook() : null }; return transactionInCheque; }