Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BusinessProcess apparently not saving
Message
From
18/07/2012 11:02:23
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01547911
Message ID:
01548781
Views:
60
>Frank,
>
>>This is the code I was calling:
>>
>>
        public PolicyEntity GetPolicyByPolicyHeaderFK(Guid policyHeaderFK)
>>        {
>>            return this.GetEntity("PoliciesSelectByPolicyHeaderFK",
>>                this.CreateParameter("@PolicyHeaderFK", policyHeaderFK));
>>        }
>>
>>
>>I found the section on using business processes in the help and tried adjusting my code like this:
>>
>>
        public mmSaveDataResult DailyProcessPolicy(PolicyHeaderEntity oPolicyHeaderEntity, int userPK)
>>        {
>>// do I need to call GetEmptyDataSet first?
>>            this.oPolicyHeader.GetEmptyDataSet();
>>            this.oPolicyHeader.GetPolicyHeaderByPolicyHeaderPK(oPolicyHeaderEntity.PolicyHeaderPK);
>>
>>            mmBindingList<PolicyEntity> PolicyList = this.oPolicy.GetPolicyListByPolicyHeaderFK(oPolicyHeaderEntity.PolicyHeaderPK);
>>
>>
>>So I am now returning an Entity List and things apparently work. However I am still a little confused as I still make my changes to the Entity and that is now being reflected in the Entity list and getting saved.
>
>All the entities you retrieve using the business controller object get included in the entity list, so making a change to the entity then saving the list saves the entity too.
>
>Best Regards,

Thanks, I'm still not too clear on that. Just to make sure I've understood this, please tell me if my logic here is correct:

I declare my BOs:
        protected PolicyHeader oPolicyHeader;
        protected Policy oPolicy;
then I register them:
            this.oPolicyHeader = (PolicyHeader)this.RegisterBizObj(new PolicyHeader());
            this.oPolicy = (Policy)this.RegisterBizObj(new Policy());
then I register the policy as a child of the policy header:
this.oPolicyHeader.RegisterChildBizObj(this.oPolicy);
Now I get a list of all the policy headers and process them one at a time:
            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();
                }

            }
In my processing of each one, I get the PolicyHeader I'm dealing with, then I want to get the Policy entity List (which will always only be one policy) for the header and then change a value on the Policy:
        public mmSaveDataResult DailyProcessPolicy(PolicyHeaderEntity oPolicyHeaderEntity, int userPK)
        {
// do i need to get an empty data set if I then get a specific policy header?
            this.oPolicyHeader.GetEmptyDataSet();
            this.oPolicyHeader.GetPolicyHeaderByPolicyHeaderPK(oPolicyHeaderEntity.PolicyHeaderPK);
            mmBindingList<PolicyEntity> PolicyList = this.oPolicy.GetPolicyListByPolicyHeaderFK(oPolicyHeaderEntity.PolicyHeaderPK);

                oPolicyHeader.Entity.LapseNoticeSent = DateTime.Today;

                oPolicy.Entity.StatusFK = (int)Policy.StatusCode.Lapsed;
}
So by doing this:

oPolicy.Entity.StatusFK = (int)Policy.StatusCode.Lapsed;

I am actually referring to the policy entity that was returned by the call:

this.oPolicy.GetPolicyListByPolicyHeaderFK(oPolicyHeaderEntity.PolicyHeaderPK);

Is that right?
Frank.

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

Click here to load this message in the networking platform