//allows the user to set and update the consumption date. First checks if the date is valod //and if the item exists public int editConsDate(long bfid, DateTime?consDate) { Mediator m = new Mediator(); FindId findId = new FindId(bfid); if (m.findIdHandler.Handle(findId).response != 0) { if (consDate == null) { EditConsDate editConsDate = new EditConsDate(bfid, consDate); m.editConsDateHandler.Handle(editConsDate); //fia.editConsDate(bfid, consDate); return(0); } BFoodItem bFoodItem = getBFoodItem(bfid); if (bFoodItem.PurchaseDate > consDate) { return(1); } EditConsDate editConsDate1 = new EditConsDate(bfid, consDate); m.editConsDateHandler.Handle(editConsDate1); //fia.editConsDate(bfid, consDate); return(0); } return(2); }
//removes the food item identifed by bfid public bool removeFoodItem(long bfid) { Mediator m = new Mediator(); FindId findId = new FindId(bfid); if (m.findIdHandler.Handle(findId).response != 0) { RemoveFoodItem removeFoodItem = new RemoveFoodItem(bfid); return(m.removeFoodItemHandler.Handle(removeFoodItem)); } return(false); }
public FindIdResponse Handle(FindId query) { return(new FindIdResponse(query.query())); }
private void btnFindId_Click(object sender, EventArgs e) { FindId findId = new FindId(); findId.ShowDialog(); }