Example #1
0
 private IList <SupplierDTO> GetSuppliers(SupplierSearchType searchType, string name)
 {
     try
     {
         GetSuppliersRequest request = new GetSuppliersRequest();
         request.SearchType = searchType;
         request.Name       = name;
         GetSuppliersResponse response = Service.GetSuppliersByCriteria(request);
         return(response.Suppliers);
     }
     catch (Exception ex)
     {
         if (ExceptionPolicy.HandleException(ex, "PL Policy"))
         {
             throw;
         }
         return(new List <SupplierDTO>());
     }
 }
Example #2
0
        public IQueryable <Supplier> GetSuppliersByCriteria(SupplierSearchType searchType, string name, int productId)
        {
            IQueryable <Supplier> suppliers = new List <Supplier>().AsQueryable();

            switch (searchType)
            {
            case SupplierSearchType.None:
                suppliers = rep.GetAll();
                break;

            case SupplierSearchType.ByName:
                suppliers = rep.GetAll().Where(cu => cu.Name == name);
                break;

            case SupplierSearchType.ByProduct:
                suppliers = rep.GetAll().Where(su => su.SupplierProduct.Any(c => c.Product.ProductId == productId));
                break;
            }
            return(suppliers);
        }
Example #3
0
        public IQueryable <Supplier> GetSuppliersByCriteria(SupplierSearchType searchType, string name)
        {
            IQueryable <Supplier> suppliers = null;

            switch (searchType)
            {
            case SupplierSearchType.None:
                suppliers = rep.GetAll();
                break;

            case SupplierSearchType.ByName:
                suppliers = rep.GetAll().Where(cu => cu.Name == name);
                break;

            default:
                suppliers = rep.GetAll();
                break;
            }

            return(suppliers);
        }