Beispiel #1
0
 public List <InventoryQuantity> SearchAvailableToSell(InventorySearchFilter filter)
 {
     return(new List <InventoryQuantity>
     {
         new InventoryQuantity("1", "1", new Product("12345"), 1, 1)
     });
 }
        public async Task <HttpResponseMessage> Get(InventorySearchFilter filter)
        {
            if (filter != null)
            {
                var session = (Session)ContextOperator.Get(ContextKeys.SESSION_ID);
                filter.CompanyId = session.CompanyId;
                filter.UserId    = session.UserId;
                var collection = await Task.Run(() => { return(this._inventoryService.Get(filter)); });

                return(Request.CreateResponse(HttpStatusCode.OK, new ResponseMessage <object>(true, "Succeeded", collection)));
            }
            return(Request.CreateResponse(HttpStatusCode.OK, new ResponseMessage <object>(false, MessageString.INVALID_REQUEST_PARMS, null)));
        }
        public IEnumerable <Inventory> Get(InventorySearchFilter filter)
        {
            try
            {
                if (filter == null)
                {
                    throw new ArgumentNullException("filter");
                }

                if (string.IsNullOrEmpty(filter.CompanyId))
                {
                    throw new ArgumentNullException("CompanyId");
                }

                if (string.IsNullOrEmpty(filter.Keyword))
                {
                    filter.Keyword = "*";
                }

                if (filter.Take <= 0)
                {
                    filter.Take = 100;
                }

                Expression <Func <Inventory, bool> > predicate = x =>
                                                                 x.CompanyId == filter.CompanyId &&
                                                                 (filter.Keyword == "*" || x.Name.StartsWith(filter.Keyword));

                if (!string.IsNullOrEmpty(filter.RackBoxId))
                {
                    predicate = predicate.And(x => x.RackBoxId == filter.RackBoxId);
                }

                if (!string.IsNullOrEmpty(filter.CustomerId))
                {
                    predicate = predicate.And(x => x.CustomerId == filter.CustomerId);
                }

                return(this._inventoryRepository.Find(predicate).Skip(filter.Start).Take(filter.Take).ToList());
            }
            catch (Exception ex)
            {
                throw;
            }
        }
 public List <InventoryQuantity> SearchAvailableToSell(InventorySearchFilter filter)
 {
     return(new List <InventoryQuantity>());
 }
 public List <InventoryQuantity> GetAvailableToSellInventory(InventorySearchFilter filter)
 {
     return(new List <InventoryQuantity> {
         new InventoryQuantity("storeId", "locationId", new Product("UPC123"), 5, 3)
     });
 }