Hibernate version:
1.1
i can't bind three linked collections with TreeView and two DataGrid
I have 4 classes, Catalog, Categories, Products and ProductInstances:
I have instance of class atoi.BusinessFramework.Entities.Catalog cat;
First win control XtraTreeLiist.TreeList, i bind categories
Code:
treeCatalog.DataBindings.Add("DataSource", cat, "Categories");
second win control XtraGrid.GridControl, i bind product for selected category
Code:
gridProducts.DataBindings.Add("DataSource", cat.Categories, "Products");
all, fine
but!, i can't bind ProductInstances for selected product
How do it?
Code:
public class Catalog
{
private IList categories;
public IList Categories
{
get { return categories; }
set { categories = value; }
}
}
public class Category
{
private int categoryId;
public int CategoryId
{
get { return categoryId; }
set { categoryId = value; }
}
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
private Category parent;
public Category Parent
{
get { return parent; }
set { parent = value; }
}
private int parentId;
public int ParentId
{
get { return parentId; }
set { parentId = value; }
}
IList products = null;
public virtual IList Products
{
get
{
if (products == null)
{
products = new ArrayList();
}
return products;
}
set
{
products = value;
}
}
}
public class Product
{
#region Сво.ствa сохран.ем.е в .а.е .анн.х
private int productId;
public int ProductId
{
get { return productId; }
set { productId = value; }
}
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
private string code;
public string Code
{
get { return code; }
set { code = value; }
}
private string codeStringFormat;
public string CodeStringFormat
{
get { return codeStringFormat; }
set { codeStringFormat = value; }
}
private string notes;
public string Notes
{
get { return notes; }
set { notes = value; }
}
private Image image;
public Image Image
{
get { return image; }
set { image = value; }
}
/*Кое.....ент на.енк. .ро.укта
*/
private float extra;
public float Extra
{
get { return extra; }
set { extra = value; }
}
private Category category;
public Category Category
{
get { return category; }
set { category = value; }
}
IList instances = null;
public virtual IList Instances
{
get
{
if (instances == null)
{
instances = new ArrayList();
}
return instances;
}
set
{
instances = value;
}
}
#endregion //Сво.ствa сохран.ем.е в .а.е .анн.х
}
class ProductInstance
{
private int instanceId;
public int InstanceId
{
get { return instanceId; }
set { instanceId = value; }
}
private Product product;
public Product Product
{
get { return product; }
set { product = value; }
}
private string code;
public string Code
{
get { return code; }
set { code = value; }
}
private float price;
public float Price
{
get { return price; }
set { price = value; }
}
private float extra;
public float Extra
{
get { return extra; }
set { extra = value; }
}
}
[/code]