public IResult Add(StockStore stockStore) { var result = _stockStoreDal.GetAll(p => p.ProductAcceptanceId == stockStore.ProductAcceptanceId); if (result.Count != 0) { return(new ErrorResult(Messages.ProductAlreadyExist)); } _stockStoreDal.Add(stockStore); return(new SuccessResult(Messages.AddedStockStore)); }
public IResult Add(ProductOutput productOutput) { List <StockStore> products = _stockStoreDal.GetAll(p => p.Id == productOutput.ProductAcceptanceId); for (int i = 0; i < products.Count; i++) { if (products[i].Count < productOutput.Count) { return(new ErrorResult(Messages.CountError)); } else { StockStore product = new StockStore { Count = products[i].Count - productOutput.Count, Barcode = products[i].Barcode, Id = products[i].Id, UnitPrice = products[i].UnitPrice, DrawerId = products[i].DrawerId, ProductAcceptanceId = products[i].ProductAcceptanceId, ProductUnitId = products[i].ProductUnitId, ShelfId = products[i].ShelfId, StoreId = products[i].StoreId }; _stockStoreDal.Update(product); } } _productOutputDal.Add(productOutput); return(new SuccessResult(Messages.AddedProductOutput)); }
public IResult Delete(Drawer drawer) { var result = _stockStoreDal.GetAll(d => d.DrawerId == drawer.Id); if (result.Count != 0) { return(new ErrorResult(Messages.DrawerDoesNotDeleted)); } _drawerDal.Delete(drawer); return(new SuccessResult(Messages.DeletedDrawer)); }
public IResult Delete(Shelf shelf) { var result = _stockStoreDal.GetAll(s => s.ShelfId == shelf.Id); if (result.Count != 0) { return(new ErrorResult(Messages.ShelfDoesNotDeleted)); } _shelfDal.Delete(shelf); return(new SuccessResult(Messages.DeletedShelf)); }
public IResult Add(Proposal proposal) { var result = _stockStoreDal.GetAll(p => p.Barcode != proposal.Barcode); if (result.Count > 0) { return(new ErrorResult(Messages.BarcodeNotFound)); } _proposalDal.Add(proposal); return(new SuccessResult(Messages.AddedProposal)); }
public IResult Delete(Store store) { var result = _stockStoreDal.GetAll(s => s.StoreId == store.Id); if (result.Count > 0) { return(new ErrorResult(Messages.StoreDoesNotDeleted)); } _storeDal.Delete(store); return(new SuccessResult(Messages.DeletedStore)); }