Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UI or BO code?
Message
 
À
24/08/2010 14:51:45
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Divers
Thread ID:
01478134
Message ID:
01478208
Vues:
24
>>>>>>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.
Linda Harmes
HiBit Technologies, Inc.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform