/// <summary>
        /// Method to retrieve transactions based on accountID from the db.
        /// </summary>
        /// <param name="custID"></param>
        /// <param name="acctID"></param>
        /// <returns>List of transactions based on the accountID</returns>
        public List <Transactions> GetTransactionsByAcctID(int custID, int acctID)
        {
            BankDataContext  bankDataContext = new BankDataContext();
            TransactionTable transTable      = new TransactionTable();
            AccountTable     acctTable       = new AccountTable();

            var getTransQuery = bankDataContext.TransactionTables.Where(a => (a.Customer_ID == custID && a.Account_ID == acctID));

            List <Transactions> getTrans = new List <Transactions>();

            foreach (var i in getTransQuery)
            {
                var getAcctType = bankDataContext.AccountTables.SingleOrDefault(p => p.Account_ID == i.Account_ID).Account_Type;

                TransactionType getTransactionType = (TransactionType)Enum.Parse(typeof(TransactionType), i.Transaction_Type);
                AccountType     getAccountType     = (AccountType)Enum.Parse(typeof(AccountType), getAcctType);
                DateTime        getDate            = DateTime.ParseExact(i.Transaction_Date, "dd-MM-yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);

                Transactions transObj = new Transactions(getTransactionType, getAccountType, getDate, Convert.ToDouble(i.Amount));
                getTrans.Add(transObj);
            }

            return(getTrans);
        }
Esempio n. 2
0
 partial void UpdateAccountTable(AccountTable instance);
Esempio n. 3
0
 partial void DeleteAccountTable(AccountTable instance);
Esempio n. 4
0
 partial void InsertAccountTable(AccountTable instance);