Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BusinessProcess apparently not saving
Message
 
To
09/07/2012 14:30:36
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01547911
Message ID:
01547943
Views:
50
Frank,

First of all, when you run this line of code:
mmSaveDataResult result = this.oPolicyHeader.SaveEntity();
Some of the possible results in the mmSaveDataResult enum are SaveCanceled and Exception. Looks like you're not checking for either of these, so either condition could be occurring and you wouldn't know it.

If after checking for these conditions, and you're still not saving, I recommend setting a breakpoint on the above line of code and stepping through to take a closer look at what's happening.

Best Regards,




>I have a Business Process defined like this:
>
>
    public partial class PolicyDailyBusinessProcess : mmBusinessProcess
>    {
>        protected PolicyHeader oPolicyHeader;
>        protected Policy oPolicy;
>        protected PolicyLoan oPolicyLoan;
>        protected Receipt oReceipt;
>        protected ReceiptDetail oReceiptDetail;
>        protected PolicyRider oPolicyRider;
>
>        protected override void DefineParticipatingObjects()
>        {
>            this.oPolicyHeader = (PolicyHeader)this.RegisterBizObj(new PolicyHeader());
>            this.oPolicy = (Policy)this.RegisterBizObj(new Policy());
>            this.oPolicyLoan = (PolicyLoan)this.RegisterBizObj(new PolicyLoan());
>            this.oReceipt = (Receipt)this.RegisterBizObj(new Receipt());
>            this.oReceiptDetail = (ReceiptDetail)this.RegisterBizObj(new ReceiptDetail());
>            this.oPolicyRider = (PolicyRider)this.RegisterBizObj(new PolicyRider());
>
>            this.oPolicyHeader.RegisterChildBizObj(this.oPolicy);
>            this.oPolicyHeader.RegisterChildBizObj(this.oPolicyLoan);
>            this.oPolicyHeader.RegisterChildBizObj(this.oReceipt);
>            this.oReceipt.RegisterChildBizObj(this.oReceiptDetail);
>            this.oPolicy.RegisterChildBizObj(this.oPolicyRider);
>        }
>
>        public void ProcessAllActivePolicies(int userPK)
>        {
>            mmBindingList<PolicyHeaderEntity> PolicyHeaderList = this.oPolicyHeader.GetActivePolicies();
>            foreach (PolicyHeaderEntity oPolicyHeaderEntity in PolicyHeaderList)
>            {
>
>                mmSaveDataResult result = DailyProcessPolicy(oPolicyHeaderEntity, userPK);
>                if (result != mmSaveDataResult.RulesPassed)
>                {
>                    string rules = this.Rules.GetAllBrokenRules();
>                }
>
>            }
>
>        }
>
>        public mmSaveDataResult DailyProcessPolicy(PolicyHeaderEntity oPolicyHeaderEntity, int userPK)
>        {
>            this.oPolicyHeader.GetEmptyDataSet();
>            this.oPolicyHeader.GetPolicyHeaderByPolicyHeaderPK(oPolicyHeaderEntity.PolicyHeaderPK);
>
>            this.oPolicy = new Policy();
>            this.oPolicy.GetEmptyDataSet();
>            this.oPolicy.GetPolicyByPolicyHeaderFK(oPolicyHeaderEntity.PolicyHeaderPK);
>            
>            Boolean saveChanges;
>            saveChanges = false;
>            // still to do:
>            // adjustments to the premiums due to dependants’ ages, and other factors causing riders to be dropped off.
>
>            // Check if to send a notice of payment due
>            if (PremiumIsDue()) //oPolicy, oPolicyHeader))
>            {
>                SendPremiumDueNotice();  //oPolicy);
>                saveChanges = true;
>            }
>            else
>                // Check if to send a notice of payment late
>                if (PremiumIsLate())    //oPolicy, oPolicyHeader))
>                {
>                    SendPremiumLateNotice();
>                    saveChanges = true;
>                }
>                else
>                    // Check if lapsing
>                    if (Lapsing())  //oPolicy, oPolicyHeader))
>                    {
>                        Lapse(userPK);    //oPolicy, oPolicyHeader, userPK);
>                        saveChanges = true;
>                    }
>                    else
>                        // Check if Scheduled Termination
>                        if (Terminating())
>                        {
>                            Terminate();
>                            saveChanges = true;
>                        }
>                        else
>                            // check for change in premium
>                            if (PremiumNeedsChanging())
>                            {
>                                ChangePremium();
>                                saveChanges = true;
>                            }
>
>            if (saveChanges == true)
>            {
>                mmSaveDataResult result = this.oPolicyHeader.SaveEntity();
>                // Return a result that indicates if there were any broken rules or warnings
>                if (this.BusinessRuleObj.HasBrokenRules)
>                {
>                    string rules = this.BusinessRuleObj.GetAllBrokenRules();
>                    return mmSaveDataResult.RulesBroken;
>                }
>                if (this.BusinessRuleObj.HasWarnings)
>                {
>                    return mmSaveDataResult.RuleWarnings;
>                }
>
>            }
>            return mmSaveDataResult.RulesPassed;
>        }
>
>
>My particular problem is that during a call to ProcessAllActivePolicies a value gets changed in oPolicy, but this change is not getting saved. Any ideas what could be causing this?
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform