Пример #1
0
        public static void primePolicyLimits(int policyID)
        {
            PolicyLimit  propertyLimit = null;
            List <Limit> limits        = null;

            // read policy limits
            limits = LimitManager.GetAll(LimitType.LIMIT_TYPE_PROPERTY);

            if (limits != null && limits.Count > 0)
            {
                using (TransactionScope scope = new TransactionScope()) {
                    try {
                        foreach (Limit limit in limits)
                        {
                            // create new policy limit
                            propertyLimit = new PolicyLimit {
                                LimitID  = limit.LimitID,
                                PolicyID = policyID,
                            };

                            // add policy limit
                            Save(propertyLimit);
                        }
                        scope.Complete();
                    }
                    catch (Exception ex) {
                    }
                }
            }
        }
Пример #2
0
        protected void AddLimitPolicy(int policyId)
        {
            Limit       limits         = null;
            Limit       limits2        = null;
            PolicyLimit objPolicyLimit = null;

            DataTable tbllimitGet          = HttpContext.Current.Session["Limit"] as DataTable;
            DataTable tblPolicylimitGet    = HttpContext.Current.Session["PolicyLimit"] as DataTable;
            DataTable tblAllPolicylimitGet = HttpContext.Current.Session["tblAllPolicylimit"] as DataTable;

            string type = string.Empty;

            for (int count = 0; count < tbllimitGet.Rows.Count; count++)
            {
                limits                  = new Limit();
                limits.LimitLetter      = tbllimitGet.Rows[count]["LimitLetter"].ToString();
                limits.LimitType        = Convert.ToInt32(tbllimitGet.Rows[count]["LimitType"].ToString());
                limits.LimitDescription = tbllimitGet.Rows[count]["LimitDescription"].ToString();
                limits.IsStatic         = Convert.ToBoolean(tbllimitGet.Rows[count]["IsStatic"].ToString());
                limits2                 = LimitManager.Save(limits);


                objPolicyLimit                        = new PolicyLimit();
                objPolicyLimit.PolicyID               = policyId;
                objPolicyLimit.LimitID                = limits2.LimitID;
                objPolicyLimit.LimitAmount            = Convert.ToDecimal(tblAllPolicylimitGet.Rows[count]["LimitAmount"].ToString());
                objPolicyLimit.LimitDeductible        = Convert.ToDecimal(tblAllPolicylimitGet.Rows[count]["LimitDeductible"].ToString());
                objPolicyLimit.ITV                    = Convert.ToDecimal(tblAllPolicylimitGet.Rows[count]["ITV"].ToString());
                objPolicyLimit.Reserve                = Convert.ToDecimal(tblAllPolicylimitGet.Rows[count]["Reserve"].ToString());
                objPolicyLimit.IsDeleted              = Convert.ToBoolean(tblAllPolicylimitGet.Rows[count]["IsDeleted"].ToString());
                objPolicyLimit.ApplyAcrossAllCoverage = Convert.ToBoolean(tblAllPolicylimitGet.Rows[count]["ApplyAcrossAllCoverage"].ToString());
                objPolicyLimit.ApplyTo                = tblAllPolicylimitGet.Rows[count]["ApplyTo"].ToString();
                PolicyLimitManager.Save(objPolicyLimit);
            }
        }
Пример #3
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);
        }
Пример #4
0
        public static PolicyLimit Get(int id)
        {
            PolicyLimit limit = null;

            limit = (from x in DbContextHelper.DbContext.PolicyLimit
                     where x.PolicyLimitID == id
                     select x).FirstOrDefault <PolicyLimit>();

            return(limit);
        }
Пример #5
0
        public static PolicyLimit Save(PolicyLimit limit)
        {
            if (limit.PolicyLimitID == 0)
            {
                DbContextHelper.DbContext.Add(limit);
            }

            DbContextHelper.DbContext.SaveChanges();

            return(limit);
        }
Пример #6
0
        public static void UpdatePolicyLimit(PolicyLimit objlimit)
        {
            int         limitID        = objlimit.LimitID;
            int         PolicyID       = objlimit.PolicyID;
            PolicyLimit objPolicyLimit = DbContextHelper.DbContext.PolicyLimit.First(x => x.LimitID == limitID && x.PolicyID == PolicyID);

            objPolicyLimit.LimitAmount       = objlimit.LimitAmount;
            objPolicyLimit.LimitDeductible   = objlimit.LimitDeductible;
            objPolicyLimit.LimitDeductible   = objlimit.LimitDeductible;
            objPolicyLimit.CATDeductible     = objlimit.CATDeductible;
            objPolicyLimit.ConInsuranceLimit = objlimit.ConInsuranceLimit;
            objPolicyLimit.ITV     = objlimit.ITV;
            objPolicyLimit.Reserve = objlimit.Reserve;
            objPolicyLimit.ApplyAcrossAllCoverage = objlimit.ApplyAcrossAllCoverage;
            objPolicyLimit.ApplyTo = objlimit.ApplyTo;

            DbContextHelper.DbContext.SaveChanges();
        }
Пример #7
0
        protected void gvLimits_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            PolicyLimit limit = null;

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                WebDropDown ddlSettlementType = e.Row.FindControl("ddlSettlementType") as WebDropDown;
                if (e.Row.DataItem != null)
                {
                    limit = e.Row.DataItem as PolicyLimit;
                    try {
                        ddlSettlementType.SelectedValue = limit.ApplyTo;
                    }
                    catch (Exception ex) {
                        ddlSettlementType.SelectedItemIndex = 1;
                    }
                }
            }
        }
