Beispiel #1
0
        public T SelectUmaLinha <T>(string nomeArquivo, string nomeBanco)
        {
            T      resultado;
            string query;

            try
            {
                query = LeitorArquivos.CarregarArquivoSQL(nomeArquivo);
                IniciarConexao(nomeBanco);
                resultado = Conexao.Query <T>(query).FirstOrDefault();
                return(resultado);
            }
            catch (SqlException)
            {
                throw new Exception("Não foi possível realizar a consulta, tente novamente mais tarde.");
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                FecharConexao();
            }
        }
Beispiel #2
0
        public int Executar <T>(string nomeArquivo, string nomeBanco, T modelo)
        {
            string query;

            try {
                query = LeitorArquivos.CarregarArquivoSQL(nomeArquivo);
                IniciarConexao(nomeBanco);
                return(Conexao.Execute(query, modelo, Transacao));
            } catch (SqlException) {
                throw new Exception("Não foi possível realizar a consulta, tente novamente mais tarde.");
            } catch (Exception e) {
                throw e;
            }
            finally
            {
                FecharConexao();
            }
        }
Beispiel #3
0
 public string ObterComandoSQL(string nomeArquivo)
 {
     return(LeitorArquivos.CarregarArquivoSQL(nomeArquivo));
 }