public List<Cliente> ListarPorNome(string nome) { var strQuery = string.Format("select * from clientes where nome like '{0}%' ", nome); using (contexto = new Contexto()) { var retornoDataReader = contexto.ExecutaComandoComRetorno(strQuery); return TransformaReaderEmListaObjetos(retornoDataReader); } }
public List<Cliente> ListarPorLoginSenha(string email,string senha) { var strQuery = string.Format("select * from clientes where email = '{0}' and senha = '{1}' ", email, senha); using (contexto = new Contexto()) { var retornoDataReader = contexto.ExecutaComandoComRetorno(strQuery); return TransformaReaderEmListaObjetos(retornoDataReader); } }
public List<Produto> ListarTodos() { var strQuery = "select * from email from produto"; using (contexto = new Contexto()) { var retornoDataReader = contexto.ExecutaComandoComRetorno(strQuery); return TransformaReaderEmListaObjetos(retornoDataReader); } }
public Cliente ListarPoId(int id) { var strQuery = string.Format("select * from clientes where Id = {0}", id); using (contexto = new Contexto()) { var retornoDataReader = contexto.ExecutaComandoComRetorno(strQuery); return TransformaReaderEmListaObjetos(retornoDataReader).FirstOrDefault(); } }
public bool Excluir(int id) { var retorno = 0; var strQuery = string.Format("DELETE FROM clientes WHERE id= {0}; SELECT id FROM clientes WHERE id = {0}", id); using (contexto = new Contexto()) { var reader = contexto.ExecutaComandoComRetorno(strQuery); while (reader.Read()) { retorno = Convert.ToInt32(reader["id"]); } reader.Close(); } if (retorno == 0) return true; return false; }
public List<Cliente> ListarTodos() { var strQuery = "select id, nome, data_nascimento, email from clientes"; using (contexto = new Contexto()) { var retornoDataReader = contexto.ExecutaComandoComRetorno(strQuery); return TransformaReaderEmListaObjetos(retornoDataReader); } }