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

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

                DataAccess.HistoryActions historyActions = new DataAccess.HistoryActions();
                historyActions.Delete(delHistoryAction);
            }
            catch (DalForeignKeyException ex_fk)
            {
                Trace.WriteError("({0})", "Delete", CLASSNAME, ex_fk, delHistoryAction);
                throw new BusinessException(string.Format("The HistoryAction is still used by {0}", ex_fk.Table), ex_fk);
            }
            catch (Exception ex)
            {
                Trace.WriteError("({0})", "Delete", CLASSNAME, ex, delHistoryAction);
                throw;
            }
        }
 /// <summary>
 /// Equals function to compare class
 /// </summary>
 public virtual bool Exists(Int64 historyActionId)
 {
     try
     {
         DataAccess.HistoryActions historyActions = new DataAccess.HistoryActions();
         return(historyActions.GetById(historyActionId) != null);
     }
     catch (Exception ex)
     {
         Trace.WriteError("{0}", "Exists", CLASSNAME, ex, historyActionId);
         throw;
     }
 }
 /// <summary>
 /// Get a HistoryAction by id from the database
 /// </summary>
 public virtual Model.HistoryAction GetById(Int64 historyActionId)
 {
     try
     {
         DataAccess.HistoryActions historyActions = new DataAccess.HistoryActions();
         Model.HistoryAction       result         = historyActions.GetById(historyActionId);
         return(result);
     }
     catch (Exception ex)
     {
         Trace.WriteError("{0}", "GetById", CLASSNAME, ex, historyActionId);
         throw;
     }
 }
        /// <summary>
        /// Get a HistoryAction by ComputerId from the database
        /// </summary>
        public virtual List <Model.HistoryAction> GetByComputerId(Int32 computerId)
        {
            try
            {
                DataAccess.HistoryActions  historyActions = new DataAccess.HistoryActions();
                List <Model.HistoryAction> result         = historyActions.GetByComputerId(computerId);

                return(result);
            }
            catch (Exception ex)
            {
                Trace.WriteError("({0})", "GetByComputerId", CLASSNAME, ex, computerId);
                throw;
            }
        }
        /// <summary>
        /// Get a HistoryAction by HistoryKey from the database
        /// </summary>
        public virtual List <Model.HistoryAction> GetByHistoryKey(String historyKey)
        {
            try
            {
                DataAccess.HistoryActions  historyActions = new DataAccess.HistoryActions();
                List <Model.HistoryAction> result         = historyActions.GetByHistoryKey(historyKey);

                return(result);
            }
            catch (Exception ex)
            {
                Trace.WriteError("({0})", "GetByHistoryKey", CLASSNAME, ex, historyKey);
                throw;
            }
        }
        /// <summary>
        /// Get all HistoryAction records from the database
        /// </summary>
        public virtual List <Model.HistoryAction> GetAll()
        {
            try
            {
                DataAccess.HistoryActions  historyActions = new DataAccess.HistoryActions();
                List <Model.HistoryAction> result         = historyActions.GetAll();

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

                DataAccess.HistoryActions historyActions = new DataAccess.HistoryActions();
                historyActions.Modify(
                    historyActionId,
                    propValues);
                return;
            }
            catch (Exception ex)
            {
                Trace.WriteError("({0})", "Modify", CLASSNAME, ex, historyActionId);
                throw;
            }
        }
        /// <summary>
        /// Add a new HistoryAction to the database
        /// </summary>
        public virtual Int64 Add(Model.HistoryAction newHistoryAction)
        {
            try
            {
                Trace.WriteInformation("({0})", "Add", CLASSNAME, newHistoryAction);

                CheckConstraints(newHistoryAction);
                DataAccess.HistoryActions historyActions = new DataAccess.HistoryActions();

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

                //Begin Checks
                CheckConstraints(modifiedHistoryAction);

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

                DataAccess.HistoryActions historyActions = new DataAccess.HistoryActions();
                historyActions.Modify(modifiedHistoryAction);
            }
            catch (Exception ex)
            {
                Trace.WriteError("({0})", "Modify", CLASSNAME, ex, modifiedHistoryAction);
                throw;
            }
        }