Exemple #1
0
        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 TransactionInCash GetTransactionInCash(double debit, double credit)
 {
     TransactionInCash transactionInCash = new TransactionInCash(_recordRepository)
     {
         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
     };
     return transactionInCash;
 }