Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RowState is unchanged on consecutive adds for a BO
Message
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
RowState is unchanged on consecutive adds for a BO
Miscellaneous
Thread ID:
01297505
Message ID:
01297505
Views:
74
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.
Next
Reply
Map
View

Click here to load this message in the networking platform