Foodolini.BusinessLogic.Person Class Reference

Collaboration diagram for Foodolini.BusinessLogic.Person:
Collaboration graph

List of all members.

Public Member Functions

 Person (string userName, string fullName, DateTime birthDay, Gender gender, double height, double weight, double activityFactor)
 Create a new person.
IEnumerable< FoodItemGetConsumedFoodItems ()
 Get all FoodItems consumed by this person.
IEnumerable< FoodItemGetConsumedFoodItems (DateTime start, DateTime end)
 Get all FoodItems consumed by this person between start and end.
IEnumerable< ExerciseGetPerformedExercises ()
void Save ()
 Save this object to database.
void Delete ()
 Delete this person from the database.

Static Public Member Functions

static IEnumerable< PersonListUsers ()
 List all persons.

Properties

internal long Id [get]
 Gets the primary key of the underlying row, 0 if not saved.
string UserName [get, set]
 Gets the username of this Person.
string FullName [get, set]
 Gets/sets the fullname of this person.
DateTime BirthDate [get, set]
 Gets/sets the birthdate of this person.
Gender Gender [get, set]
 Gets/sets the gender of this person.
double Weight [get, set]
 Gets/sets the weight of this person.
double Height [get, set]
 Gets/sets the height of this person.
Diet Diet [get, set]
 Gets/sets the diet of this person.
double ActivityFactor [get, set]
 Activity factor for a person's BMR.
int Age [get]
 Gets the age of the person in years.
int BMR [get]
 Gets the Basal Metabolic Rate of the Person using the Mifflin St. Jeor BMR formula.
int METS [get]

Private Member Functions

 Person (User user)
 Create Person from underlying row.

Static Private Member Functions

static void LoadCache ()
 Cache all persons.
static internal Person GetById (long userId)
 Get a person by primary key of the underlying row.

Private Attributes

User row
 The underlying row.
bool modified = true
 True, if this object have been modified with respect to the database.
Diet diet = null
 Lazily loaded diet cache.

Static Private Attributes

static Dictionary< long, PersoncachedPersons = null
 Cached persons.

Detailed Description

Definition at line 8 of file Person.cs.


Constructor & Destructor Documentation

Foodolini.BusinessLogic.Person.Person ( User  user  )  [private]

Create Person from underlying row.

Parameters:
user Underlying row

Definition at line 27 of file Person.cs.

Foodolini.BusinessLogic.Person.Person ( string  userName,
string  fullName,
DateTime  birthDay,
Gender  gender,
double  height,
double  weight,
double  activityFactor 
)

Create a new person.

Definition at line 35 of file Person.cs.


Member Function Documentation

void Foodolini.BusinessLogic.Person.Delete (  ) 

Delete this person from the database.

Definition at line 276 of file Person.cs.

static internal Person Foodolini.BusinessLogic.Person.GetById ( long  userId  )  [static, private]

Get a person by primary key of the underlying row.

Definition at line 304 of file Person.cs.

IEnumerable<FoodItem> Foodolini.BusinessLogic.Person.GetConsumedFoodItems ( DateTime  start,
DateTime  end 
)

Get all FoodItems consumed by this person between start and end.

Parameters:
start Look for FoodItems consumed after this DateTime
end Look for FoodItems consumed before this DateTime
Returns:
An IEnumerable<FoodItem> that iterates over all FoodItems consumed by this person between start and end.

Definition at line 238 of file Person.cs.

IEnumerable<FoodItem> Foodolini.BusinessLogic.Person.GetConsumedFoodItems (  ) 

Get all FoodItems consumed by this person.

Returns:
A IEnumerable that iterates over all FoodItems consumed by this person

Definition at line 220 of file Person.cs.

IEnumerable<Exercise> Foodolini.BusinessLogic.Person.GetPerformedExercises (  ) 

Definition at line 244 of file Person.cs.

static IEnumerable<Person> Foodolini.BusinessLogic.Person.ListUsers (  )  [static]

List all persons.

Definition at line 315 of file Person.cs.

static void Foodolini.BusinessLogic.Person.LoadCache (  )  [static, private]

Cache all persons.

Definition at line 293 of file Person.cs.

void Foodolini.BusinessLogic.Person.Save (  ) 

Save this object to database.

Definition at line 254 of file Person.cs.


Member Data Documentation

Dictionary<long, Person> Foodolini.BusinessLogic.Person.cachedPersons = null [static, private]

Cached persons.

Definition at line 288 of file Person.cs.

Lazily loaded diet cache.

Definition at line 141 of file Person.cs.

True, if this object have been modified with respect to the database.

Definition at line 19 of file Person.cs.

The underlying row.

Definition at line 14 of file Person.cs.


Property Documentation

double Foodolini.BusinessLogic.Person.ActivityFactor [get, set]

Activity factor for a person's BMR.

Activity factor

Activity level

1.2

Little or no exercise. Sedentary

1.375

Light exercise/sports 1-3 days/week. Light

1.55

Moderate exercise/sport 3-5 days/week. Moderate

1.725

Hard exercise/sport 6-7 days/week. Hard

1.9

Very hard exercise/sport & physical job or 2x training) Extra

Definition at line 175 of file Person.cs.

int Foodolini.BusinessLogic.Person.Age [get]

Gets the age of the person in years.

Definition at line 190 of file Person.cs.

DateTime Foodolini.BusinessLogic.Person.BirthDate [get, set]

Gets/sets the birthdate of this person.

Definition at line 89 of file Person.cs.

int Foodolini.BusinessLogic.Person.BMR [get]

Gets the Basal Metabolic Rate of the Person using the Mifflin St. Jeor BMR formula.

Definition at line 197 of file Person.cs.

Diet Foodolini.BusinessLogic.Person.Diet [get, set]

Gets/sets the diet of this person.

Definition at line 146 of file Person.cs.

string Foodolini.BusinessLogic.Person.FullName [get, set]

Gets/sets the fullname of this person.

Definition at line 78 of file Person.cs.

Gender Foodolini.BusinessLogic.Person.Gender [get, set]

Gets/sets the gender of this person.

Definition at line 102 of file Person.cs.

double Foodolini.BusinessLogic.Person.Height [get, set]

Gets/sets the height of this person.

Definition at line 128 of file Person.cs.

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

Gets the primary key of the underlying row, 0 if not saved.

Definition at line 58 of file Person.cs.

int Foodolini.BusinessLogic.Person.METS [get]

The energy resting metabolic rate per hour.

Definition at line 210 of file Person.cs.

string Foodolini.BusinessLogic.Person.UserName [get, set]

Gets the username of this Person.

Definition at line 67 of file Person.cs.

double Foodolini.BusinessLogic.Person.Weight [get, set]

Gets/sets the weight of this person.

Definition at line 115 of file Person.cs.


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

Foodolini 1.0.0 Documentation, generated with DoxyGen.