Exemplo n.º 1
0
        /// <summary>
        /// Checks the flag status of a flag attribute.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool CheckActive <T>(int id)
        {
            try
            {
                string query = BaseQuery.SELECT_IS_ACTIVE_FROM_WHERE <T>(id);

                return(SqlUtil.CheckDynamicQuery(query));
            }
            catch (Exception ex)
            {
                throw new Exception(CustomErrorResponse(ex));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns a flag based off query condition provided.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="expression"></param>
        /// <returns></returns>
        public bool CheckTable <T>(Expression <Func <T, bool> > expression)
        {
            try
            {
                string query = BaseQuery.SELECT_FROM_WHERE_EXISTS <T>(QueryUtil.Translate(expression));

                return(SqlUtil.CheckDynamicQuery(query));
            }
            catch (Exception ex)
            {
                throw new Exception(CustomErrorResponse(ex));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Run a stored procedure or sql query check
        /// </summary>
        /// <param name="commandType"></param>
        /// <param name="parameters"></param>
        public bool ExecuteSQLCheck(CommandType commandType, string statement, Dictionary <string, string> parameters = null)
        {
            try
            {
                switch (commandType)
                {
                case CommandType.StoredProcedure:
                    return(SqlUtil.CheckStoredProc(statement, parameters));

                case CommandType.Text:
                    return(SqlUtil.CheckDynamicQuery(statement));

                case CommandType.TableDirect:
                    throw new Exception("Command type 'TableDirect' not implemented yet.");

                default:
                    throw new Exception("Command type not recognized.");
                }
            }
            catch (Exception ex)
            {
                throw new Exception(CustomErrorResponse(ex));
            }
        }