Exemplo n.º 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);
        }
        public void saveLimits(int claimID)
        {
            int        claimLimitID = 0;
            int        limitID      = 0;
            ClaimLimit limit        = null;

            foreach (GridViewRow row in gvLimits.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    try {
                        WebNumericEditor txtLossAmount = row.FindControl("txtLossAmount") as WebNumericEditor;


                        claimLimitID = (int)gvLimits.DataKeys[row.RowIndex].Values[0];
                        limitID      = (int)gvLimits.DataKeys[row.RowIndex].Values[1];

                        if (claimLimitID == 0)
                        {
                            // new record
                            limit         = new ClaimLimit();
                            limit.ClaimID = claimID;
                            limit.LimitID = limitID;
                        }
                        else
                        {
                            limit = ClaimLimitManager.Get(claimLimitID);
                        }

                        limit.LossAmountACV = txtLossAmount.Value == null ? 0 : Convert.ToDecimal(txtLossAmount.Value);


                        ClaimLimitManager.Save(limit);
                    }
                    catch (Exception ex) {
                        Core.EmailHelper.emailError(ex);
                    }
                }
            }
        }