예제 #1
0
        protected void btnShowLossTemplate_Click(object sender, EventArgs e)
        {
            //int policyId = 0;

            ClaimManager objClaimManager = new ClaimManager();
            int          policyId        = Convert.ToInt32(hdnPolicyIdDetuctible.Value);

            List <Claim> lstClaim = objClaimManager.GetPolicyClaim(policyId);


            using (TransactionScope scope = new TransactionScope())
            {
                //delete all claim from claim limit
                foreach (var claim in lstClaim)
                {
                    int claimId = claim.ClaimID;
                    ClaimLimitManager.IsDeleted(claimId);
                }


                // delete limit,claimlimit,policylimit data which enter as loss details
                LimitManager.DeletePolicyLimit(policyId);

                //first get all limit
                List <Limit> objLimit = LimitManager.GetAllLimit(true);


                foreach (var limit in objLimit)
                {
                    //enter in
                    PolicyLimit objPolicyLimit = new PolicyLimit();
                    objPolicyLimit.PolicyID = policyId;
                    objPolicyLimit.LimitID  = limit.LimitID;
                    PolicyLimitManager.Save(objPolicyLimit);
                }

                //code for enter in all claim in claim limit
                foreach (var claim in lstClaim)
                {
                    foreach (var limit in objLimit)
                    {
                        ClaimLimit objClaimLimit = new ClaimLimit();
                        objClaimLimit.ClaimID = claim.ClaimID;
                        objClaimLimit.LimitID = limit.LimitID;
                        ClaimLimitManager.Save(objClaimLimit);
                    }
                }

                scope.Complete();
            }

            acrossAllCoverages.Enabled = true;
            coverageSpecific.Enabled   = true;
            txtDeductible.Enabled      = true;


            propertyLimits.bindData(policyId);
            //casualtyLimits.bindData(policyId);
        }