예제 #1
0
        public Account GetAccount(Guid WorkDoneItemId)
        {
            var inv = GetOpportunity(WorkDoneItemId);
            var acc = Context.Accounts.Single(a => a.Id == inv.AccountId);

            return(AccountConverter.ToDomain(acc));
        }
예제 #2
0
 public IEnumerable <Account> GetNewAccounts()
 {
     return((from a in Context.Accounts
             where a.Created > Context.NewDate
             orderby a.Name ascending
             select AccountConverter.ToDomain(a)).AsEnumerable());
 }
예제 #3
0
 public IEnumerable <Account> GetActiveAccounts()
 {
     return((from a in Context.Accounts
             join i in Context.Invoices
             on a.Id equals i.AccountId
             where i.InvoiceDate > Context.ActiveDate
             orderby a.Name ascending
             select AccountConverter.ToDomain(a)).Distinct().AsEnumerable());
 }
예제 #4
0
        public Account GetItem(Guid id)
        {
            var account = (from a in Context.Accounts
                           where a.Id == id
                           select AccountConverter.ToDomain(a)).Single();

            account.Invoices      = GetInvoices(id, Context.ActiveDate);
            account.Opportunities = GetNewAndActiveOpportunities(id, Context.NewDate, Context.ActiveDate);

            return(account);
        }
예제 #5
0
        public Account GetParent(Guid id)
        {
            var parentId = Context.Opportunities.Single(o => o.Id == id).AccountId;

            return(AccountConverter.ToDomain(Context.Accounts.Single(a => a.Id == parentId)));
        }