public override void InitializeData( RepositoryObjectBase source ) { // If Initializing something to itself, just bail. if (this == source) { return; } base.InitializeData( source ); }
public override void InitializeData( RepositoryObjectBase source ) { // If Initializing something to itself, just bail. if (this == source) { return; } var mealType = source as MealType; if (mealType != null) { this.UseDefaultMealTime = ((MealType)source).UseDefaultMealTime; this.DefaultTimeOfMeal = ((MealType)source).DefaultTimeOfMeal; } base.InitializeData( source ); }
public override void InitializeData( RepositoryObjectBase source ) { // If Initializing something to itself, just bail. if (this == source) { return; } base.InitializeData( source ); if (source is MealBase) { MealBase meal = source as MealBase; this.TypeOfMeal = meal.TypeOfMeal; this.DateAndTimeOfMeal = meal.DateAndTimeOfMeal; this.FoodItemServings.Clear(); foreach (Serving<FoodItem> foodItemServing in meal.FoodItemServings) { this.FoodItemServings.Add( new Serving<FoodItem>( foodItemServing ) ); } } }
/// <summary> /// Initialize this object using the contents of another object. Essentially, this creates /// a deep copy of the source object. /// </summary> /// <param name="source">The source object for the deep copy</param> public override void InitializeData( RepositoryObjectBase source ) { base.InitializeData( source ); DataObject dataObject = source as DataObject; this.Description = dataObject.Description; this.Name = dataObject.Name; }
public RepositoryObjectEventArgs( RepositoryObjectBase item ) : base() { this.Item = item; }
public override void InitializeData( RepositoryObjectBase source ) { // If Initializing something to itself, just bail. if (this == source) { return; } base.InitializeData( source ); if (source is FoodItem) { FoodItem foodItem = source as FoodItem; this.CaloriesPerServing = foodItem.CaloriesPerServing; this.FoodGroupsPerServing.Clear(); foreach (Serving<FoodGroup> foodGroupServing in foodItem.FoodGroupsPerServing) { this.FoodGroupsPerServing.Add( new Serving<FoodGroup>( foodGroupServing ) ); } } }