private IList<ItemBatchDTO> GetStockToImport(string pStrWhsCode,DateTime pAuctionDate) { //Get Stock from SAP B1 IList<ItemBatchDTO> lLstObjSapStock = SapStockService.GetItemBatchesListByWarehouse(pStrWhsCode,pAuctionDate); //Get Local Stock IList<string> lLstStrLocalStock = LocalStockService.GetListByWhs() .Select(x => x.BatchNumber) .ToList(); //Get imported customers for valid that customer exists before then import his stock IList<string> lLstStrImportedCustomer = LocalBusinessPartnerService .GetList() .Select(x => x.Code) .ToList(); //Get imported items for valid that item exists before then import the customer's stock IList<string> lLstStrImportedItems = LocalItemService .GetList() .Select(x => x.Code) .ToList(); return lLstObjSapStock.Where(x => !lLstStrLocalStock.Contains(x.BatchNumber) && lLstStrImportedCustomer.Contains(x.CardCode) && lLstStrImportedItems.Contains(x.ItemCode)).ToList(); }
private long GetItemIdByCode(string pStrItemCode) { return LocalItemService.GetList().Where(x => x.Code == pStrItemCode).Select(y => y.Id).FirstOrDefault(); }