Пример #8
0
        public static bool PolicyIsStaticTrue(int policyID)
        {
            bool        isTemplate  = false;
            PolicyLimit policyLimit = (from s in DbContextHelper.DbContext.PolicyLimit
                                       where s.PolicyID == policyID
                                       select s).FirstOrDefault();

            if (policyLimit != null)
            {
                Limit Limit = (from s in DbContextHelper.DbContext.Limit
                               where s.LimitID == policyLimit.LimitID
                               select s).FirstOrDefault();
                if (Limit != null)
                {
                    isTemplate = Limit.IsStatic ?? false;
                }
            }

            return(isTemplate);
        }
Пример #9
0
        public static void Delete(int id)
        {
            // Create an entity to represent the Entity you wish to delete
            // Notice you don't need to know all the properties, in this
            // case just the ID will do.
            PolicyLimit limit = new PolicyLimit {
                PolicyLimitID = id
            };

            // Now attach the category stub object to the "Categories" set.
            // This puts the Entity into the context in the unchanged state,
            // This is same state it would have had if you made the query
            DbContextHelper.DbContext.AttachTo("PolicyLimits", limit);


            // Do the delete the category
            DbContextHelper.DbContext.DeleteObject(limit);

            // Apply the delete to the database
            DbContextHelper.DbContext.SaveChanges();
        }
        public void saveLimits(int policyID)
        {
            int         policyLimitID = 0;
            int         limitID       = 0;
            PolicyLimit limit         = null;

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


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

                    if (policyLimitID == 0)
                    {
                        limit = new PolicyLimit();
                    }
                    else
                    {
                        limit = PolicyLimitManager.Get(policyLimitID);
                    }

                    limit.PolicyLimitID = policyLimitID;
                    limit.LimitID       = limitID;

                    limit.PolicyID    = policyID;
                    limit.LimitAmount = txtLimit.Value == null ? 0 : Convert.ToDecimal(txtLimit.Value);

                    try {
                        PolicyLimitManager.Save(limit);
                    }
                    catch (Exception ex) {
                        Core.EmailHelper.emailError(ex);
                    }
                }
            }
        }
        public static string SaveLossDetails(int policyID, string coverage, string type, string policyLimit, string deductible, string applyTo, string itv, string reserve, int acrossall, string catDeductible, string coInsuranceLimit)
        {
            string json = "";
            int limitID = 0;

            ClaimLimit claimLimit = null;
            PolicyLimit objPolicyLimit = null;

            Limit limits = null;
            Limit limits2 = null;
            int userID = SessionHelper.getUserId();
            ClaimManager objClaimManager = new ClaimManager();

            try
            {
                using (TransactionScope scope = new TransactionScope())
                {

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

                    bool isTemplate = ClaimLimitManager.PolicyIsStaticTrue(policyID);

                    if (isTemplate)
                    {

                        PolicyLimitManager.IsDeleted(policyID);
                        //if coverage first time then delete all template data from all claimid
                        foreach (var claim in lstClaim)
                        {
                            int claimId = claim.ClaimID;
                            ClaimLimitManager.IsDeleted(claimId);
                        }

                    }

                    limits = new Limit();
                    limits.LimitLetter = coverage;
                    if (type == "Contacts" || type == "Personal Liability" || type == "Medical Payments")
                    {
                        limits.LimitType = 2;
                    }
                    else
                    {
                        limits.LimitType = 1;
                    }
                    limits.LimitDescription = type;
                    limits.IsStatic = false;
                    limits2 = LimitManager.Save(limits);

                    limitID = limits2.LimitID;

                    objPolicyLimit = new PolicyLimit();
                    objPolicyLimit.PolicyID = policyID;
                    objPolicyLimit.LimitID = limitID;
                    if (!string.IsNullOrEmpty(policyLimit))
                    {
                        objPolicyLimit.LimitAmount = Convert.ToDecimal(policyLimit);
                    }
                    else
                    {
                        objPolicyLimit.LimitAmount = 0;
                    }
                    if (!string.IsNullOrEmpty(deductible))
                    {
                        objPolicyLimit.LimitDeductible = Convert.ToDecimal(deductible);
                    }
                    else
                    {
                        objPolicyLimit.LimitDeductible = 0;
                    }
                    //new fields add
                    if (!string.IsNullOrEmpty(catDeductible))
                    {
                        objPolicyLimit.CATDeductible = catDeductible;
                    }
                    if (!string.IsNullOrEmpty(coInsuranceLimit))
                    {
                        objPolicyLimit.ConInsuranceLimit = Convert.ToDecimal(coInsuranceLimit);
                    }
                    else
                    {
                        objPolicyLimit.LimitDeductible = 0;
                    }

                    if (!string.IsNullOrEmpty(itv))
                    {
                        objPolicyLimit.ITV = Convert.ToDecimal(itv);
                    }
                    else
                    {
                        objPolicyLimit.ITV = 0;
                    }
                    if (!string.IsNullOrEmpty(reserve))
                    {
                        objPolicyLimit.Reserve = Convert.ToDecimal(reserve);
                    }
                    else
                    {
                        objPolicyLimit.Reserve = 0;
                    }
                    objPolicyLimit.IsDeleted = false;
                    if (acrossall == 1)
                    {
                        objPolicyLimit.ApplyAcrossAllCoverage = true;
                    }
                    else
                    {
                        objPolicyLimit.ApplyAcrossAllCoverage = false;
                    }
                    objPolicyLimit.ApplyTo = applyTo;

                    PolicyLimitManager.Save(objPolicyLimit);

                    // enter data for each claim
                    foreach (var claim in lstClaim)
                    {

                        claimLimit = new ClaimLimit();
                        claimLimit.ClaimID = claim.ClaimID;
                        claimLimit.LimitID = limitID;
                        claimLimit.LossAmountACV = 0;
                        claimLimit.LossAmountRCV = 0;
                        claimLimit.Depreciation = 0;
                        claimLimit.OverageAmount = 0;
                        claimLimit.NonRecoverableDepreciation = 0;
                        claimLimit.IsDeleted = false;
                        ClaimLimitManager.Save(claimLimit);

                    }

                    scope.Complete();
                }
                json = "Loss details successfully add";

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

            return json;
        }
Пример #12
0
        protected void btnShowLossTemplate_Click(object sender, EventArgs e)
        {
            int policyId = 0;
            Claim objClaim = null;
            ClaimManager objClaimManager = new ClaimManager();
            int claimId = Convert.ToInt32(hf_ClaimIdForStatus.Value);
            using (TransactionScope scope = new TransactionScope())
            {

                objClaim = objClaimManager.Get(claimID);
                policyId = objClaim.PolicyID;

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

                //ClaimLimitManager.IsDeleted(claimId);
                // PolicyLimitManager.IsDeleted(policyId);

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

                foreach (var limit in objLimit)
                {
                    ClaimLimit objClaimLimit = new ClaimLimit();
                    objClaimLimit.ClaimID = claimId;
                    objClaimLimit.LimitID = limit.LimitID;
                    ClaimLimitManager.Save(objClaimLimit);

                    PolicyLimit objPolicyLimit = new PolicyLimit();
                    objPolicyLimit.PolicyID = policyId;
                    objPolicyLimit.LimitID = limit.LimitID;
                    PolicyLimitManager.Save(objPolicyLimit);
                }

                Data.Entities.LeadPolicy objLeadPolicy = new Data.Entities.LeadPolicy();
                objLeadPolicy.Id = policyId;
                objLeadPolicy.ApplyAcrossAllCoverage = false;
                objLeadPolicy.ApplyDeductibleSet = false;
                LeadPolicyManager.Update(objLeadPolicy);
                scope.Complete();
            }

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

            propertyLimits.bindData(policyID);

               // casualtyLimits.bindData(claimId);
        }
        public void saveLimits(int policyID)
        {
            int policyLimitID = 0;
            int limitID = 0;
            //int claimLimitID = 0;
            int myClaimID = 0;
            int myClaimLimitID = 0;
            int myLimitId = 0; //anything prefaced with "my" is new; OC
            myClaimID = SessionHelper.getClaimID(); //Convert.ToInt32(Session["ClaimID"]);
            PolicyLimit limit = null;
            PolicyLimit myPolicyLimit = null;
            Limit myLimit = null;
               // ClaimLimit myClaimLimit = null;
            //added new; OC 9/11/2014: put in place to add new row to the policy limits grid. took the old 3 column one out.
            //crete the footer controls available for use here :OC 9/12/14
            WebTextEditor txtMyCoverage = (WebTextEditor)gvLimits.FooterRow.FindControl("txtMyCoverage");
            WebTextEditor txtMyDescription = (WebTextEditor)gvLimits.FooterRow.FindControl("txtMyDescription");
            WebNumericEditor txtMyLimit = (WebNumericEditor)gvLimits.FooterRow.FindControl("txtMyLimit");
            WebNumericEditor txtMyDeductible = (WebNumericEditor)gvLimits.FooterRow.FindControl("txtMyDeductible");
            WebTextEditor txtMyCATDeductible = (WebTextEditor)gvLimits.FooterRow.FindControl("txtMyCATDeductible");
            WebDropDown ddlMySettlementType = (WebDropDown)gvLimits.FooterRow.FindControl("ddlMySettlementType");
            WebPercentEditor txtMyCoInsuranceLimit = (WebPercentEditor)gvLimits.FooterRow.FindControl("txtMyCoInsuranceLimit");
            WebPercentEditor txtMyITV = (WebPercentEditor)gvLimits.FooterRow.FindControl("txtMyITV");
            WebNumericEditor txtMyReserve = (WebNumericEditor)gvLimits.FooterRow.FindControl("txtMyReserve");
            WebTextEditor txtMyWHDeductible = (WebTextEditor)gvLimits.FooterRow.FindControl("txtMyWHDeductible");
            WebNumericEditor txtMyLossAmountACV = (WebNumericEditor)gvLimits.FooterRow.FindControl("txtMyLossAmountACV");
            WebNumericEditor txtMyLossAmountRCV = (WebNumericEditor)gvLimits.FooterRow.FindControl("txtMyLossAmountRCV");
            WebNumericEditor txtMyOverage = (WebNumericEditor)gvLimits.FooterRow.FindControl("txtMyOverage");

            if (txtMyCoverage.Text != "")//TODO: change this condition to something more stable (checkbox or something)
            {
                //LIMIT TABLE STUFF
                myLimit = new Limit();
                myLimit.LimitLetter = txtMyCoverage.Text;
                myLimit.LimitType = 1;//need to change to user input and create text boxes
                myLimit.LimitDescription = txtMyDescription.Text;
                myLimit.IsStatic = false;
                try
                {
                    LimitManager.Save(myLimit);
                }
                catch (Exception ex)
                {
                    Core.EmailHelper.emailError(ex);
                }

                var a = LimitManager.GetLatest(); //need to get the lastly created limit id from the insert we just did above
                myLimitId = Convert.ToInt32(a.LimitID);

                //CLAIM LIMIT STUFF
                //myClaimLimit = new ClaimLimit();
                //myClaimLimit.LimitID = myLimitId;
                //myClaimLimit.ClaimID = myClaimID;
                //myClaimLimit.PolicyID = policyID;
                //myClaimLimit.LossAmountACV = txtMyLossAmountACV.Value == null ? 0 : Convert.ToDecimal(txtMyLossAmountACV.Text);
                //myClaimLimit.LossAmountRCV = txtMyLossAmountRCV.Value == null ? 0 : Convert.ToDecimal(txtMyLossAmountRCV.Text);
                //myClaimLimit.OverageAmount = txtMyOverage.Value == null ? 0 : Convert.ToDecimal(txtMyOverage.Text);
                //try
                //{
                //    ClaimLimitManager.Save(myClaimLimit);
                //}
                //catch (Exception ex)
                //{

                //}
                //var b = ClaimLimitManager.GetLatest();
                //myClaimLimitID = Convert.ToInt32(b.ClaimLimitID);

                //POLICY LIMIT STUFF
                myPolicyLimit = new PolicyLimit();
                myPolicyLimit.PolicyID = policyID;
                myPolicyLimit.LimitID = myLimitId;
                myPolicyLimit.ClaimLimitID = myClaimLimitID;
                myPolicyLimit.LimitAmount = txtMyLimit.Value == null ? 0 : Convert.ToDecimal(txtMyLimit.Text); //= Convert.ToDecimal(txtMyLimit.Text);
                myPolicyLimit.LimitDeductible = txtMyDeductible.Value == null ? 0 : Convert.ToDecimal(txtMyDeductible.Text);
                myPolicyLimit.CATDeductible = txtMyCATDeductible.Text;
                if(ddlMySettlementType.SelectedItemIndex > 0)
                {
                    myPolicyLimit.ApplyTo = ddlMySettlementType.SelectedItem.Text;
                }
                else
                {
                    myPolicyLimit.ApplyTo = null;
                }

                myPolicyLimit.ConInsuranceLimit = Convert.ToDecimal(txtMyCoInsuranceLimit.Value);
                myPolicyLimit.ITV = Convert.ToDecimal(txtMyITV.Value);
                myPolicyLimit.Reserve = Convert.ToDecimal(txtMyReserve.Value);
                myPolicyLimit.WindHailDeductible = txtMyWHDeductible.Text;
                myPolicyLimit.LossAmountACV = txtMyLossAmountACV.Value == null ? 0 : Convert.ToDecimal(txtMyLossAmountACV.Text);
                myPolicyLimit.LossAmountRCV = txtMyLossAmountRCV.Value == null ? 0 : Convert.ToDecimal(txtMyLossAmountRCV.Text);
                myPolicyLimit.OverageAmount = txtMyOverage.Value == null ? 0 : Convert.ToDecimal(txtMyOverage.Text);

                try
                {
                    PolicyLimitManager.Save(myPolicyLimit);
                }
                catch (Exception ex)
                {

                }

            }

            else //run the regular stuff it was doing before
            {

                //original code
                foreach (GridViewRow row in gvLimits.Rows)
                {
                    if (row.RowType == DataControlRowType.DataRow)
                    {
                        //Label txtLimitLetter = row.FindControl("txtLimitLetter") as Label;
                        //Label txtDescription = row.FindControl("txtDescription") as Label;
                        WebNumericEditor txtLimit = row.FindControl("txtLimit") as WebNumericEditor;
                        WebNumericEditor txtDeductible = row.FindControl("txtDeductible") as WebNumericEditor;
                        WebTextEditor txtWHDeductible = row.FindControl("txtWHDeductible") as WebTextEditor;//new
                        WebTextEditor txtCATDeductible = row.FindControl("txtCATDeductible") as WebTextEditor;
                        WebTextEditor txtSettlementType = row.FindControl("txtSettlementType") as WebTextEditor;
                        WebNumericEditor txtCoInsuranceLimit = row.FindControl("txtCoInsuranceLimit") as WebNumericEditor;
                        WebDropDown ddlSettlementType = row.FindControl("ddlSettlementType") as WebDropDown;
                        WebPercentEditor txtITV = row.FindControl("txtITV") as WebPercentEditor;//new
                        WebNumericEditor txtReserve = row.FindControl("txtReserve") as WebNumericEditor;//new
                        WebNumericEditor txtLossAmountACV = row.FindControl("txtLossAmountACV") as WebNumericEditor;//new
                        WebNumericEditor txtLossAmountRCV = row.FindControl("txtLossAmountRCV") as WebNumericEditor;//new
                        WebNumericEditor txtOverage = row.FindControl("txtOverage") as WebNumericEditor;//new
                        policyLimitID = (int)gvLimits.DataKeys[row.RowIndex].Values[0];
                        limitID = (int)gvLimits.DataKeys[row.RowIndex].Values[1];

                        //claimLimitID = (int)gvLimits.DataKeys[row.RowIndex].Values[2];
                        //claimLimitID = (int)gvLimits.DataKeys[row.RowIndex].Values[2];
                        //if ((txtLossAmountACV.Text != "" ||
                        //    txtLossAmountRCV.Text != "" ||
                        //    txtOverage.Text != "" )&&
                        //   ( txtOverage.Text != "0.00" ||
                        //    txtLossAmountRCV.Text != "0.00" ||
                        //    txtLossAmountACV.Text != "0.00"))
                        //{
                        //CLAIM LIMIT STUFF
                            //myClaimLimit = new ClaimLimit();
                            //myClaimLimit.ClaimLimitID = claimLimitID;
                            //myClaimLimit.LimitID = limitID;
                            //myClaimLimit.ClaimID = myClaimID;
                            //myClaimLimit.PolicyID = policyID;
                            //myClaimLimit.PolicyLimitID = policyLimitID;
                            //myClaimLimit.LossAmountACV = txtLossAmountACV.Value == null ? 0 : Convert.ToDecimal(txtLossAmountACV.Text);
                            //myClaimLimit.LossAmountRCV = txtLossAmountRCV.Value == null ? 0 : Convert.ToDecimal(txtLossAmountRCV.Text);
                            //myClaimLimit.OverageAmount = txtOverage.Value == null ? 0 : Convert.ToDecimal(txtOverage.Text);
                            //try
                            //{
                            //    ClaimLimitManager.Save(myClaimLimit);
                            //}
                            //catch (Exception ex)
                            //{

                            //}
                            ////    var b = ClaimLimitManager.GetLatest2(policyLimitID);
                            ////    myClaimLimitID = Convert.ToInt32(b.ClaimLimitID);
                            ////}
                        if (policyLimitID == 0)
                            limit = new PolicyLimit();
                        else
                            limit = PolicyLimitManager.Get(policyLimitID);

                        limit.PolicyLimitID = policyLimitID;
                        limit.LimitID = limitID;
                        //limit.ClaimLimitID = claimLimitID;
                        limit.PolicyID = policyID;
                        limit.LimitAmount = txtLimit.Value == null ? 0 : Convert.ToDecimal(txtLimit.Value);
                        limit.LimitDeductible = txtDeductible.Value == null ? 0 : Convert.ToDecimal(txtDeductible.Value);
                        limit.CATDeductible = txtCATDeductible.Text;
                        limit.WindHailDeductible = txtWHDeductible.Text;
                        limit.ConInsuranceLimit = txtCoInsuranceLimit.Value == null ? 0 : Convert.ToDecimal(txtCoInsuranceLimit.Value);
                        limit.ITV = Convert.ToDecimal(txtITV.Value);
                        limit.Reserve = Convert.ToDecimal(txtReserve.Value);
                        limit.LossAmountACV = txtLossAmountACV.Value == null ? 0 : Convert.ToDecimal(txtLossAmountACV.Text);
                        limit.LossAmountRCV = txtLossAmountRCV.Value == null ? 0 : Convert.ToDecimal(txtLossAmountRCV.Text);
                        limit.OverageAmount = txtOverage.Value == null ? 0 : Convert.ToDecimal(txtOverage.Text);
                        if (ddlSettlementType.SelectedItemIndex > 0)
                        {
                            //limit.SettlementType = ddlSettlementType.SelectedValue;
                            limit.ApplyTo = ddlSettlementType.SelectedValue;
                        }
                        else
                        {
                            limit.ApplyTo = null;
                        }

                        try
                        {
                            PolicyLimitManager.Save(limit);
                        }
                        catch (Exception ex)
                        {
                            Core.EmailHelper.emailError(ex);
                        }
                    }
                }
            }
            cbAddNewPolicy.Checked = false;
            disableNewRow();
        }
Пример #14
0
        protected void AddLimitPolicy(int policyId)
        {
            Limit limits = null;
            Limit limits2 = null;
            PolicyLimit objPolicyLimit = null;

            DataTable tbllimitGet = HttpContext.Current.Session["Limit"] as DataTable;
            DataTable tblPolicylimitGet = HttpContext.Current.Session["PolicyLimit"] as DataTable;
            DataTable tblAllPolicylimitGet = HttpContext.Current.Session["tblAllPolicylimit"] as DataTable;

            string type = string.Empty;

            for (int count = 0; count < tbllimitGet.Rows.Count; count++)
            {
                limits = new Limit();
                limits.LimitLetter = tbllimitGet.Rows[count]["LimitLetter"].ToString();
                limits.LimitType =Convert.ToInt32(tbllimitGet.Rows[count]["LimitType"].ToString());
                limits.LimitDescription = tbllimitGet.Rows[count]["LimitDescription"].ToString();
                limits.IsStatic =Convert.ToBoolean(tbllimitGet.Rows[count]["IsStatic"].ToString());
                limits2 = LimitManager.Save(limits);

                objPolicyLimit = new PolicyLimit();
                objPolicyLimit.PolicyID = policyId;
                objPolicyLimit.LimitID = limits2.LimitID;
                objPolicyLimit.LimitAmount = Convert.ToDecimal(tblAllPolicylimitGet.Rows[count]["LimitAmount"].ToString());
                objPolicyLimit.LimitDeductible = Convert.ToDecimal(tblAllPolicylimitGet.Rows[count]["LimitDeductible"].ToString());
                objPolicyLimit.ITV = Convert.ToDecimal(tblAllPolicylimitGet.Rows[count]["ITV"].ToString());
                objPolicyLimit.Reserve = Convert.ToDecimal(tblAllPolicylimitGet.Rows[count]["Reserve"].ToString());
                objPolicyLimit.IsDeleted = Convert.ToBoolean(tblAllPolicylimitGet.Rows[count]["IsDeleted"].ToString());
                objPolicyLimit.ApplyAcrossAllCoverage = Convert.ToBoolean(tblAllPolicylimitGet.Rows[count]["ApplyAcrossAllCoverage"].ToString());
                objPolicyLimit.ApplyTo = tblAllPolicylimitGet.Rows[count]["ApplyTo"].ToString();
                PolicyLimitManager.Save(objPolicyLimit);

            }
        }
Пример #15
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 policyID)
        {
            int policyLimitID = 0;
            int limitID = 0;
            PolicyLimit limit = null;

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

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

                    if (policyLimitID == 0)
                        limit = new PolicyLimit();
                    else
                        limit = PolicyLimitManager.Get(policyLimitID);

                    limit.PolicyLimitID = policyLimitID;
                    limit.LimitID = limitID;

                    limit.PolicyID = policyID;
                    limit.LimitAmount = txtLimit.Value == null ? 0 : Convert.ToDecimal(txtLimit.Value);

                    try {
                        PolicyLimitManager.Save(limit);
                    }
                    catch (Exception ex) {
                        Core.EmailHelper.emailError(ex);
                    }
                }
            }
        }
        public static string SaveLossDetailsEditPropertyEdit(int policyID, string coverage, string type, string policyLimit, string deductible, string applyTo, string itv, string reserve, int acrossall, int limitId, string catDeductible, string coInsuranceLimit)
        {
            string json = string.Empty;
            try
            {
                Limit objLimit = null;
                PolicyLimit objPolicyLimit = null;
                decimal decAmount = 0;
                decimal decDetuctible = 0;
                decimal decCoInsuranceLimit = 0;
                decimal decItv = 0;
                decimal decReserve = 0;
                bool bacrossall = false;
                if (!string.IsNullOrEmpty(policyLimit))
                {
                    decAmount = Convert.ToDecimal(policyLimit);
                }
                if (!string.IsNullOrEmpty(deductible))
                {
                    decDetuctible = Convert.ToDecimal(deductible);
                }
                //add new fields
                if (!string.IsNullOrEmpty(coInsuranceLimit))
                {
                    decCoInsuranceLimit = Convert.ToDecimal(coInsuranceLimit);
                }

                if (!string.IsNullOrEmpty(itv))
                {
                    decItv = Convert.ToDecimal(itv);
                }
                if (!string.IsNullOrEmpty(reserve))
                {
                    decReserve = Convert.ToDecimal(reserve);
                }
                if (acrossall == 1)
                {
                    bacrossall = true;
                }
                else
                {
                    bacrossall = false;
                }

                /////
                int limitType = 0;

                if (type == "Contacts" || type == "Personal Liability" || type == "Medical Payments")
                {
                    limitType = 2;
                }
                else
                {
                    limitType = 1;
                }

                using (TransactionScope scope = new TransactionScope())
                {
                    objLimit = new Limit();
                    objLimit.LimitID = limitId;
                    objLimit.LimitLetter = coverage;
                    objLimit.LimitType = limitType;
                    objLimit.LimitDescription = type;
                    LimitManager.UpdateLimit(objLimit);

                    objPolicyLimit = new PolicyLimit();
                    objPolicyLimit.PolicyID = policyID;
                    objPolicyLimit.LimitID = limitId;
                    objPolicyLimit.LimitAmount = decAmount;
                    objPolicyLimit.LimitDeductible = decDetuctible;
                    objPolicyLimit.CATDeductible = catDeductible;
                    objPolicyLimit.ConInsuranceLimit = decCoInsuranceLimit;
                    objPolicyLimit.ITV = decItv;
                    objPolicyLimit.Reserve = decReserve;
                    objPolicyLimit.ApplyAcrossAllCoverage = bacrossall;
                    objPolicyLimit.ApplyTo = applyTo;
                    PolicyLimitManager.UpdatePolicyLimit(objPolicyLimit);
                    scope.Complete();
                }
                json = "Loss details successfully add";
            }
            catch (Exception ex)
            {
                Core.EmailHelper.emailError(ex);
            }

            return json;
        }
