Example #1
0
        public virtual int ProximoId()
        {
            var p = new SqlParameter[]
            {
                new SqlParameter("tabela", Tabela)
            };
            var tabela = HelperDAO.ExecutaProcSelect("spProximoId", p);

            return(Convert.ToInt32(tabela.Rows[0][0]));
        }
Example #2
0
        public virtual List <T> Listagem()
        {
            var parameters = new SqlParameter[]
            {
                new SqlParameter("tabela", Tabela),
            };

            var      tabela = HelperDAO.ExecutaProcSelect("spConsulta", parameters);
            List <T> lista  = new List <T>();

            foreach (DataRow registro in tabela.Rows)
            {
                lista.Add(MontaModel(registro));
            }

            return(lista);
        }
Example #3
0
        public virtual bool ValidaLogin(UserViewModel model, string usuario, string senha)
        {
            var p = new SqlParameter[]
            {
                new SqlParameter("name", model.Name         = usuario),
                new SqlParameter("password", model.Password = senha)
            };
            var tabela = HelperDAO.ExecutaProcSelect("splogin", p);

            if (tabela.Rows.Count != 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
        public virtual T Consulta(int id)
        {
            var p = new SqlParameter[]
            {
                new SqlParameter("id", id),
                new SqlParameter("tabela", Tabela)
            };
            var tabela = HelperDAO.ExecutaProcSelect("spConsultaUnico", p);

            if (tabela.Rows.Count == 0)
            {
                return(null);
            }
            else
            {
                return(MontaModel(tabela.Rows[0]));
            }
        }