protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["user"] == null) { Response.Redirect("Login.aspx"); } if (Request.Params["id"] != null) { String id = Request.Params["id"]; getConn(); Participante par = new ParticipanteDAO().findById(Convert.ToInt32(id)); txtNome.Text = par.Nome; txtEmail.Text = par.Email; txtLinhaPesquisa.Text = par.Linhaspesquisa; txtCurriluim.Text = par.BreveCurriculum; cbTec.SelectedValue = par.Titulacao; cbTipo.SelectedValue = par.Tipo.ToString(); txtFoto.Value = par.Foto; Image1.ImageUrl = par.Foto; Seq.Value = par.Sequencial.ToString(); txtLattes.Text = par.Lattes; } } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { String Sequencial = e.Values["Sequencial"].ToString(); try { ParticipanteDAO dao = new ParticipanteDAO(); dao.delete(Convert.ToInt32(Sequencial)); refreshCima(); } catch { } }
public void refreshBaixo() { getConn(); ParticipanteDAO dao = new ParticipanteDAO(); IList <Participante> alunos = dao.findByParameters(new Participante() { Tipo = 2 }); GridView2.DataSource = alunos; GridView2.DataBind(); }
public void refreshCima() { getConn(); ParticipanteDAO dao = new ParticipanteDAO(); IList <Participante> pesquisadores = dao.findByParameters(new Participante() { Tipo = 1 }); GridView1.DataSource = pesquisadores; GridView1.DataBind(); }
protected void BtSalvar_Click(object sender, EventArgs e) { try { Page.Validate(); if (Page.IsValid) { getConn(); Participante part = new Participante(); part.Nome = txtNome.Text; part.Email = txtEmail.Text; part.BreveCurriculum = txtCurriluim.Text; part.Ativo = true; part.Foto = txtFoto.Value; part.Lattes = txtLattes.Text; part.Titulacao = cbTec.SelectedValue; part.Tipo = Convert.ToInt32(cbTipo.SelectedValue); part.Linhaspesquisa = txtLinhaPesquisa.Text; ParticipanteDAO dao = new ParticipanteDAO(); if (Seq.Value == "") { dao.create(part); } else { part.Sequencial = Convert.ToInt32(Seq.Value); dao.update(part); } Server.Transfer("~/Sucesso.aspx"); } } catch { } }