How to check Business Rules from a parent BO into a Child BO


Author
Message
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)Advanced StrataFrame User (630 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
I have a Parent BO and a Child BO (using a Chikd Dialog) . I am at  the point where I want to save the Parent and the child out to the Database and want to check the rules first. So I have code like:

if (this.ParentBO1.CheckRules(true) && this.childBO1.CheckRules(true) )
{
this.childBo1.Save();
this.parentBO1.Save();
MessageBox.Show("Document has been saved", "Kernel Software",MessageBoxButtons.OK, MessageBoxIcon.Information);
}


All works fine. But I want to put validation code into the Parent Business object which will be dependent on what's in the child buisness object. e.g. Particular Customers (on the Parent Bo)  can only purchase certain Products (on the child BO). So at the stage I am validating the Parent BO, I need to loop through the Child BO .  I would like to put this valididation code into the CheckRulesOnCurrentRow on the parent BO but am not clear on how I will access the Child Business Object on the Parent Business Object. ( It cant really be done from the ChildBO because the Customer could be changed after a whole pile of products have been added ).
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search