Foodolini.BusinessLogic.Ingredient Class Reference

Collaboration diagram for Foodolini.BusinessLogic.Ingredient:
Collaboration graph

List of all members.

Classes

class  NutritionDictionary
 A mutable dictionary of Nutrients and amounts as System.Double. More...

Public Member Functions

 Ingredient ()
 Ingredient (String name)
void Save ()
 Save this to the database.
void Delete ()
 Delete this from database.
FoodItem InStorage ()
 Returns the fooditem if ingredient is in storage, else returns null.
override string ToString ()

Static Public Member Functions

static IEnumerable< IngredientListByCategory (string category)
 List Ingredients by category.
static IEnumerable< IngredientListByCategory (string category, string searchString)
 List Ingredients by category and search string.
static IEnumerable< IngredientListByLongDescription (string searchString)
static Ingredient GetByLongDescription (string description)
 Loads a single Ingredient by LongDescription.
static bool Compare (Ingredient ingredient1, Ingredient ingredient2)
 Checks if two ingredients have the same ID.

Properties

IDictionary< Nutrient, double > Nutrients [get]
 Nutridents that this ingredient contains.
internal long Id [get]
 If of the FoodDescription row.
string CommercialName [get, set]
 Commercial name.
string ShortDescription [get, set]
 Get/set short description.
string LongDescription [get, set]
 get/set long description.
string Manufacturer [get, set]
 Gets/sets the product manufacturer.
TimeSpan ShelfLife [get, set]
 Expected shelf life, TimeSpan.Zero if unknown.
TimeSpan ExpirationAfterOpening [get, set]
 Expected expiration after opening, TimeSpan.MaxValue if none is available.
string Category [get, set]
 Gets/sets the Category, string.Empty if none.
double Protein [get]
 The amount of protein in the ingredient.
double Carbohydrates [get]
 The amount of carbohydrates in the ingredient.
double Fat [get]
 The amount of fat in the ingredient.
static ICollection< string > Categories [get]
 Get a list of all valid FoodGroups.

Private Member Functions

internal Ingredient (long foodDescriptionId)
internal Ingredient (FoodDescription row)

Static Private Member Functions

static long GetFoodGroupId (string category)
 Get a FoodGroup id for a category.
static internal Ingredient GetById (long ingredientId)
 Loads a single Ingredient by id.
static void LoadFoodGroups ()
 Loads foodGroups from database if not loaded.

Private Attributes

FoodDescription row
NutritionDictionary nutrients
bool modified = true

Static Private Attributes

static Dictionary< long, string > foodGroups = null
 Lazily loaded list of FoodGroups.

Detailed Description

Definition at line 8 of file Ingredient.cs.


Constructor & Destructor Documentation

internal Foodolini.BusinessLogic.Ingredient.Ingredient ( long  foodDescriptionId  )  [private]

Definition at line 14 of file Ingredient.cs.

Foodolini.BusinessLogic.Ingredient.Ingredient (  ) 

Definition at line 22 of file Ingredient.cs.

internal Foodolini.BusinessLogic.Ingredient.Ingredient ( FoodDescription  row  )  [private]

Definition at line 24 of file Ingredient.cs.

Foodolini.BusinessLogic.Ingredient.Ingredient ( String  name  ) 

Definition at line 30 of file Ingredient.cs.


Member Function Documentation

static bool Foodolini.BusinessLogic.Ingredient.Compare ( Ingredient  ingredient1,
Ingredient  ingredient2 
) [static]

Checks if two ingredients have the same ID.

Parameters:
ingredient1 
ingredient2 
Returns:

Definition at line 381 of file Ingredient.cs.

void Foodolini.BusinessLogic.Ingredient.Delete (  ) 

Delete this from database.

Definition at line 327 of file Ingredient.cs.

static internal Ingredient Foodolini.BusinessLogic.Ingredient.GetById ( long  ingredientId  )  [static, private]

Loads a single Ingredient by id.

Parameters:
ingredientId 
Returns:

Definition at line 284 of file Ingredient.cs.

static Ingredient Foodolini.BusinessLogic.Ingredient.GetByLongDescription ( string  description  )  [static]

Loads a single Ingredient by LongDescription.

Parameters:
description 
Returns:

Definition at line 271 of file Ingredient.cs.

static long Foodolini.BusinessLogic.Ingredient.GetFoodGroupId ( string  category  )  [static, private]

Get a FoodGroup id for a category.

