Example #1
0
        public static void Update(Account acc)
        {
            SqlParamsColl paramList = new SqlParamsColl();

            paramList.Add("@AccountNumber", SqlDbType.Int, acc.AccountNumber);
            paramList.Add("AvailableBalance", SqlDbType.Money, acc.AvailableBalance);

            SqlTools.ExecuteReader("Account_Update", paramList, reader =>
                {
                    while (reader.Read())
                    {
                        PopulateObjectFromReader(reader, acc);
                    }
                });
        }
Example #2
0
        public static void PopulateObjectFromReader(SqlDataReader reader, Account acc)
        {
            acc.AccountNumber = (int)reader["AccountNumber"];
            acc.Type = (char)reader.GetString(reader.GetOrdinal("AccountType"))[0];
            acc.AvailableBalance = (decimal)reader["AvailableBalance"];
            acc.CustomerId = (int)reader["CustomerId"];

            try
            {
                acc.LastUpdatedDate = Convert.ToDateTime(reader["LastUpdatedDate"]);
            }
            catch (Exception)
            {
                acc.LastUpdatedDate = null;
            }
        }
Example #3
0
        public static AccountList GetAccountsByCustomer(int Id)
        {
            AccountList list = new AccountList();

            SqlParamsColl paramList = new SqlParamsColl();
            paramList.Add("@CustomerId", SqlDbType.Int, Id);

            SqlTools.ExecuteReader("dbo.Accounts_RetrieveByCustomer", paramList, reader =>
                {
                    while (reader.Read())
                    {
                        Account acc = new Account();
                        PopulateObjectFromReader(reader, acc);
                        list.Add(acc);
                    }
                });

            return list;
        }
Example #4
0
 public static void Withdraw(Account Acc, decimal Amount, string Comment)
 {
     DBTransaction.Insert_WithdrawTransaction(Acc.AccountNumber, Amount, Comment);
     //DBAccount.Update(Acc);
 }
Example #5
0
 public static void Transfer(Account SourceAccount, int DestinationAccount, decimal Amount, string Comment)
 {
     DBTransaction.Insert_TransferTransaction(SourceAccount.AccountNumber, DestinationAccount, Amount, Comment);
     //DBAccount.Update(SourceAccount);
 }
Example #6
0
 public static void Deposit(Account Acc, decimal Amount, string Comment)
 {
     DBTransaction.Insert_DepositTransaction(Acc.AccountNumber, Amount, Comment);
     //DBAccount.Update(Acc);
 }