public static bool ExecutaSQL(string sql)
        {
            bool success    = true;
            var  connection = DAOStarter.GetConexao();

            try
            {
                var cmd = connection.CreateCommand();
                cmd.CommandText = sql;
                cmd.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                success = false;
                LogErros.GravaLog(e, MethodBase.GetCurrentMethod().Name);
            }
            finally
            {
                if (connection != null && connection.State != ConnectionState.Closed)
                {
                    connection.Close();
                }
            }

            return(success);
        }
        public static DataTable GetConsultaSQL(string cSql)
        {
            IDataReader   dr         = null;
            DataTable     dt         = null;
            IDbConnection connection = null;

            try
            {
                connection = DAOStarter.GetConexao();
                var cmd = connection.CreateCommand();
                cmd.CommandText = cSql;

                dr = cmd.ExecuteReader();
                dt = new DataTable();
                dt.Load(dr);
            }
            catch (Exception e)
            {
                LogErros.GravaLog(e, MethodBase.GetCurrentMethod().Name);
            }
            finally
            {
                if (dr != null && !dr.IsClosed)
                {
                    dr.Close();
                }
                if (connection != null && connection.State != ConnectionState.Closed)
                {
                    connection.Close();
                }
            }

            return(dt);
        }
        internal static int SqlCount(string sql)
        {
            int           total      = 0;
            IDbConnection connection = null;

            try
            {
                connection = DAOStarter.GetConexao();
                var command = connection.CreateCommand();
                command.CommandText = sql;
                try
                {
                    var dr = command.ExecuteReader();

                    try
                    {
                        while (dr.Read())
                        {
                            total = Convert.ToInt32(dr["total"]);
                        }
                    }
                    catch (Exception e)
                    {
                        LogErros.GravaLog(e, "MetodosAuxiliares/SqlCount");
                    }
                    finally
                    {
                        if (!dr.IsClosed)
                        {
                            dr.Close();
                        }
                    }
                }
                catch (Exception e)
                {
                    LogErros.GravaLog(e, "MetodosAuxiliares/SqlCount");
                }
                finally
                {
                    if (connection != null && connection.State != ConnectionState.Closed)
                    {
                        connection.Close();
                    }
                }
            }
            catch (Exception e)
            {
                LogErros.GravaLog(e, "MetodosAuxiliares/SqlCount");
            }
            return(total);
        }