Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best way to Add New Records in Related BO/Table
Message
From
25/11/2010 08:30:40
 
 
To
25/11/2010 08:08:19
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01490394
Message ID:
01490462
Views:
27
>>>>Hi,
>>>>
>>>>using MM.NET 3.6 in an ASP.NET project with C#.
>>>>
>>>>I have a Receipt table, with a one to many relationship with a Receipt Details (Line Items) table. For particular types of line items, I need to generate commission records in the commissions table.
>>>>
>>>>What's the best way to handle this?
>>>
>>>Frank,
>>>Are you just trying to add records behind the scenes for the commissions? Can't you just instantiate the business object for commissions and add the records you need? I may not be understanding the full context of your question.
>>>Tim
>>
>>Yeah, I had been thinking about this post and thought I had not stated it clearly.
>>
>>I see this as being a business object thing, again I go back to having a business object manager that handles the relationships between the multiple business objects which is what I am used to in my VFP framework. So I would like a Receipt BO Manager that would have the Receipt BO as the main BO, ReceiptDetailBO as a child and CommissionsBO as another child. Then, whenever a "ReceiptDetailBO.AddRecord" takes place, a "CommissionBO.AddRecord" will get called if the correct receipt detail type has been added.
>>
>>Since I don't think MM has this concept of a BO Manager, I was looking at somehow implementing it as part of the ReceiptDetailBO, but have no idea where to start.
>>
>>I guess I can implement this all at the form level pretty easily, but it just doesn't feel right as it is a Business Process thing to my mind.
>
>Hi Frank,
>Your thinking is correct in that it really shouldn't be in the form. I honestly don't see any reason why it can't be in your receipt business object or another class you create in your business object library. There doesn't have to be only the regular business objects in that project you can create other classes that broker activity between business objects.
>That said, if this is part of the receipt process, then I don't see why the receipt business object cannot have a method such as SaveReceiptWithCommission() and you call this from your form. This method can save the rows of the receipt and also create an instance of the Commission business object to ask that biz obj to save rows of commission type.
>Tim

Thanks Tim,

I'm struggling to get started with this.

I see this as something that should automatically be done when a DetailReceipt record gets saved. The logic should be something like:

Form's save is called, which calls the ReceiptBO.Save(), which then calls the ReceiptDetail.Save(), now somewhere in that Save I need to check "is this ReceiptDetail a Premium Payment?" If it is, then I need to call the CommissionBO.AddRecord() (or whatever it is called) and update the entity values with the calculated commission, then call the CommissionBO.Save(). Of course, this should all be part of the same update transaction so that if the save at any level is unsuccessful, then the entire save is unsuccessful.

Could you suggest what method I should be overriding to add this code in?
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform