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 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();
        }
        public static PolicyLimit Save(PolicyLimit limit)
        {
            if (limit.PolicyLimitID == 0) {
                DbContextHelper.DbContext.Add(limit);
            }

            DbContextHelper.DbContext.SaveChanges();

            return limit;
        }
        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) {
                    }
                }
            }
        }