예제 #1
0
        public Agencia BuscaPorId(int id)
        {
            string commandText = "SELECT * FROM AGENCIA where id = @id";

            parameters = new List <SqlParameter>()
            {
                new SqlParameter("@id", id),
            };

            _daoManager.SetConnectionString();

            var ds = _daoManager.SelectRegisters(commandText, parameters);

            Agencia result = new Agencia(ds.Tables[0].Rows[0].ItemArray[1].ToString(),
                                         ds.Tables[0].Rows[0].ItemArray[2].ToString(),
                                         ds.Tables[0].Rows[0].ItemArray[3].ToString(),
                                         ds.Tables[0].Rows[0].ItemArray[4].ToString());

            return(result);
        }
        public Pessoa BuscaPorId(int id)
        {
            string commandText = "SELECT * FROM PessoaFisicaJuridica where id = @id";

            parameters = new List <SqlParameter>()
            {
                new SqlParameter("@id", id),
            };

            _daoManager.SetConnectionString();

            var ds = _daoManager.SelectRegisters(commandText, parameters);

            Pessoa result = new Pessoa(ds.Tables[0].Rows[0].ItemArray[1].ToString(),
                                       ds.Tables[0].Rows[0].ItemArray[2].ToString(),
                                       ds.Tables[0].Rows[0].ItemArray[3].ToString(),
                                       Convert.ToInt32(ds.Tables[0].Rows[0].ItemArray[4]),
                                       ds.Tables[0].Rows[0].ItemArray[5].ToString(),
                                       ds.Tables[0].Rows[0].ItemArray[6].ToString(),
                                       ds.Tables[0].Rows[0].ItemArray[7].ToString());

            return(result);
        }