Ejemplo n.º 1
0
        private List<ViewEmprestimos> CarregarObjViewEmprestimos(SqlDataReader dr)
        {
            List<ViewEmprestimos> emprestimos = new List<ViewEmprestimos>();

            while (dr.Read())
            {
                ViewEmprestimos emprestim = new ViewEmprestimos();

                emprestim.Id = int.Parse(dr["ID"].ToString());
                emprestim.EmprestimoId = int.Parse(dr["EMPRESTIMOID"].ToString());
                emprestim.ExemplarId = int.Parse(dr["EXEMPLARID"].ToString());
                emprestim.PessoaId = int.Parse(dr["PESSOAID"].ToString());
                emprestim.Id = int.Parse(dr["ID"].ToString());
                emprestim.DtEmprestimo = Convert.ToDateTime(dr["DATAEMPRESTIMO"].ToString());
                if (dr["DATAPREVISTAEMPRESTIMO"].ToString() != string.Empty)
                    emprestim.DtPrevistaDevolucao = Convert.ToDateTime(dr["DATAPREVISTAEMPRESTIMO"].ToString());
                emprestim.Titulo = dr["TITULO"].ToString();
                emprestim.Nome = dr["NOME"].ToString();
                emprestim.NomeFantasia = dr["NOMEFANTASIA"].ToString();
                emprestim.Status = dr["STATUS"].ToString();
                emprestim.Tombo = 123;//utils.ComparaIntComZero(dr["TOMBO"].ToString());
                emprestim.Codigo = 1;//utils.ComparaIntComZero(dr["CODIGO"].ToString());

                emprestimos.Add(emprestim);
            }

            return emprestimos;
        }
Ejemplo n.º 2
0
        //metodos do objeto viewEmprestimos
        public ViewEmprestimos CarregarViewEmprestimo(int id)
        {
            ViewEmprestimos ve = new ViewEmprestimos();

            SqlDataReader dr = SqlHelper.ExecuteReader(
                ConfigurationManager.ConnectionStrings["conexao"].ToString(),
                CommandType.Text, string.Format(@"SELECT * FROM view_emprestimos  WHERE ID = {0}", id));

            dr.Read();

            ve.Id = id;
            ve.DtEmprestimo = Convert.ToDateTime(dr["DATAEMPRESTIMO"].ToString());
            ve.DtPrevistaDevolucao = Convert.ToDateTime(dr["DATAPREVISTAEMPRESTIMO"].ToString());
            ve.Titulo = dr["TITULO"].ToString();
            ve.Nome = dr["NOME"].ToString();
            ve.NomeFantasia = dr["NOMEFANTASIA"].ToString();
            ve.Status = dr["STATUS"].ToString();
            ve.ExemplarId = int.Parse(dr["EXEMPLARID"].ToString());
            ve.EmprestimoId = int.Parse(dr["EMPRESTIMOID"].ToString());
            ve.PessoaId = int.Parse(dr["PESSOAID"].ToString());

            return ve;
        }