public List <CategoriaNivelUm> RetornoCategoriaNivelUm(long Id_T024) { List <CategoriaNivelUm> RetornoList = new List <CategoriaNivelUm>(); try { SqlConnection con = new SqlConnection(new CriptografiaDAO().Decrypt(ConfigurationManager.ConnectionStrings["EntidadesContext"].ConnectionString)); StringBuilder sSQL = new StringBuilder(); sSQL.Append("SELECT dbo.TB024_Sessao.TB024_Status, dbo.TB024_Sessao.TB024_Id, dbo.TB024_Sessao.TB024_Sessao, dbo.TB021_CategoriaNivel1.TB021_id, "); sSQL.Append("dbo.TB021_CategoriaNivel1.TB021_Descricao "); sSQL.Append("FROM dbo.TB024_Sessao INNER JOIN "); sSQL.Append(" dbo.TB021_TB024 ON dbo.TB024_Sessao.TB024_Id = dbo.TB021_TB024.TB024_Id INNER JOIN "); sSQL.Append(" dbo.TB021_CategoriaNivel1 ON dbo.TB021_TB024.TB021_id = dbo.TB021_CategoriaNivel1.TB021_id "); sSQL.Append("WHERE dbo.TB024_Sessao.TB024_Id = "); sSQL.Append(Id_T024); sSQL.Append("AND dbo.TB024_Sessao.TB024_Status = 1 "); sSQL.Append("ORDER BY dbo.TB021_CategoriaNivel1.TB021_Descricao "); SqlCommand command = new SqlCommand(sSQL.ToString(), con); con.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { CategoriaNivelUm obj = new CategoriaNivelUm(); obj.Id = Convert.ToInt64(reader["TB021_id"]); obj.Descricao = Convert.ToString(reader["TB021_Descricao"]).TrimEnd(); RetornoList.Add(obj); } con.Close(); } catch (Exception ex) { throw ex; } return(RetornoList); }
public List <CategoriaNivelUm> ParceiroAreasNivel1(long Id_T020) { List <CategoriaNivelUm> Retorno_L = new List <CategoriaNivelUm>(); try { SqlConnection con = new SqlConnection(new CriptografiaDAO().Decrypt(ConfigurationManager.ConnectionStrings["EntidadesContext"].ConnectionString)); StringBuilder sSQL = new StringBuilder(); sSQL.Append(" SELECT dbo.TB020_Unidades.TB020_id, dbo.TB021_CategoriaNivel1.TB021_id, dbo.TB021_CategoriaNivel1.TB021_Descricao "); sSQL.Append(" FROM dbo.TB021_TB012 INNER JOIN "); sSQL.Append(" dbo.TB021_CategoriaNivel1 ON dbo.TB021_TB012.TB021_id = dbo.TB021_CategoriaNivel1.TB021_id INNER JOIN "); sSQL.Append(" dbo.TB020_Unidades ON dbo.TB021_TB012.TB012_id = dbo.TB020_Unidades.TB012_id "); sSQL.Append(" GROUP BY dbo.TB020_Unidades.TB020_id, dbo.TB021_CategoriaNivel1.TB021_id, dbo.TB021_CategoriaNivel1.TB021_Descricao "); sSQL.Append(" HAVING dbo.TB020_Unidades.TB020_id = "); sSQL.Append(Id_T020); SqlCommand command = new SqlCommand(sSQL.ToString(), con); con.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { CategoriaNivelUm obj = new CategoriaNivelUm(); obj.Id = Convert.ToInt64(reader["TB021_id"]); obj.Descricao = reader["TB021_Descricao"].ToString().TrimEnd().Trim(); Retorno_L.Add(obj); } con.Close(); } catch (Exception ex) { throw ex; } return(Retorno_L); }