Пример #18
0
        public void saveLimits(int policyID)
        {
            int policyLimitID = 0;
            int limitID       = 0;
            //int claimLimitID = 0;
            int myClaimID      = 0;
            int myClaimLimitID = 0;
            int myLimitId      = 0;                 //anything prefaced with "my" is new; OC

            myClaimID = SessionHelper.getClaimID(); //Convert.ToInt32(Session["ClaimID"]);
            PolicyLimit limit         = null;
            PolicyLimit myPolicyLimit = null;
            Limit       myLimit       = null;
            // ClaimLimit myClaimLimit = null;
            //added new; OC 9/11/2014: put in place to add new row to the policy limits grid. took the old 3 column one out.
            //crete the footer controls available for use here :OC 9/12/14
            WebTextEditor    txtMyCoverage         = (WebTextEditor)gvLimits.FooterRow.FindControl("txtMyCoverage");
            WebTextEditor    txtMyDescription      = (WebTextEditor)gvLimits.FooterRow.FindControl("txtMyDescription");
            WebNumericEditor txtMyLimit            = (WebNumericEditor)gvLimits.FooterRow.FindControl("txtMyLimit");
            WebNumericEditor txtMyDeductible       = (WebNumericEditor)gvLimits.FooterRow.FindControl("txtMyDeductible");
            WebTextEditor    txtMyCATDeductible    = (WebTextEditor)gvLimits.FooterRow.FindControl("txtMyCATDeductible");
            WebDropDown      ddlMySettlementType   = (WebDropDown)gvLimits.FooterRow.FindControl("ddlMySettlementType");
            WebPercentEditor txtMyCoInsuranceLimit = (WebPercentEditor)gvLimits.FooterRow.FindControl("txtMyCoInsuranceLimit");
            WebPercentEditor txtMyITV           = (WebPercentEditor)gvLimits.FooterRow.FindControl("txtMyITV");
            WebNumericEditor txtMyReserve       = (WebNumericEditor)gvLimits.FooterRow.FindControl("txtMyReserve");
            WebTextEditor    txtMyWHDeductible  = (WebTextEditor)gvLimits.FooterRow.FindControl("txtMyWHDeductible");
            WebNumericEditor txtMyLossAmountACV = (WebNumericEditor)gvLimits.FooterRow.FindControl("txtMyLossAmountACV");
            WebNumericEditor txtMyLossAmountRCV = (WebNumericEditor)gvLimits.FooterRow.FindControl("txtMyLossAmountRCV");
            WebNumericEditor txtMyOverage       = (WebNumericEditor)gvLimits.FooterRow.FindControl("txtMyOverage");

            if (txtMyCoverage.Text != "")//TODO: change this condition to something more stable (checkbox or something)
            {
                //LIMIT TABLE STUFF
                myLimit                  = new Limit();
                myLimit.LimitLetter      = txtMyCoverage.Text;
                myLimit.LimitType        = 1;//need to change to user input and create text boxes
                myLimit.LimitDescription = txtMyDescription.Text;
                myLimit.IsStatic         = false;
                try
                {
                    LimitManager.Save(myLimit);
                }
                catch (Exception ex)
                {
                    Core.EmailHelper.emailError(ex);
                }

                var a = LimitManager.GetLatest(); //need to get the lastly created limit id from the insert we just did above
                myLimitId = Convert.ToInt32(a.LimitID);

                //CLAIM LIMIT STUFF
                //myClaimLimit = new ClaimLimit();
                //myClaimLimit.LimitID = myLimitId;
                //myClaimLimit.ClaimID = myClaimID;
                //myClaimLimit.PolicyID = policyID;
                //myClaimLimit.LossAmountACV = txtMyLossAmountACV.Value == null ? 0 : Convert.ToDecimal(txtMyLossAmountACV.Text);
                //myClaimLimit.LossAmountRCV = txtMyLossAmountRCV.Value == null ? 0 : Convert.ToDecimal(txtMyLossAmountRCV.Text);
                //myClaimLimit.OverageAmount = txtMyOverage.Value == null ? 0 : Convert.ToDecimal(txtMyOverage.Text);
                //try
                //{
                //    ClaimLimitManager.Save(myClaimLimit);
                //}
                //catch (Exception ex)
                //{

                //}
                //var b = ClaimLimitManager.GetLatest();
                //myClaimLimitID = Convert.ToInt32(b.ClaimLimitID);

                //POLICY LIMIT STUFF
                myPolicyLimit                 = new PolicyLimit();
                myPolicyLimit.PolicyID        = policyID;
                myPolicyLimit.LimitID         = myLimitId;
                myPolicyLimit.ClaimLimitID    = myClaimLimitID;
                myPolicyLimit.LimitAmount     = txtMyLimit.Value == null ? 0 : Convert.ToDecimal(txtMyLimit.Text); //= Convert.ToDecimal(txtMyLimit.Text);
                myPolicyLimit.LimitDeductible = txtMyDeductible.Value == null ? 0 : Convert.ToDecimal(txtMyDeductible.Text);
                myPolicyLimit.CATDeductible   = txtMyCATDeductible.Text;
                if (ddlMySettlementType.SelectedItemIndex > 0)
                {
                    myPolicyLimit.ApplyTo = ddlMySettlementType.SelectedItem.Text;
                }
                else
                {
                    myPolicyLimit.ApplyTo = null;
                }

                myPolicyLimit.ConInsuranceLimit = Convert.ToDecimal(txtMyCoInsuranceLimit.Value);
                myPolicyLimit.ITV                = Convert.ToDecimal(txtMyITV.Value);
                myPolicyLimit.Reserve            = Convert.ToDecimal(txtMyReserve.Value);
                myPolicyLimit.WindHailDeductible = txtMyWHDeductible.Text;
                myPolicyLimit.LossAmountACV      = txtMyLossAmountACV.Value == null ? 0 : Convert.ToDecimal(txtMyLossAmountACV.Text);
                myPolicyLimit.LossAmountRCV      = txtMyLossAmountRCV.Value == null ? 0 : Convert.ToDecimal(txtMyLossAmountRCV.Text);
                myPolicyLimit.OverageAmount      = txtMyOverage.Value == null ? 0 : Convert.ToDecimal(txtMyOverage.Text);

                try
                {
                    PolicyLimitManager.Save(myPolicyLimit);
                }
                catch (Exception ex)
                {
                }
            }

            else //run the regular stuff it was doing before
            {
                //original code
                foreach (GridViewRow row in gvLimits.Rows)
                {
                    if (row.RowType == DataControlRowType.DataRow)
                    {
                        //Label txtLimitLetter = row.FindControl("txtLimitLetter") as Label;
                        //Label txtDescription = row.FindControl("txtDescription") as Label;
                        WebNumericEditor txtLimit            = row.FindControl("txtLimit") as WebNumericEditor;
                        WebNumericEditor txtDeductible       = row.FindControl("txtDeductible") as WebNumericEditor;
                        WebTextEditor    txtWHDeductible     = row.FindControl("txtWHDeductible") as WebTextEditor;//new
                        WebTextEditor    txtCATDeductible    = row.FindControl("txtCATDeductible") as WebTextEditor;
                        WebTextEditor    txtSettlementType   = row.FindControl("txtSettlementType") as WebTextEditor;
                        WebNumericEditor txtCoInsuranceLimit = row.FindControl("txtCoInsuranceLimit") as WebNumericEditor;
                        WebDropDown      ddlSettlementType   = row.FindControl("ddlSettlementType") as WebDropDown;
                        WebPercentEditor txtITV           = row.FindControl("txtITV") as WebPercentEditor;           //new
                        WebNumericEditor txtReserve       = row.FindControl("txtReserve") as WebNumericEditor;       //new
                        WebNumericEditor txtLossAmountACV = row.FindControl("txtLossAmountACV") as WebNumericEditor; //new
                        WebNumericEditor txtLossAmountRCV = row.FindControl("txtLossAmountRCV") as WebNumericEditor; //new
                        WebNumericEditor txtOverage       = row.FindControl("txtOverage") as WebNumericEditor;       //new
                        policyLimitID = (int)gvLimits.DataKeys[row.RowIndex].Values[0];
                        limitID       = (int)gvLimits.DataKeys[row.RowIndex].Values[1];

                        //claimLimitID = (int)gvLimits.DataKeys[row.RowIndex].Values[2];
                        //claimLimitID = (int)gvLimits.DataKeys[row.RowIndex].Values[2];
                        //if ((txtLossAmountACV.Text != "" ||
                        //    txtLossAmountRCV.Text != "" ||
                        //    txtOverage.Text != "" )&&
                        //   ( txtOverage.Text != "0.00" ||
                        //    txtLossAmountRCV.Text != "0.00" ||
                        //    txtLossAmountACV.Text != "0.00"))
                        //{
                        //CLAIM LIMIT STUFF
                        //myClaimLimit = new ClaimLimit();
                        //myClaimLimit.ClaimLimitID = claimLimitID;
                        //myClaimLimit.LimitID = limitID;
                        //myClaimLimit.ClaimID = myClaimID;
                        //myClaimLimit.PolicyID = policyID;
                        //myClaimLimit.PolicyLimitID = policyLimitID;
                        //myClaimLimit.LossAmountACV = txtLossAmountACV.Value == null ? 0 : Convert.ToDecimal(txtLossAmountACV.Text);
                        //myClaimLimit.LossAmountRCV = txtLossAmountRCV.Value == null ? 0 : Convert.ToDecimal(txtLossAmountRCV.Text);
                        //myClaimLimit.OverageAmount = txtOverage.Value == null ? 0 : Convert.ToDecimal(txtOverage.Text);
                        //try
                        //{
                        //    ClaimLimitManager.Save(myClaimLimit);
                        //}
                        //catch (Exception ex)
                        //{

                        //}
                        ////    var b = ClaimLimitManager.GetLatest2(policyLimitID);
                        ////    myClaimLimitID = Convert.ToInt32(b.ClaimLimitID);
                        ////}
                        if (policyLimitID == 0)
                        {
                            limit = new PolicyLimit();
                        }
                        else
                        {
                            limit = PolicyLimitManager.Get(policyLimitID);
                        }

                        limit.PolicyLimitID = policyLimitID;
                        limit.LimitID       = limitID;
                        //limit.ClaimLimitID = claimLimitID;
                        limit.PolicyID           = policyID;
                        limit.LimitAmount        = txtLimit.Value == null ? 0 : Convert.ToDecimal(txtLimit.Value);
                        limit.LimitDeductible    = txtDeductible.Value == null ? 0 : Convert.ToDecimal(txtDeductible.Value);
                        limit.CATDeductible      = txtCATDeductible.Text;
                        limit.WindHailDeductible = txtWHDeductible.Text;
                        limit.ConInsuranceLimit  = txtCoInsuranceLimit.Value == null ? 0 : Convert.ToDecimal(txtCoInsuranceLimit.Value);
                        limit.ITV           = Convert.ToDecimal(txtITV.Value);
                        limit.Reserve       = Convert.ToDecimal(txtReserve.Value);
                        limit.LossAmountACV = txtLossAmountACV.Value == null ? 0 : Convert.ToDecimal(txtLossAmountACV.Text);
                        limit.LossAmountRCV = txtLossAmountRCV.Value == null ? 0 : Convert.ToDecimal(txtLossAmountRCV.Text);
                        limit.OverageAmount = txtOverage.Value == null ? 0 : Convert.ToDecimal(txtOverage.Text);
                        if (ddlSettlementType.SelectedItemIndex > 0)
                        {
                            //limit.SettlementType = ddlSettlementType.SelectedValue;
                            limit.ApplyTo = ddlSettlementType.SelectedValue;
                        }
                        else
                        {
                            limit.ApplyTo = null;
                        }

                        try
                        {
                            PolicyLimitManager.Save(limit);
                        }
                        catch (Exception ex)
                        {
                            Core.EmailHelper.emailError(ex);
                        }
                    }
                }
            }
            cbAddNewPolicy.Checked = false;
            disableNewRow();
        }