A FoodItem, representing a physical instance of milk. More...
Public Member Functions | |
FoodItem (double quantity, Ingredient ingredient, DateTime expirationDate, bool isOpen) | |
Creates a new foodItem. | |
FoodItem (double quantity, Ingredient ingredient, DateTime expirationDate, bool isOpen, DateTime consumedDate, Person consumedBy) | |
void | Consume (Person person) |
Mark this FoodItem as consumed and opened. | |
void | Consume (Person person, double quantity) |
partial consume an item | |
void | OpenFoodItem () |
void | CloseFoodItem () |
FoodItem | Split (double quantity) |
Split this FoodItem in two. | |
void | Save () |
Save this FoodItem to database. | |
void | Delete () |
Delete this FoodItem from database. | |
Static Public Member Functions | |
static IEnumerable< FoodItem > | ListFoodItems () |
List FoodItems on storage that haven't been consumed. | |
Properties | |
long | Id [get] |
Gets/sets the Identifier as a System.Int64. | |
double | Quantity [get, set] |
Amount if content in the FoodItem in Gram. | |
Ingredient | Ingredient [get, set] |
Get the ingredient this FoodItem consists of. | |
DateTime | ExpirationDate [get, set] |
Gets/sets the expiration date of this FoodItem. | |
DateTime | RegisteredDate [get, set] |
When the FoodItem was registered. | |
bool | IsOpen [get] |
Gets if this FoodItem have been opened. | |
DateTime | ConsumedDate [get] |
Gets the consumed date. | |
Person | ConsumedBy [get] |
Gets the person who consumed this item, null if not consumed. | |
bool | IsConsumed [get] |
True, if this FoodItem have been consumed. | |
Private Member Functions | |
internal | FoodItem (FoodItemRow row) |
Create a new instance of FoodItem from underlying FoodItemRow. | |
Private Attributes | |
FoodItemRow | row |
The row that this FoodItem represents. | |
bool | modified = true |
True, if this object is modified with respect to the database. | |
Ingredient | ingredient = null |
Lazily loaded ingredient. | |
Person | consumedBy = null |
Lazy loaded, reference holder for Person. |
A FoodItem, representing a physical instance of milk.
FoodItem contains: an ID number used as a unique identification number when searching the database, a quantity defining the amount of the fooditem, an Ingredient, an ExpirationDate, an IsOpen for when it was opened, a ConsumedDate, and a Person who has comsumed the foodItem.
Definition at line 18 of file FoodItem.cs.
Foodolini.BusinessLogic.FoodItem.FoodItem | ( | double | quantity, | |
Ingredient | ingredient, | |||
DateTime | expirationDate, | |||
bool | isOpen | |||
) |
Creates a new foodItem.
Definition at line 33 of file FoodItem.cs.
Foodolini.BusinessLogic.FoodItem.FoodItem | ( | double | quantity, | |
Ingredient | ingredient, | |||
DateTime | expirationDate, | |||
bool | isOpen, | |||
DateTime | consumedDate, | |||
Person | consumedBy | |||
) |
Definition at line 45 of file FoodItem.cs.
internal Foodolini.BusinessLogic.FoodItem.FoodItem | ( | FoodItemRow | row | ) | [private] |
Create a new instance of FoodItem from underlying FoodItemRow.
Definition at line 60 of file FoodItem.cs.
void Foodolini.BusinessLogic.FoodItem.CloseFoodItem | ( | ) |
Definition at line 242 of file FoodItem.cs.
void Foodolini.BusinessLogic.FoodItem.Consume | ( | Person | person, | |
double | quantity | |||
) |
partial consume an item
person | A Person | |
quantity | A System.Double |
Definition at line 210 of file FoodItem.cs.
void Foodolini.BusinessLogic.FoodItem.Consume | ( | Person | person | ) |
Mark this FoodItem as consumed and opened.
FoodItem.ComsumedDate will be now.
Definition at line 198 of file FoodItem.cs.
void Foodolini.BusinessLogic.FoodItem.Delete | ( | ) |
Delete this FoodItem from database.
Definition at line 317 of file FoodItem.cs.
static IEnumerable<FoodItem> Foodolini.BusinessLogic.FoodItem.ListFoodItems | ( | ) | [static] |
List FoodItems on storage that haven't been consumed.
Definition at line 329 of file FoodItem.cs.
void Foodolini.BusinessLogic.FoodItem.OpenFoodItem | ( | ) |
Opens the FoodItem and changes the expiration date if it is effected by the opening
Definition at line 231 of file FoodItem.cs.
void Foodolini.BusinessLogic.FoodItem.Save | ( | ) |
Save this FoodItem to database.
Definition at line 281 of file FoodItem.cs.
FoodItem Foodolini.BusinessLogic.FoodItem.Split | ( | double | quantity | ) |
Person Foodolini.BusinessLogic.FoodItem.consumedBy = null [private] |
Lazy loaded, reference holder for Person.
Definition at line 189 of file FoodItem.cs.
Ingredient Foodolini.BusinessLogic.FoodItem.ingredient = null [private] |
Lazily loaded ingredient.
Definition at line 93 of file FoodItem.cs.
bool Foodolini.BusinessLogic.FoodItem.modified = true [private] |
True, if this object is modified with respect to the database.
Definition at line 28 of file FoodItem.cs.
The row that this FoodItem represents.
Definition at line 23 of file FoodItem.cs.
Person Foodolini.BusinessLogic.FoodItem.ConsumedBy [get] |
Gets the person who consumed this item, null if not consumed.
Definition at line 166 of file FoodItem.cs.
DateTime Foodolini.BusinessLogic.FoodItem.ConsumedDate [get] |
Gets the consumed date.
Throws an exception if not consumed
Definition at line 154 of file FoodItem.cs.
DateTime Foodolini.BusinessLogic.FoodItem.ExpirationDate [get, set] |
Gets/sets the expiration date of this FoodItem.
Definition at line 118 of file FoodItem.cs.
long Foodolini.BusinessLogic.FoodItem.Id [get] |
Gets/sets the Identifier as a System.Int64.
Definition at line 69 of file FoodItem.cs.
Ingredient Foodolini.BusinessLogic.FoodItem.Ingredient [get, set] |
Get the ingredient this FoodItem consists of.
This property is lazily loaded
Definition at line 102 of file FoodItem.cs.
bool Foodolini.BusinessLogic.FoodItem.IsConsumed [get] |
True, if this FoodItem have been consumed.
Definition at line 180 of file FoodItem.cs.
bool Foodolini.BusinessLogic.FoodItem.IsOpen [get] |
Gets if this FoodItem have been opened.
Definition at line 144 of file FoodItem.cs.
double Foodolini.BusinessLogic.FoodItem.Quantity [get, set] |
Amount if content in the FoodItem in Gram.
Definition at line 79 of file FoodItem.cs.
DateTime Foodolini.BusinessLogic.FoodItem.RegisteredDate [get, set] |
When the FoodItem was registered.
Definition at line 132 of file FoodItem.cs.