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.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; > } >>