Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RowState is unchanged on consecutive adds for a BO
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
RowState is unchanged on consecutive adds for a BO
Divers
Thread ID:
01297505
Message ID:
01297505
Vues:
73
All,

I have created a business process that uses two business objects. Essentially, I am adding a single record into the first business object (profit), getting its Primary key and then add two (or more) records in the second business object (offset) that contains the PK from the first as a foreign key.

Here is the code for adding the two child rows:
            // Now add the offset records
            hasBrokenRules = this.CreateOffsetRecord(tradeID1, profitID, quantity);
            if (hasBrokenRules)
            {
                this.oProfit.GetProfitByProfitID(profitID);
                this.oProfit.Delete();
                return mmSaveDataResult.RulesBroken;
            }
            hasBrokenRules = this.CreateOffsetRecord(tradeID2, profitID, quantity);
            if (hasBrokenRules)
            {
                this.oProfit.GetProfitByProfitID(profitID);
                this.oProfit.Delete();
                return mmSaveDataResult.RulesBroken;
            }
If rules are broken, I am just deleting the profit record. Now, heres the problem. When I run createoffsetrecord the second time, the checkruleshook method in the Rules class for the offset object does not run because the RowChanged state is "Unchanged".

Here is the createoffsetrecord method:
private bool CreateOffsetRecord(int tradeID, int profitID, int quantity)
        {
            OffsetDefaults OD = new OffsetDefaults(profitID, tradeID);
            this.oOffset.NewEntity(OD);
            this.oOffset.Entity.offsetqty = quantity;
            this.oOffset.SaveEntity();
            return this.oOffset.Rules.HasBrokenRules;
        }
The second record I am adding has a different tradeID, so my question is why is the RowState unchanged on the second add row operation? Am I missing some command here?

Any help is appreciated.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform