Design Clarification

Design Clarification

Old forum URL: forums.lhotka.net/forums/t/6122.aspx


pac posted on Sunday, January 11, 2009

Hi,

I have a use case where,

When a user is creating a new person, if the user hasn't chosen to use an already existing Family record then I want to create a new family using the address data details entered against that person before insert so I have a guid to assign to that members required foreign key family field.

Where would be the best place to have this routine in the BusinessBase of the person? Please keep in mind that I do not want to update this family record on every save, I just want to insert it if it is not there on the creation of a new member.

Sorry this is probably quite a newbie question.. but that is what I am at this point in time :)

daniel_higgins replied on Sunday, January 11, 2009

I just want to point out that you can use a third class that specifically handles the business rules around the creation of a Person.

ajj3085 replied on Monday, January 12, 2009

Well, assuming you'll have a BO that lets you edit family data, you could have an internal method off of Family that the Person BO can use for this purpose. 

pac replied on Monday, January 12, 2009

Thanks for the reply ajj!

Yes we do have a family BO and can call a method from there to insert the family data.
Where would the call to the family BO sit? Would we put it into the DataPortal_Insert of the Person, checking the familyFK for Guid.Empty and call the Family BO function passing in the details of which we want saved? Or is there a more correct place to call this function?

Also would this be something you would expect the internal family method to look like?

public static Guid CreateFamilyfromPersonDetails(person tempperson)
{
FamilyBase NewFamily = NewFamilyBase();
NewFamily.FamilyName = tempperson.Surname;
NewFamily.Address1 = tempperson.Address1;
NewFamily.Address2 = tempperson.Address2;
.....
NewFamily.Save();
return NewFamily.ID;
}

Calling it like so?

if (FKFamily == Guid.Empty)
{
FKFamily = FamilyBase.CreateFamilyfromPersonDetails(this);
}

Sorry again I know this is probably quite basic, we have the Business Objects 2008 book on order which should arrive in the next couple of days so we hopefully won't have to bother you with these types of questions again :P

Copyright (c) Marimer LLC