Ejemplo n.º 1
0
        //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);
        }
        public bool Handle(EditConsDate command)
        {
            bool res = false;

            if (command.command())
            {
                res = true;
            }
            return(res);
        }