示例#1
0
        /// <summary>
        /// 測試用的 FOR AutoMapper
        /// </summary>
        public void testAutoMapper()
        {
            BankAccountConverter bankAccountConverter = new BankAccountConverter();
            BankUserConverter    bankUserConverter    = new BankUserConverter();

            bankAccountConverter.convertBack(
                bankAccountConverter.convert(new Adapter.Entites.BankAccountEntity()
            {
                Amount        = 50m,
                BankAccountId = Guid.NewGuid(),
                BankUserId    = Guid.NewGuid()
            }));
            bankUserConverter.convertBack(
                bankUserConverter.convert(new Adapter.Entites.BankUserEntity()
            {
                UserName      = "******",
                LastLoginDate = null,
                BankUserId    = Guid.NewGuid()
            }));
            bankAccountConverter.convertBack(
                bankAccountConverter.convert(new Adapter.Entites.BankAccountEntity()
            {
                Amount        = 50m,
                BankAccountId = Guid.NewGuid(),
                BankUserId    = Guid.NewGuid()
            }));
            bankUserConverter.convertBack(
                bankUserConverter.convert(new Adapter.Entites.BankUserEntity()
            {
                UserName      = "******",
                LastLoginDate = null,
                BankUserId    = Guid.NewGuid()
            }));
        }
示例#2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="bankUserInfo"></param>
 /// <param name="bankAccountInfoCollection"></param>
 public void addBankUserAndAccount(BankUserInfo bankUserInfo, IEnumerable <BankAccountInfo> bankAccountInfoCollection)
 {
     using (TransactionScope transactionScope = new TransactionScope())
     {
         UIDataConfig.DefaultDataAdapterFactory.BankUserDb.addBankUser(new BankUserConverter().convertBack(bankUserInfo));
         BankAccountConverter bankAccountConverter = new BankAccountConverter();
         bankAccountInfoCollection
         .Select(t => bankAccountConverter.convertBack(t))
         .ToList()
         .ForEach(t => UIDataConfig.DefaultDataAdapterFactory.BankAccountDb.addBankAccount(t));
         transactionScope.Complete();
     }
 }