Throw an exception if the category doesn't exist.

Definition at line 205 of file Ingredient.cs.

FoodItem Foodolini.BusinessLogic.Ingredient.InStorage (  ) 

Returns the fooditem if ingredient is in storage, else returns null.

Definition at line 358 of file Ingredient.cs.

static IEnumerable<Ingredient> Foodolini.BusinessLogic.Ingredient.ListByCategory ( string  category,
string  searchString 
) [static]

List Ingredients by category and search string.

Parameters:
category A System.String category to list
searchString A System.String to search for in LongDescription
Returns:
A IEnumerable<Ingredient>

Definition at line 245 of file Ingredient.cs.

static IEnumerable<Ingredient> Foodolini.BusinessLogic.Ingredient.ListByCategory ( string  category  )  [static]

List Ingredients by category.

Parameters:
category A System.String category to list

Definition at line 227 of file Ingredient.cs.

static IEnumerable<Ingredient> Foodolini.BusinessLogic.Ingredient.ListByLongDescription ( string  searchString  )  [static]

List Ingredients by search string

Parameters:
searchString A System.String to search for in LongDescription
Returns:
A IEnumerable<Ingredient>

Definition at line 260 of file Ingredient.cs.

static void Foodolini.BusinessLogic.Ingredient.LoadFoodGroups (  )  [static, private]

Loads foodGroups from database if not loaded.

Definition at line 394 of file Ingredient.cs.

void Foodolini.BusinessLogic.Ingredient.Save (  ) 

Save this to the database.

Definition at line 292 of file Ingredient.cs.

override string Foodolini.BusinessLogic.Ingredient.ToString (  ) 

Definition at line 386 of file Ingredient.cs.


Member Data Documentation

Dictionary<long, string> Foodolini.BusinessLogic.Ingredient.foodGroups = null [static, private]

Lazily loaded list of FoodGroups.

Definition at line 341 of file Ingredient.cs.

Definition at line 12 of file Ingredient.cs.

Definition at line 11 of file Ingredient.cs.

Definition at line 10 of file Ingredient.cs.


Property Documentation

double Foodolini.BusinessLogic.Ingredient.Carbohydrates [get]

The amount of carbohydrates in the ingredient.

Definition at line 189 of file Ingredient.cs.

ICollection<string> Foodolini.BusinessLogic.Ingredient.Categories [static, get]

Get a list of all valid FoodGroups.

Definition at line 347 of file Ingredient.cs.

string Foodolini.BusinessLogic.Ingredient.Category [get, set]

Gets/sets the Category, string.Empty if none.

Definition at line 161 of file Ingredient.cs.

string Foodolini.BusinessLogic.Ingredient.CommercialName [get, set]

Commercial name.

Definition at line 79 of file Ingredient.cs.

TimeSpan Foodolini.BusinessLogic.Ingredient.ExpirationAfterOpening [get, set]

Expected expiration after opening, TimeSpan.MaxValue if none is available.

Definition at line 144 of file Ingredient.cs.

double Foodolini.BusinessLogic.Ingredient.Fat [get]

The amount of fat in the ingredient.

Definition at line 197 of file Ingredient.cs.

internal long Foodolini.BusinessLogic.Ingredient.Id [get, private]

If of the FoodDescription row.

Definition at line 68 of file Ingredient.cs.

string Foodolini.BusinessLogic.Ingredient.LongDescription [get, set]

get/set long description.

Definition at line 105 of file Ingredient.cs.

string Foodolini.BusinessLogic.Ingredient.Manufacturer [get, set]

Gets/sets the product manufacturer.

Definition at line 118 of file Ingredient.cs.

IDictionary<Nutrient, double> Foodolini.BusinessLogic.Ingredient.Nutrients [get]

Nutridents that this ingredient contains.

Definition at line 41 of file Ingredient.cs.

double Foodolini.BusinessLogic.Ingredient.Protein [get]

The amount of protein in the ingredient.

Definition at line 181 of file Ingredient.cs.

TimeSpan Foodolini.BusinessLogic.Ingredient.ShelfLife [get, set]

Expected shelf life, TimeSpan.Zero if unknown.

Definition at line 131 of file Ingredient.cs.

string Foodolini.BusinessLogic.Ingredient.ShortDescription [get, set]

Get/set short description.

Definition at line 92 of file Ingredient.cs.


The documentation for this class was generated from the following file:

Foodolini 1.0.0 Documentation, generated with DoxyGen.