using System;
using System.Collections.Generic;
using System.Text;
using Ubik.Engine.Client;
namespace StoresAndStockPricing.Model{
/// <summary>
/// Brands are groups of products distinguised by the label under which they're sold.
/// </summary>
public class Brand : Individual
{
NonEmptyTrackedString _name;
TrackedString _notes;
TrackedReference<Manufacturer> _manufacturer;
VirtualCollection<StockItem> _stockItems;
protected Brand(Session session)
: base(session)
{
_name = new NonEmptyTrackedString(this, "Name");
_notes = new TrackedString(this, "Notes", StandardFieldLengths.NotesLength);
_manufacturer = new TrackedReference<Manufacturer>(this, "Manufacturer");
_stockItems = new VirtualCollection<StockItem>(this, "Brand", VirtualCollectionMultiplicity.OneToMany);
}
public Brand(Session session, string name, Manufacturer manufacturer)
: this(session)
{
if (manufacturer == null)
throw new ArgumentNullException("manufacturer");
_name.Reset(name);
_manufacturer.Reset(manufacturer);
}
public string Name
{
get
{
return _name.Value;
}
set
{
_name.Value = value;
}
}
public string Notes
{
get
{
return _notes.Value;
}
set
{
_notes.Value = value;
}
}
public Manufacturer Manufacturer
{
get
{
return _manufacturer.Value;
}
set
{
if (value == null)
throw new ArgumentNullException("value");
_manufacturer.Value = value;
}
}
public ICollection<StockItem> StockItems
{
get
{
return _stockItems;
}
}
}
}
|