Exemplo n.º 1
0
 public static IList<Contact> GetContacts(CustomerFacility fac)
 {
     if (fac == null)
         return null;
     if (fac.CustomerFacilityID == Guid.Empty)
         return null;
     Repository<Contact, Guid> contactRep = new Repository<Contact,Guid>();
     IEnumerable<Contact> contacts = new List<Contact>();
     contacts = contactRep.GetAll().Where(c => fac.Contacts.Contains(c));
     return contacts.ToList();
 }
Exemplo n.º 2
0
        public static IList<CustomerFacility> GetFacilities(string name,Customer customer, Territory territory)
        {
            Repository<CustomerFacility, Guid> repo = new Repository<CustomerFacility, Guid>();
            var result = repo.GetAll()
                .Where(fac => fac.Name.Contains(name));
            if (customer != null)
                result = result.Where(fac => fac.Customer.CustomerID == customer.CustomerID);
            if (territory != null)
            {
                result = result.Where(fac => fac.Territory.TerritoryID == territory.TerritoryID);

                IList<Territory> allTerr = GetAllChildTerritories(territory);
                allTerr.Add(territory);
                var allTerrId = from pG in allTerr
                                      select pG.TerritoryID;

                result = from p in result
                         where allTerrId.Contains(p.Territory.TerritoryID)
                         select p;
            }
            return result.ToList();
        }
Exemplo n.º 3
0
 public static IList<CustomerFacility> GetFacilitiesForCustomer(Customer customer)
 {
     if (customer == null)
         return null;
     Repository<CustomerFacility, Guid> repo = new Repository<CustomerFacility, Guid>();
     var result = repo.GetAll();
     return result.Where(fac => fac.Customer.CustomerID == customer.CustomerID).ToList();
 }
Exemplo n.º 4
0
 public static IList<Country> GetAllCountries()
 {
     Repository<Country, Guid> rep = new Repository<Country, Guid>();
     return rep.GetAll();
 }