Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BusinessProcess apparently not saving
Message
From
10/07/2012 08:19:10
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01547911
Message ID:
01548001
Views:
51
Hi Kevin,

2 questions:

1. I've been trying to debug this since before I posted here, but when I try to step into that line of code I get a message:

"There is no source code available for the current location"

Googling this didn't turn up any helpful suggestions.

2. How do I check the SaveCanceled and Exception conditions? I can't find any sample code showing me how to check this.


FWIW, I've tried to examine things in the locals window and am seeing that a new field I added to the Policies table has a message by it:

'this.oPolicy.Entity.Reinstated' threw an exception of type 'System.ArgumentException'

Drilling down a bit more gives me the error: Column Reinstated does not exist in table Policies.

It definitely does, but I guess I must have missed a step in generating my code after adding this new field in. Any ideas?

later: I realised that I had not changed my SQL stored procedure to include the new field, so I've solved that error, but the changes to the policy are still not getting saved.

>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?
Frank.

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

Click here to load this message in the networking platform