Exemple #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();
            }
        }
Exemple #2
0
        public void CargaPlanilhaEspecifica()
        {
            FileInfo fileInfo = new FileInfo(@"C:\temp\LV - Concreto.xls");

            Disciplina disciplina = null;

            using (var contextoDisciplna = DIContainer.Instance.AppContainer.Resolve <AppServiceBase <Disciplina> >())
            {
                contextoDisciplna.Start();

                disciplina = contextoDisciplna.GetByProperty("NOME", "Concreto").First();
            }

            LeitorArquivos.LerUnico(fileInfo, disciplina);
        }
Exemple #3
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();
            }
        }
Exemple #4
0
        public void Inserir()
        {
            FileInfo fileInfo = new FileInfo(@"C:\Trabalho - Ricardo\Inserir\LV - Infraestrutura");

            List <FileInfo> f = new List <FileInfo>
            {
                fileInfo
            };

            LV_DISCIPLINA lv = new LV_DISCIPLINA()
            {
                ID_DISCIPLINA = 12
            };



            LeitorArquivos.Ler(f, lv);
        }
Exemple #5
0
 public void IniciarConexao(string nomeBanco)
 {
     Conexao = new SqlConnection(LeitorArquivos.ObterStringBanco(nomeBanco));
     Conexao.Open();
 }
Exemple #6
0
 public string ObterComandoSQL(string nomeArquivo)
 {
     return(LeitorArquivos.CarregarArquivoSQL(nomeArquivo));
 }
    public void inicializar()
    {
        leitor    = GetComponent <LeitorArquivos>();
        variaveis = new Dictionary <string, string>();
        leitor.inicializar();
        //busca o primeiro quadro e coloca ele na propriedade "atual"
        quadros = leitor.quadrosCarregados;
        string jogoSalvo = PlayerPrefs.GetString("jogo_salvo");
        string bgmSalvo  = PlayerPrefs.GetString("bgm");

        if (jogoSalvo != "") // Se encontrou um jogo salvo, o atual passa a ser o jogo salvo
        {
            foreach (var quadro in quadros)
            {
                if (quadro.obterChave() == jogoSalvo)
                {
                    atual = quadro;
                    break;
                }
            }
        }
        else  // Se não encontrou um jogo salvo, o atual passa a ser aquele que tem o sinal de inicio
        {
            foreach (var quadro in quadros)
            {
                if (quadro.eOInicio())
                {
                    atual = quadro;
                    break;
                }
            }
        }

        if (bgmSalvo != "") // Se encontrou um jogo salvo, o atual passa a ser o jogo salvo
        {
            foreach (var quadro in quadros)
            {
                if (quadro.obterChave() == bgmSalvo)
                {
                    atual = quadro;
                    break;
                }
            }
        }
        else  // Se não encontrou um jogo salvo, o atual passa a ser aquele que tem o sinal de inicio
        {
            foreach (var quadro in quadros)
            {
                if (quadro.eOInicio())
                {
                    atual = quadro;
                    break;
                }
            }
        }

        /* if(bgmSalvo != ""){
         *  tocaBgm(bgmSalvo);
         * }*/

        mostraQuadroAtual();
    }