protected override void OnDeleting() { base.OnDeleting(); MovieCategory defaultCategory = MovieCategory.GetDefaultCategory(Session); foreach (Movie movie in new List <Movie>(Movies)) { movie.Category = defaultCategory; } }
protected override void OnSavingOverride() { base.OnSavingOverride(); if (!IsDeleted) { if (Category == null) { Category = MovieCategory.GetDefaultCategory(Session); } if (string.IsNullOrEmpty(Title)) { throw new Exception("Title can't be null"); } } }
void SetDefaultCategoryPrices() { MovieCategory category = MovieCategory.GetDefaultCategory(session); category.GetPrice(MovieItemFormat.DVD).SetDaysRentPrice(0, 1.5M); category.GetPrice(MovieItemFormat.DVD).SetDaysRentPrice(1, 2.25M); category.GetPrice(MovieItemFormat.DVD).SetDaysRentPrice(2, 2.0M); category.GetPrice(MovieItemFormat.DVD).SetDaysRentPrice(3, 1.75M); category.GetPrice(MovieItemFormat.BlueRay).SetDaysRentPrice(0, 3.0M); category.GetPrice(MovieItemFormat.BlueRay).SetDaysRentPrice(1, 4.0M); category.GetPrice(MovieItemFormat.BlueRay).SetDaysRentPrice(2, 3.75M); category.GetPrice(MovieItemFormat.BlueRay).SetDaysRentPrice(3, 3.5M); category.GetPrice(MovieItemFormat.BlueRay).SetDaysRentPrice(4, 3.25M); category.GetPrice(MovieItemFormat.VideoCD).SetDaysRentPrice(0, 1.0M); category.GetPrice(MovieItemFormat.VideoCD).SetDaysRentPrice(1, 1.5M); category.GetPrice(MovieItemFormat.VideoCD).SetDaysRentPrice(2, 1.25M); sellingPrices.Add(MovieItemFormat.DVD, 12.5M); sellingPrices.Add(MovieItemFormat.BlueRay, 22.5M); sellingPrices.Add(MovieItemFormat.VideoCD, 7.5M); }
public override void AfterConstruction() { base.AfterConstruction(); IsColor = true; Category = MovieCategory.GetDefaultCategory(Session); }