コード例 #1
0
        public void TestInitialise()
        {
            var accountTypeRepo = new InMemoryAccountTypeRepository();
            var subject = new Mapper_LedgerEntryDto_LedgerEntry(new LedgerBucketFactory(new BucketBucketRepoAlwaysFind(), accountTypeRepo), new LedgerTransactionFactory(), accountTypeRepo);

            Result = subject.ToDto(TestData);
        }
コード例 #2
0
        public virtual LedgerEntryLine ToModel(LedgerEntryLineDto dto)
        {
            ToModelPreprocessing(dto);
            LedgerEntryLine model = null;

            ModelFactory(dto, ref model);
            if (model == null)
            {
                var constructors = typeof(LedgerEntryLine).GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance);
                var constructor  = constructors.First(c => c.GetParameters().Length == 0);
                model = (LedgerEntryLine)constructor.Invoke(new Type[] { });
            }
            var modelType = model.GetType();
            var mapper5   = new Mapper_LedgerTransactionDto_BankBalanceAdjustmentTransaction(this.accountTypeRepo);
            var bankBalanceAdjustments18 = dto.BankBalanceAdjustments.Select(mapper5.ToModel).ToList();

            modelType.GetProperty("BankBalanceAdjustments").SetValue(model, bankBalanceAdjustments18);
            var mapper6        = new Mapper_BankBalanceDto_BankBalance(this.accountTypeRepo);
            var bankBalances19 = dto.BankBalances.Select(mapper6.ToModel).ToList();

            modelType.GetProperty("BankBalances").SetValue(model, bankBalances19);
            var date20 = dto.Date;

            modelType.GetProperty("Date").SetValue(model, date20);
            var mapper7   = new Mapper_LedgerEntryDto_LedgerEntry(this.bucketFactory, this.transactionFactory, this.accountTypeRepo);
            var entries21 = dto.Entries.Select(mapper7.ToModel).ToList();

            modelType.GetProperty("Entries").SetValue(model, entries21);
            var remarks22 = dto.Remarks;

            modelType.GetProperty("Remarks").SetValue(model, remarks22);
            ToModelPostprocessing(dto, ref model);
            return(model);
        } // End ToModel Method
コード例 #3
0
        } // End ToModel Method

        public virtual LedgerEntryLineDto ToDto(LedgerEntryLine model)
        {
            ToDtoPreprocessing(model);
            LedgerEntryLineDto dto = null;

            DtoFactory(ref dto, model);
            if (dto == null)
            {
                dto = new LedgerEntryLineDto();
            }
            var mapper8 = new Mapper_LedgerTransactionDto_BankBalanceAdjustmentTransaction(this.accountTypeRepo);
            var bankBalanceAdjustments24 = model.BankBalanceAdjustments.Select(mapper8.ToDto).ToList();

            dto.BankBalanceAdjustments = bankBalanceAdjustments24;
            var mapper9        = new Mapper_BankBalanceDto_BankBalance(this.accountTypeRepo);
            var bankBalances25 = model.BankBalances.Select(mapper9.ToDto).ToList();

            dto.BankBalances = bankBalances25;
            var date26 = model.Date;

            dto.Date = date26;
            var mapper10  = new Mapper_LedgerEntryDto_LedgerEntry(this.bucketFactory, this.transactionFactory, this.accountTypeRepo);
            var entries27 = model.Entries.Select(mapper10.ToDto).ToList();

            dto.Entries = entries27;
            var remarks28 = model.Remarks;

            dto.Remarks = remarks28;
            ToDtoPostprocessing(ref dto, model);
            return(dto);
        } // End ToDto Method
コード例 #4
0
        public void TestInitialise()
        {
            var accountRepo = new InMemoryAccountTypeRepository();
            var subject = new Mapper_LedgerEntryDto_LedgerEntry(new LedgerBucketFactory(new BucketBucketRepoAlwaysFind(), accountRepo), new LedgerTransactionFactory(), accountRepo);
            Result = subject.ToModel(TestData);

            LedgerBook book = LedgerBookTestData.TestData2();
            Control = book.Reconciliations.First(l => l.Date == new DateTime(2013, 08, 15)).Entries.First(e => e.LedgerBucket.BudgetBucket.Code == TestDataConstants.PowerBucketCode);
        }