public override List<Base> Pesquisar(string descricao, string tipo) { SqlDataReader dr; if (tipo == "C") { int codigo = 0; Int32.TryParse(descricao, out codigo); dr = SqlHelper.ExecuteReader(ConfigurationManager.ConnectionStrings["conexao"].ToString(), CommandType.Text, string.Format(@"SELECT * " + " FROM CURSOS WHERE CODIGO = '{0}'", codigo)); } else { dr = SqlHelper.ExecuteReader(ConfigurationManager.ConnectionStrings["conexao"].ToString(), CommandType.Text, string.Format(@"SELECT * " + " FROM CURSOS WHERE DESCRICAO LIKE '%{0}%'", descricao)); } List<Base> ba = new List<Base>(); while (dr.Read()) { Base bas = new Base(); bas.PesId1 = int.Parse(dr["ID"].ToString()); bas.PesDescricao = dr["DESCRICAO"].ToString(); ba.Add(bas); } return ba; }
public override List<Base> Pesquisar(string descricao) { SqlDataReader dr = SqlHelper.ExecuteReader(ConfigurationManager.ConnectionStrings["conexao"].ToString(), CommandType.Text, string.Format(@"SELECT * " + " FROM TIPOSDOCUMENTOS WHERE CODIGO = '{0}' OR DESCRICAO LIKE '%{0}%'",utils.ComparaIntComZero(descricao), descricao)); List<Base> ba = new List<Base>(); while (dr.Read()) { Base bas = new Base(); bas.PesId1 = int.Parse(dr["ID"].ToString()); bas.PesCodigo = dr["CODIGO"].ToString(); bas.PesDescricao = dr["DESCRICAO"].ToString(); ba.Add(bas); } return ba; }
public List<Base> PesquisarObras(string codigos) { SqlDataReader dr = SqlHelper.ExecuteReader( ConfigurationManager.ConnectionStrings["conexao"].ToString(), CommandType.Text, string.Format(@"SELECT * FROM OBRAS WHERE CODIGO IN ({0})", codigos)); List<Base> ba = new List<Base>(); while (dr.Read()) { Base bas = new Base(); bas.PesId1 = int.Parse(dr["ID"].ToString()); bas.PesCodigo = dr["CODIGO"].ToString(); bas.PesDescricao = dr["TITULO"].ToString(); ba.Add(bas); } return ba; }
public List<Base> PesquisarPessoas(string valor) { StringBuilder consulta = new StringBuilder(); consulta.Append(string.Format(@"SELECT * FROM PESSOAS WHERE CODIGO IN ({0}) ", valor)); consulta.Append(" ORDER BY CODIGO "); SqlDataReader dr = SqlHelper.ExecuteReader(ConfigurationManager.ConnectionStrings["conexao"].ToString(), CommandType.Text, consulta.ToString()); List<Base> ba = new List<Base>(); while (dr.Read()) { Base bas = new Base(); bas.PesId1 = int.Parse(dr["ID"].ToString()); bas.PesCodigo = dr["CODIGO"].ToString(); bas.PesDescricao = dr["NOME"].ToString(); ba.Add(bas); } return ba; }