public static List <provider_eligibility_restrictions> GetAllDataAsList()
        {
            List <provider_eligibility_restrictions> toReturn = new List <provider_eligibility_restrictions>();
            provider_eligibility_restrictions        per      = new provider_eligibility_restrictions();
            DataTable dt = per.GetAllData();

            foreach (DataRow aRow in dt.Rows)
            {
                per = new provider_eligibility_restrictions();
                per.Load(aRow);

                toReturn.Add(per);
            }

            return(toReturn);
        }
        /// <summary>
        /// Adds a restriction ID / group ID for a provider_eligibility_restriction
        /// </summary>
        /// <param name="restrictionID"></param>
        /// <param name="groupID"></param>
        /// <param name="checkExistBeforeInsert"></param>
        internal static void AddGroup(int restrictionID, int groupID, bool checkExistBeforeInsert)
        {
            provider_eligibility_restrictions per = new provider_eligibility_restrictions();

            if (checkExistBeforeInsert)
            {
                DataTable dt = per.Search(
                    string.Format("SELECT COUNT(*) FROM provider_eligibility_restriction_groups where insurance_group_id = {0} and provider_eligibility_restriction_id = {1}", groupID, restrictionID));

                if ((int)dt.Rows[0][0] > 0)
                {
                    return; // Already exists
                }
            }

            per.ExecuteNonQuery(string.Format("INSERT INTO provider_eligibility_restriction_groups (provider_eligibility_restriction_id, insurance_group_id) VALUES ({0}, {1})",
                                              restrictionID, groupID));
        }
        public static List <provider_eligibility_restrictions> GetAllDataAsList(bool enabledOnly = true)
        {
            List <provider_eligibility_restrictions> toReturn = new List <provider_eligibility_restrictions>();
            provider_eligibility_restrictions        per      = new provider_eligibility_restrictions();
            DataTable dt = per.GetAllData();

            foreach (DataRow aRow in dt.Rows)
            {
                per = new provider_eligibility_restrictions();
                per.Load(aRow);

                if (per.is_enabled || !enabledOnly)
                {
                    var initialize = per.LinkedInsuranceCompanyGroup.LinkedFilters.Count;
                    toReturn.Add(per);
                }
            }

            return(toReturn);
        }