Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UI or BO code?
Message
From
24/08/2010 15:56:00
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Miscellaneous
Thread ID:
01478134
Message ID:
01478214
Views:
23
>>>>>>>From your desc it sounds as if the UI could work the same on both states -
>>>>>>>that makes it automatically a biz rule...
>>>>>>
>>>>>>Thanks, that's my feeling too. Now how do I do this in MM.NET?
>>>...
>>>>Any help appreciated.
>>>
>>>Dunno MM.Net, so may be totally off base,
>>>but I'd look for an action method called by a save GUI event
>>>[hoping that you work with a definite save button and not some rule]
>>>In that action method fork either into update or do a new() followed by copyInfo()
>>>
>>>HTH
>>>
>>>thomas
>>
>>I actually think it is best to do this at the point of getting the data rather than saving it as I can check the status at that point in time whereas at the point of saving it might be a bit tricky to see what the original status was (assuming the user can change the status). I've found a good point in the code to do it, but I definitely need an MM.NET person now to jump in with some advice.
>>
>>Thanks
>
>Frank,
>I think I sent you an incomplete message by hitting the wrong button. Sorry.
>I would consider using either the HookPreSave or the Business Rules. You may also need some sort of posting process that blocks further edits and forces the creation of a new row once a row has been flagged as "Posted", "Bound" or whatever other term you choose.
>Here is some code I got from someone else on identify which column(s) have changed and comparing to original values.
>
>                DataTable dt = oBizObject.DataSet.Tables[oBizObject.TableName];
>                foreach (DataRow row in dt.Rows)
>                {
>                    for (int i = 0; i < dt.Columns.Count; i++)
>                    {
>                        object Val1 = row[i, DataRowVersion.Original];
>                        object Val2 = row[i, DataRowVersion.Current];
>                        if (Val1.ToString() != Val2.ToString())
>                        {
>                            string columnname = dt.Columns[i].ColumnName;
>                        }
>                    }
>                }
>
>If you want to handle this from the business rules, you will need to create a new instance of your business object to create the new row, store the appropriate column values to it from the entity being evaluated and then save the new row. I assume you will probably want to cancel any changes to the current entity.
>I hope that helps.

Hi Linda,

I did not get any other message from you besides this one, so no problem.

I would prefer to not do this at the point of saving, as it just doesn't seem right to me. One of the other complications I foresee is if the save does not work, due to some business rule failing, then I'll have to track the fact that I've already copied the old entity to a new entity and not do it again. Whereas, if I do it at the point of getting the entity, I should be able to just substitute the old entity with the new one and then everything else should just work. I was looking at HookPostGetEntity(), but what I tried does not work (just switching the state to Adding).

If I could trap the fact that the status is Pending, then create a new entity, copy the data from the old entity to the new one and return the new entity, that would work too, but I don't know how to do that in MM.NET.
Frank.

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

Click here to load this message in the networking platform