/// <summary>
        /// Delete the given ApplicationSettingsCategory from the database
        /// </summary>
        public virtual void Delete(Model.ApplicationSettingsCategory delApplicationSettingsCategory)
        {
            try
            {
                Trace.WriteInformation("({0})", "Delete", CLASSNAME, delApplicationSettingsCategory);

                //Begin Checks
                if (!Exists(delApplicationSettingsCategory))
                {
                    throw new BusinessException(string.Format("There is no ApplicationSettingsCategory with this id. ({0})", delApplicationSettingsCategory));
                }

                DataAccess.ApplicationSettingsCategories applicationSettingsCategories = new DataAccess.ApplicationSettingsCategories();
                applicationSettingsCategories.Delete(delApplicationSettingsCategory);
            }
            catch (DalForeignKeyException ex_fk)
            {
                Trace.WriteError("({0})", "Delete", CLASSNAME, ex_fk, delApplicationSettingsCategory);
                throw new BusinessException(string.Format("The ApplicationSettingsCategory is still used by {0}", ex_fk.Table), ex_fk);
            }
            catch (Exception ex)
            {
                Trace.WriteError("({0})", "Delete", CLASSNAME, ex, delApplicationSettingsCategory);
                throw;
            }
        }
 /// <summary>
 /// Equals function to compare class
 /// </summary>
 public virtual bool Exists(Int32 applicationSettingsCategoryId)
 {
     try
     {
         DataAccess.ApplicationSettingsCategories applicationSettingsCategories = new DataAccess.ApplicationSettingsCategories();
         return(applicationSettingsCategories.GetById(applicationSettingsCategoryId) != null);
     }
     catch (Exception ex)
     {
         Trace.WriteError("{0}", "Exists", CLASSNAME, ex, applicationSettingsCategoryId);
         throw;
     }
 }
 /// <summary>
 /// Get a ApplicationSettingsCategory by id from the database
 /// </summary>
 public virtual Model.ApplicationSettingsCategory GetById(Int32 applicationSettingsCategoryId)
 {
     try
     {
         DataAccess.ApplicationSettingsCategories applicationSettingsCategories = new DataAccess.ApplicationSettingsCategories();
         Model.ApplicationSettingsCategory        result = applicationSettingsCategories.GetById(applicationSettingsCategoryId);
         return(result);
     }
     catch (Exception ex)
     {
         Trace.WriteError("{0}", "GetById", CLASSNAME, ex, applicationSettingsCategoryId);
         throw;
     }
 }
        /// <summary>
        /// Get all ApplicationSettingsCategory records from the database
        /// </summary>
        public virtual List <Model.ApplicationSettingsCategory> GetAll()
        {
            try
            {
                DataAccess.ApplicationSettingsCategories applicationSettingsCategories = new DataAccess.ApplicationSettingsCategories();
                List <Model.ApplicationSettingsCategory> result = applicationSettingsCategories.GetAll();

                return(result);
            }
            catch (Exception ex)
            {
                Trace.WriteError("()", "GetAll", CLASSNAME, ex);
                throw;
            }
        }
        /// <summary>
        /// Modify only the specified properties of the ApplicationSettingsCategory
        /// specified by:
        /// </summary>
        /// <param name="applicationSettingsCategoryId">PK</param>
        /// <param name="propValues">Properties to change</param>
        public virtual void Modify(Int32 applicationSettingsCategoryId, params KeyValuePair <string, object>[] propValues)
        {
            try
            {
                Trace.WriteInformation("({0}, {1})", "Modify", CLASSNAME, applicationSettingsCategoryId, string.Join(",", propValues));

                DataAccess.ApplicationSettingsCategories applicationSettingsCategories = new DataAccess.ApplicationSettingsCategories();
                applicationSettingsCategories.Modify(
                    applicationSettingsCategoryId,
                    propValues);
                return;
            }
            catch (Exception ex)
            {
                Trace.WriteError("({0})", "Modify", CLASSNAME, ex, applicationSettingsCategoryId);
                throw;
            }
        }
        /// <summary>
        /// Add a new ApplicationSettingsCategory to the database
        /// </summary>
        public virtual void Add(Model.ApplicationSettingsCategory newApplicationSettingsCategory)
        {
            try
            {
                Trace.WriteInformation("({0})", Trace.GetMethodName(), CLASSNAME, newApplicationSettingsCategory);

                CheckConstraints(newApplicationSettingsCategory);
                DataAccess.ApplicationSettingsCategories applicationSettingsCategories = new DataAccess.ApplicationSettingsCategories();

                applicationSettingsCategories.Add(newApplicationSettingsCategory);
            }
            catch (DalForeignKeyException ex_fk)
            {
                Trace.WriteError("({0})", Trace.GetMethodName(), CLASSNAME, ex_fk, newApplicationSettingsCategory);
                throw new BusinessException(string.Format("No related object found in {0}", ex_fk.Table), ex_fk);
            }
            catch (Exception ex)
            {
                Trace.WriteError("({0})", Trace.GetMethodName(), CLASSNAME, ex, newApplicationSettingsCategory);
                throw;
            }
        }
        /// <summary>
        /// Modify the given ApplicationSettingsCategory in the database
        /// </summary>
        public virtual void Modify(Model.ApplicationSettingsCategory modifiedApplicationSettingsCategory)
        {
            try
            {
                Trace.WriteInformation("({0})", "Modify", CLASSNAME, modifiedApplicationSettingsCategory);

                //Begin Checks
                CheckConstraints(modifiedApplicationSettingsCategory);

                if (!Exists(modifiedApplicationSettingsCategory))
                {
                    throw new BusinessException(string.Format("There is no ApplicationSettingsCategory with this id. ({0})", modifiedApplicationSettingsCategory));
                }

                DataAccess.ApplicationSettingsCategories applicationSettingsCategories = new DataAccess.ApplicationSettingsCategories();
                applicationSettingsCategories.Modify(modifiedApplicationSettingsCategory);
            }
            catch (Exception ex)
            {
                Trace.WriteError("({0})", "Modify", CLASSNAME, ex, modifiedApplicationSettingsCategory);
                throw;
            }
        }