protected void LinkButtonPropostasFeitas_Click(object sender, EventArgs e) { if (usuarioLogado == null) { Session["mensagem"] = "Para pesquisar propostas faça login primeiro"; return; } Proposta propostaBusca = new Proposta(); propostaBusca.Usuario = new Usuario(); propostaBusca.Usuario.IdUsuario = usuarioLogado.IdUsuario; Session["PropostaBusca"] = propostaBusca; LIqueryParameters par = new LIqueryParameters(); ColumnOrder col = new ColumnOrder(); col.ColumnName = "id_desejo"; col.Order = ColumnOrder.OrderType.DESC; par.OrderBy.Add(col); col = new ColumnOrder(); col.ColumnName = "data_proposta"; col.Order = ColumnOrder.OrderType.DESC; par.OrderBy.Add(col); Session["ParamsBuscaProposta"] = par; Response.Redirect("BuscaPropostas.aspx"); }
protected void DropDownListOrderBy_SelectedIndexChanged(object sender, EventArgs e) { LIqueryParameters par = new LIqueryParameters(); ColumnOrder col = new ColumnOrder(); switch (((DropDownList)sender).SelectedValue) { case "data_mais_recente": col.ColumnName = "data_proposta"; col.Order = ColumnOrder.OrderType.DESC; break; case "menor_valor": col.ColumnName = "valor_proposta"; col.Order = ColumnOrder.OrderType.ASC; break; default: par = null; break; }//switch if (par != null) par.OrderBy.Add(col); Session["ParamsBuscaProposta"] = par; Response.Redirect("BuscaPropostas.aspx"); }//DropDownListOrderBy_SelectedIndexChanged()
protected void LinkButtonMeusDesejos_Click(object sender, EventArgs e) { Usuario usuarioBusca = usuarioLogado; if (usuarioBusca == null) { lblMensagem.Text = "Usuário não logado. Faça login primeiro."; return; } Desejo desejoBusca = new Desejo(); desejoBusca.Usuario = new Usuario(); desejoBusca.Usuario.IdUsuario = usuarioBusca.IdUsuario; Session["DesejoBusca"] = desejoBusca; LIqueryParameters par = new LIqueryParameters(); ColumnOrder col = new ColumnOrder(); col.ColumnName = "data_anuncio"; col.Order = ColumnOrder.OrderType.DESC; par.OrderBy.Add(col); Session["ParamsBuscaDesejo"] = par; Response.Redirect("BuscaDesejos.aspx"); }
}//queryDepartamento() public static ArrayList queryLocalDesejo(LocalDesejo localDesejoBusca, LIqueryParameters paramsBusca) { ArrayList alReturn = null; SqlDataReader dr = null; SqlConnection conn = null; SqlCommand cmd = null; bool bWhere = false; String strSql = "SELECT * from Local"; if (localDesejoBusca.IdLocal >= 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "id_local = " + localDesejoBusca.IdLocal.ToString(); } if (localDesejoBusca.IdLocalPai >= 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "id_local_pai = " + localDesejoBusca.IdLocalPai.ToString(); } if (localDesejoBusca.NomeLocal != "") { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "NomeLocal LIKE '%" + localDesejoBusca.NomeLocal + "%'"; } try { conn = new SqlConnection(ConnString); conn.Open(); cmd = conn.CreateCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = strSql; dr = cmd.ExecuteReader(); alReturn = new ArrayList(); while (dr.Read()) { alReturn.Add(populateLocalDesejo(dr, LocalDesejo.TipoLocalDesejo.NONE)); }//while return alReturn; } catch { return new ArrayList(); } finally { if (dr != null) { dr.Close(); } if (conn != null) { conn.Close(); } } }//queryLocalDesejo()
}//queryLocalDesejo() public static ArrayList queryProposta(Proposta propostaBusca, LIqueryParameters paramsBusca) { ArrayList alReturn = null; SqlDataReader dr = null; SqlConnection conn = null; SqlCommand cmd = null; bool bWhere = false; int iTemp; String strSql = "SELECT"; String strSelect = " P.*, D.*"; foreach (String strColuna in Usuario.Colunas) { strSelect += ",UP." + strColuna + " UP_" + strColuna; } //UP.apelido UP_apelido, UP.facebook_name UP_facebook_name, UP.id_usuario UP_id_usuario"; strSelect += ", T.*,DP.*"; foreach (String strColuna in Usuario.Colunas) { strSelect += ",UD." + strColuna + " UD_" + strColuna; } //UD.apelido UD_apelido, UD.facebook_name UD_facebook_name, UD.id_usuario UD_id_usuario"; strSelect += ", LB.id_local LB_id_local, LB.id_local_pai LB_id_local_pai, LB.NomeLocal LB_NomeLocal"; strSelect += ", LE.id_local LE_id_local, LE.id_local_pai LE_id_local_pai, LE.NomeLocal LE_NomeLocal"; if (paramsBusca != null) { if (paramsBusca.Top > 0) { strSql += " TOP " + paramsBusca.Top.ToString() + strSelect; } else { strSql += strSelect; } } else { strSql += strSelect; } strSql += ", 0 numpropostas";//MUITO FEIO, EU SEI strSql += ", S.nummensagens FROM Proposta P INNER JOIN Desejo D ON P.id_desejo = D.id_desejo"; strSql += " INNER JOIN Usuario UD ON D.id_usuario = UD.id_usuario"; strSql += " INNER JOIN Local LB ON D.id_local_busca = LB.id_local"; strSql += " INNER JOIN Local LE ON D.id_local_entrega = LE.id_local"; strSql += " INNER JOIN TipoProposta T ON P.id_tipo_proposta = T.id_tipo_proposta"; strSql += " INNER JOIN Usuario UP ON P.id_usuario = UP.id_usuario"; strSql += " INNER JOIN Departamento DP ON D.id_departamento = DP.id_departamento"; strSql += " INNER JOIN ( select P2.id_proposta id_proposta, count(M.data_mensagem) nummensagens "; strSql += " FROM Proposta P2 LEFT JOIN Mensagem M ON P2.id_proposta = M.id_proposta GROUP BY P2.id_proposta) S "; strSql += " ON P.id_proposta = S.id_proposta"; if (propostaBusca.DataProposta != DateTime.MinValue) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "P.data_proposta = " + Utils.formatParameterToSqlServer(propostaBusca.DataProposta); }//if if (propostaBusca.Desejo != null) { if (propostaBusca.Desejo.IsDeleted >= 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "D.is_deleted_desejo = " + propostaBusca.Desejo.IsDeleted.ToString(); } if (propostaBusca.Desejo.IdDesejo >= 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "P.id_desejo = " + propostaBusca.Desejo.IdDesejo.ToString(); } if (propostaBusca.Desejo.Usuario != null) { if (propostaBusca.Desejo.Usuario.IdUsuario >= 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "UD.id_usuario = " + propostaBusca.Desejo.Usuario.IdUsuario.ToString(); } } }//if if (propostaBusca.IdProposta >= 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "P.id_proposta = " + propostaBusca.IdProposta.ToString(); }//if if (propostaBusca.TipoProposta != null) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "P.id_tipo_proposta = " + propostaBusca.TipoProposta.IdTipoProposta.ToString(); }//if if (propostaBusca.Usuario != null) { if (propostaBusca.Usuario.IdUsuario > 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "P.id_usuario = " + propostaBusca.Usuario.IdUsuario.ToString(); } }//if if (propostaBusca.IsDeleted >= 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "P.is_deleted_proposta = " + propostaBusca.IsDeleted.ToString(); } if (paramsBusca != null) { if (paramsBusca.OrderBy.Count != 0) { strSql += " ORDER BY "; iTemp = 0; foreach (ColumnOrder col in paramsBusca.OrderBy) { if (iTemp != 0) strSql += ","; strSql += "P." + col.ColumnName; if (col.Order == ColumnOrder.OrderType.ASC) { strSql += " ASC"; } else { strSql += " DESC"; } iTemp++; } } } try { conn = new SqlConnection(ConnString); conn.Open(); cmd = conn.CreateCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = strSql; dr = cmd.ExecuteReader(); alReturn = new ArrayList(); while (dr.Read()) { alReturn.Add(populateProposta(dr)); }//while return alReturn; } catch { return new ArrayList(); } finally { if (dr != null) { dr.Close(); } if (conn != null) { conn.Close(); } } }//queryProposta()
}//populateAvaliacao() public static ArrayList queryDesejo(Desejo desejoBusca, LIqueryParameters paramsBusca) { ArrayList alReturn = null; SqlDataReader dr = null; SqlConnection conn = null; SqlCommand cmd = null; bool bWhere = false; int iTemp; String strSql = "SELECT"; //LB: Local Busca, LE: Local Entrega String strSelect = " D.*"; //U.id_usuario UD_id_usuario, U.apelido UD_apelido, U.facebook_name UD_facebook_name"; foreach (String strColuna in Usuario.Colunas) { strSelect += ",U." + strColuna + " UD_" + strColuna; } strSelect += ", DP.*, LB.id_local LB_id_local, LB.id_local_pai LB_id_local_pai, LB.NomeLocal LB_NomeLocal"; strSelect += ", LE.id_local LE_id_local, LE.id_local_pai LE_id_local_pai, LE.NomeLocal LE_NomeLocal"; if (paramsBusca == null) { paramsBusca = new LIqueryParameters(); paramsBusca.Top = 1000; } if (paramsBusca != null) { if (paramsBusca.Top > 0) { strSql += " TOP " + paramsBusca.Top.ToString() + strSelect; } else { strSql += strSelect; } } else { strSql += strSelect; } strSql += ", S.numpropostas FROM Desejo D INNER JOIN Usuario U ON D.id_usuario = U.id_usuario"; strSql += " INNER JOIN Departamento DP ON D.id_departamento = DP.id_departamento"; strSql += " INNER JOIN Local LB ON D.id_local_busca = LB.id_local"; strSql += " INNER JOIN Local LE ON D.id_local_entrega = LE.id_local"; strSql += " INNER JOIN ("; strSql += " SELECT D2.id_desejo, count(P.id_proposta) numpropostas FROM Desejo D2 "; strSql += " LEFT JOIN Proposta P ON D2.id_desejo = P.id_desejo"; strSql += " WHERE P.is_deleted_proposta = 0"; strSql += " GROUP BY D2.id_desejo ) S ON D.id_desejo = S.id_desejo"; if (desejoBusca.IsDeleted >= 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "D.is_deleted_desejo = " + desejoBusca.IsDeleted.ToString(); } if (desejoBusca.DataAnuncio != DateTime.MinValue) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "D.data_anuncio = " + Utils.formatParameterToSqlServer(desejoBusca.DataAnuncio); }//if if (desejoBusca.DescricaoCurta != "") { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "D.descricao_curta LIKE '%" + desejoBusca.DescricaoCurta + "'%"; }//if if (desejoBusca.DescricaoLonga != "") { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "D.descricao_longa LIKE '%" + desejoBusca.DescricaoLonga + "%'"; }//if if (desejoBusca.Departamento != null) { if (desejoBusca.Departamento.Id >= 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "D.id_departamento = " + desejoBusca.Departamento.Id.ToString(); } }//if if (desejoBusca.IdDesejo >= 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "D.id_desejo = " + desejoBusca.IdDesejo.ToString(); }//if if (desejoBusca.LocalBusca != null) { if (desejoBusca.LocalBusca.IdLocal >= 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "D.id_local_busca = " + desejoBusca.LocalBusca.IdLocal.ToString(); } }//if if (desejoBusca.LocalEntrega != null) { if (desejoBusca.LocalEntrega.IdLocal >= 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "D.id_local_entrega = " + desejoBusca.LocalEntrega.IdLocal.ToString(); } }//if if (desejoBusca.Usuario != null) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "D.id_usuario = " + desejoBusca.Usuario.IdUsuario.ToString(); }//if /* if (desejoBusca.IsAtivo >= 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "D.ativo = " + ((desejoBusca.IsAtivo > 0) ? ("1") : ("0")); }//if */ if (desejoBusca.HasPropostaSelecionada >= 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } if (desejoBusca.HasPropostaSelecionada == 0) { strSql += "D.id_proposta_aceita IS NULL"; } else { strSql += "D.id_proposta_aceita IS NOT NULL"; } } if (paramsBusca != null) { if (paramsBusca.OrderBy.Count != 0) { strSql += " ORDER BY "; iTemp = 0; foreach (ColumnOrder col in paramsBusca.OrderBy) { if (iTemp != 0) strSql += ","; strSql += "D." + col.ColumnName; if (col.Order == ColumnOrder.OrderType.ASC) { strSql += " ASC"; } else { strSql += " DESC"; } iTemp++; } } } try { conn = new SqlConnection(ConnString); conn.Open(); cmd = conn.CreateCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = strSql; dr = cmd.ExecuteReader(); alReturn = new ArrayList(); while (dr.Read()) { alReturn.Add(populateDesejo(dr)); }//while return alReturn; } catch { return new ArrayList(); } finally { if (dr != null) { dr.Close(); } if (conn != null) { conn.Close(); } } }//queryDesejo()
}//queryDesejo() public static ArrayList queryDepartamento(Departamento departamentoBusca, LIqueryParameters paramsBusca) { ArrayList alReturn = null; SqlDataReader dr = null; SqlConnection conn = null; SqlCommand cmd = null; bool bWhere = false; String strSql = "SELECT * from Departamento"; if (departamentoBusca.Id >= 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "id_departamento = " + departamentoBusca.Id.ToString(); } if (departamentoBusca.IdPai >= 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "id_depto_pai = " + departamentoBusca.IdPai.ToString(); } if (departamentoBusca.Nome != "") { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "nome_departamento LIKE '%" + departamentoBusca.Nome + "%'"; } try { conn = new SqlConnection(ConnString); conn.Open(); cmd = conn.CreateCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = strSql; dr = cmd.ExecuteReader(); alReturn = new ArrayList(); while (dr.Read()) { alReturn.Add(populateDepartamento(dr)); }//while return alReturn; } catch { return new ArrayList(); } finally { if (dr != null) { dr.Close(); } if (conn != null) { conn.Close(); } } }//queryDepartamento()
}//queryMensagens() public static ArrayList queryTipoProposta(TipoProposta tipoPropostaBusca, LIqueryParameters paramsBusca) { ArrayList alReturn = null; SqlDataReader dr = null; SqlConnection conn = null; SqlCommand cmd = null; bool bWhere = false; int iTemp; String strSql = "SELECT"; String strSelect = " T.*"; if (paramsBusca != null) { if (paramsBusca.Top > 0) { strSql += " TOP " + paramsBusca.Top.ToString() + strSelect; } else { strSql += strSelect; } } else { strSql += strSelect; } strSql += " FROM TipoProposta T"; if (tipoPropostaBusca.Descricao != "") { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "T.descricao_tipo_proposta = '" + tipoPropostaBusca.Descricao + "'"; }//if if (tipoPropostaBusca.IdTipoProposta >= 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "T.id_tipo_proposta = " + tipoPropostaBusca.IdTipoProposta.ToString(); }//if if (paramsBusca != null) { if (paramsBusca.OrderBy.Count != 0) { strSql += " ORDER BY "; iTemp = 0; foreach (ColumnOrder col in paramsBusca.OrderBy) { if (iTemp != 0) strSql += ","; strSql += "T." + col.ColumnName; if (col.Order == ColumnOrder.OrderType.ASC) { strSql += " ASC"; } else { strSql += " DESC"; } iTemp++; } } } try { conn = new SqlConnection(ConnString); conn.Open(); cmd = conn.CreateCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = strSql; dr = cmd.ExecuteReader(); alReturn = new ArrayList(); while (dr.Read()) { alReturn.Add(populateTipoProposta(dr)); }//while return alReturn; } catch { return new ArrayList(); } finally { if (dr != null) { dr.Close(); } if (conn != null) { conn.Close(); } } }//queryUsuario()
}//queryUsuario() public static ArrayList queryMensagens(Proposta proposta, LIqueryParameters paramsBusca) { ArrayList alReturn = null; SqlDataReader dr = null; SqlConnection conn = null; SqlCommand cmd = null; //bool bWhere = false; //int iTemp; String strSql = "SELECT"; String strSelect = " M.*, P.*, D.*"; foreach (String strColuna in Usuario.Colunas) { strSelect += ",UP." + strColuna + " UP_" + strColuna; } //UP.apelido UP_apelido, UP.facebook_name UP_facebook_name, UP.id_usuario UP_id_usuario"; strSelect += ", T.*, DP.*"; foreach (String strColuna in Usuario.Colunas) { strSelect += ",UD." + strColuna + " UD_" + strColuna; } //UD.apelido UD_apelido, UD.facebook_name UD_facebook_name, UD.id_usuario UD_id_usuario"; strSelect += ", LB.id_local LB_id_local, LB.id_local_pai LB_id_local_pai, LB.NomeLocal LB_NomeLocal"; strSelect += ", LE.id_local LE_id_local, LE.id_local_pai LE_id_local_pai, LE.NomeLocal LE_NomeLocal"; if (paramsBusca != null) { if (paramsBusca.Top > 0) { strSql += " TOP " + paramsBusca.Top.ToString() + strSelect; } else { strSql += strSelect; } } else { strSql += strSelect; } strSql += ", 0 numpropostas";//MUITO FEIO, EU SEI strSql += ", 0 nummensagens";//MUITO FEIO TAMBEM strSql += " FROM Mensagem M INNER JOIN Proposta P ON M.id_proposta = P.id_proposta"; strSql += " INNER JOIN Desejo D ON P.id_desejo = D.id_desejo"; strSql += " INNER JOIN Usuario UD ON D.id_usuario = UD.id_usuario"; strSql += " INNER JOIN Local LB ON D.id_local_busca = LB.id_local"; strSql += " INNER JOIN Local LE ON D.id_local_entrega = LE.id_local"; strSql += " INNER JOIN TipoProposta T ON P.id_tipo_proposta = T.id_tipo_proposta"; strSql += " INNER JOIN Usuario UP ON P.id_usuario = UP.id_usuario"; strSql += " INNER JOIN Departamento DP ON D.id_departamento = DP.id_departamento"; strSql += " WHERE M.id_proposta = " + proposta.IdProposta.ToString(); if (proposta.IsDeleted >= 0) { strSql += " AND P.is_deleted_proposta = " + proposta.IsDeleted.ToString(); } if (proposta.Desejo != null) { if (proposta.Desejo.IsDeleted >= 0) { strSql += " AND D.is_deleted_desejo = " + proposta.Desejo.IsDeleted.ToString(); } } //strSql += " AND D.is_deleted = 0"; //strSql += " AND P.is_deleted = 0"; strSql += " ORDER BY M.data_mensagem ASC"; try { conn = new SqlConnection(ConnString); conn.Open(); cmd = conn.CreateCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = strSql; dr = cmd.ExecuteReader(); alReturn = new ArrayList(); while (dr.Read()) { alReturn.Add(populateMensagem(dr)); }//while return alReturn; } catch { return new ArrayList(); } finally { if (dr != null) { dr.Close(); } if (conn != null) { conn.Close(); } } }//queryMensagens()
}//resetUsuario() public static ArrayList queryUsuario(Usuario usuarioBusca, LIqueryParameters paramsBusca) { ArrayList alReturn = null; SqlDataReader dr = null; SqlConnection conn = null; SqlCommand cmd = null; bool bWhere = false; int iTemp; String strSql = "SELECT"; String strSelect = " U.*"; if (paramsBusca != null) { if (paramsBusca.Top > 0) { strSql += " TOP " + paramsBusca.Top.ToString() + strSelect; } else { strSql += strSelect; } } else { strSql += strSelect; } strSql += " FROM Usuario U"; if (usuarioBusca.IdUsuario >= 0) { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "U.id_usuario = " + usuarioBusca.IdUsuario.ToString(); }//if if (usuarioBusca.Email != "") { if (bWhere) { strSql += " AND "; } else { strSql += " WHERE "; bWhere = true; } strSql += "U.email = '" + usuarioBusca.Email + "'"; }//if if (paramsBusca != null) { if (paramsBusca.OrderBy.Count != 0) { strSql += " ORDER BY "; iTemp = 0; foreach (ColumnOrder col in paramsBusca.OrderBy) { if (iTemp != 0) strSql += ","; strSql += "U." + col.ColumnName; if (col.Order == ColumnOrder.OrderType.ASC) { strSql += " ASC"; } else { strSql += " DESC"; } iTemp++; } } } try { conn = new SqlConnection(ConnString); conn.Open(); cmd = conn.CreateCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = strSql; dr = cmd.ExecuteReader(); alReturn = new ArrayList(); while (dr.Read()) { alReturn.Add(populateUsuario(dr, "")); }//while return alReturn; } catch(Exception)// ex) { /* ArrayList alErro = new ArrayList(); Usuario userLixo = new Usuario(); userLixo.Apelido = ex.Message; alErro.Add(userLixo); return alErro; */ return new ArrayList();//se deu erro então retorna um arraylist vazio } finally { if (dr != null) { dr.Close(); } if (conn != null) { conn.Close(); } } }//queryUsuario()
protected void btnMostrarPropostas_Click(object sender, EventArgs e) { Proposta propostaBusca = new Proposta(); propostaBusca.Desejo = new Desejo(); propostaBusca.Desejo.IdDesejo = desejo.IdDesejo; Session["PropostaBusca"] = propostaBusca; LIqueryParameters paramsBusca = new LIqueryParameters(); ColumnOrder col = new ColumnOrder(); col.ColumnName = "data_proposta"; col.Order = ColumnOrder.OrderType.DESC; paramsBusca.OrderBy.Add(col); Session["ParamsBuscaProposta"] = paramsBusca; Response.Redirect("BuscaPropostas.aspx"); }
private void lb_ClickMostrarPropostas(object sender, EventArgs e) { long idDesejo; String strTemp = ((LinkButton)sender).ID; strTemp = (strTemp.Split('_'))[1]; idDesejo = System.Convert.ToInt64(strTemp); Proposta propostaBusca = new Proposta(); propostaBusca.Desejo = new Desejo(); propostaBusca.Desejo.IdDesejo = idDesejo; Session["PropostaBusca"] = propostaBusca; LIqueryParameters paramsBusca = new LIqueryParameters(); ColumnOrder col = new ColumnOrder(); col.ColumnName = "data_proposta"; col.Order = ColumnOrder.OrderType.DESC; paramsBusca.OrderBy.Add(col); Session["ParamsBuscaProposta"] = paramsBusca; Session["PaginaAlvo"] = "ShowPropostas.aspx"; Response.Redirect("BuscaPropostas.aspx"); }//lb_ClickMostrarPropostas()