Exemplo n.º 1
0
 public Customer GetCustomerByCriteria(GetCustomerByIdCriterias criterias)
 {
     try
     {
         return(_customerService.GetCustomerByCriteria(criterias));
     }
     catch (Exception ex)
     {
         LogError(ex);
         return(null);
     }
 }
Exemplo n.º 2
0
        public Customer GetCustomerByCriteria(GetCustomerByIdCriterias criterias)
        {
            var query  = _entityContext.Customers;
            var result = query
                         .Where(c => c.CustomerID == criterias.CustomerId && (!c.Inactive || criterias.IncludeInactive))
                         .Select(c => new
            {
                Customer = c,
                Projects = c.Projects.Where(x => !x.Inactive || criterias.IncludeInactive),

                // Tasks wich are created or has timeentries added in the given period
                Tasks = c.Projects.Select(x => x.Tasks.Where(t => (!t.Inactive || criterias.IncludeInactive) &&
                                                             ((t.CreateDate >= criterias.TaskFrom && t.CreateDate <= criterias.TaskTo) ||
                                                              t.TimeEntries.Any(te => te.CreateDate >= criterias.TaskFrom && te.CreateDate <= criterias.TaskTo)))),

                CustomerInvoiceGroups = c.CustomerInvoiceGroups,
                TimeEntries           = c.Projects.Select(p => p.Tasks.Select(t => t.TimeEntries.Where(te => te.CreateDate >= criterias.TimeEntryFrom && te.CreateDate <= criterias.TimeEntryTo)))
            })
                         .AsEnumerable()
                         .Select(x => x.Customer)
                         .SingleOrDefault();

            return(result);
        }
Exemplo n.º 3
0
 public IObservable <Customer> GetCustomerByCriteria(GetCustomerByIdCriterias criterias)
 {
     return(_getCustomerByCriterias(criterias).ObserveOnDispatcher());
 }
Exemplo n.º 4
0
 public void ReloadCustomer(GetCustomerByIdCriterias criterias, Action <Customer> callbackAction)
 {
     _dataService.GetCustomerByCriteria(criterias).Subscribe(callbackAction);
 }