示例#1
0
        public List<BO.Account> GetAccountsByBank(int bankId)
        {
            List<BO.Account> accounts = null;

            using (KapitalDataContext context = new KapitalDataContext(ConnectionString))
            {
                RepositoryAdapter<BO.Account, Account, AccountCopyExtensions> adapter =
                    new RepositoryAdapter<BO.Account, Account, AccountCopyExtensions>(this);

                accounts = adapter.GetAllByParentID(context.Accounts.Where(a => a.BankId == bankId));
            }

            return accounts;
        }
示例#2
0
        public List<Models.Transaction> GetTransactionsWithinRange(Guid accountId, DateTime start, DateTime end, TagType type)
        {
            List<BO.Transaction> transactions = null;

            using (KapitalDataContext context = new KapitalDataContext(ConnectionString))
            {
                RepositoryAdapter<BO.Transaction, Transaction, TransactionCopyExtensions> adapter =
                    new RepositoryAdapter<BO.Transaction, Transaction, TransactionCopyExtensions>(this);

                var query = context.Transactions.Where(t => t.AccountId == accountId);

                query = query.Where(t => t.Date >= start && t.Date <= end);

                transactions = adapter.GetAllByParentID(query);
            }

            return transactions;
        }
示例#3
0
        public List<Models.Transaction> GetTransactionsByAccount(Guid accountId, string sort)
        {
            List<BO.Transaction> transactions = null;

            using (KapitalDataContext context = new KapitalDataContext(ConnectionString))
            {
                RepositoryAdapter<BO.Transaction, Transaction, TransactionCopyExtensions> adapter =
                    new RepositoryAdapter<BO.Transaction, Transaction, TransactionCopyExtensions>(this);

                var query = context.Transactions.Where(t => t.AccountId == accountId);

                if (String.Compare(sort, "date-desc", true) == 0)
                {
                    query = query.OrderByDescending(t => t.Date);
                }
                else
                {
                    query = query.OrderBy(t => t.Date);
                }

                transactions = adapter.GetAllByParentID(query);
            }

            return transactions;
        }
示例#4
0
        public List<Models.Transaction> GetTransactionsByAccount(Guid accountId)
        {
            List<BO.Transaction> transactions = null;

            using (KapitalDataContext context = new KapitalDataContext(ConnectionString))
            {
                RepositoryAdapter<BO.Transaction, Transaction, TransactionCopyExtensions> adapter =
                    new RepositoryAdapter<BO.Transaction, Transaction, TransactionCopyExtensions>(this);

                transactions = adapter.GetAllByParentID(context.Transactions.Where(t => t.AccountId == accountId));
            }

            return transactions;
        }