private void preencher_dados() { rnDisciplina D = new rnDisciplina(); DataTable dt = new DataTable(); dt = D.recuperarDisciplinas(""); List <rnDisciplina> LD = new List <rnDisciplina>(); foreach (DataRow dr in dt.Rows) { rnDisciplina nd = new rnDisciplina(); nd.ID_Disciplina = Convert.ToInt32(dr["ID_Disciplina"].ToString()); nd.Codigo_Disciplina = dr["Codigo_Disciplina"].ToString(); nd.Nome_Disciplina = dr["Nome_Disciplina"].ToString(); nd.Ementa_Disciplina = dr["Ementa_Disciplina"].ToString(); nd.Semestre_Disciplina = Convert.ToInt32(dr["Semestre_Disciplina"].ToString()); nd.CargaHoraria_Disciplina = Convert.ToInt32(dr["CargaHoraria_Disciplina"].ToString()); nd.Curso.ID_Curso = Convert.ToInt32(dr["ID_Curso"].ToString()); nd.Curso.recuperarRegistro(); LD.Add(nd); } gdvDisciplinas.DataSource = LD; gdvDisciplinas.DataBind(); }
protected void btnSalvar_Click(object sender, EventArgs e) { rnDisciplina D = new rnDisciplina(); D.Codigo_Disciplina = txtCodido.Text; D.Nome_Disciplina = txtDisciplina.Text; D.Ementa_Disciplina = txtEmenta.Text; D.Semestre_Disciplina = Convert.ToInt32(txtSemestre.Text); D.CargaHoraria_Disciplina = Convert.ToInt32(txtCargaHoraria.Text); D.Curso.ID_Curso = Convert.ToInt32(ddlCurso.SelectedValue); D.Curso.recuperarRegistro(); if (Session["Disciplina"].ToString() == "0") { D.inserir(); } else { D.ID_Disciplina = Convert.ToInt32(Session["Disciplina"]); D.alterar(); } ////lblSucesso.Text = "Curso Inserido com sucesso!"; Response.Redirect("Disciplinas.aspx"); }
protected void gdvDisciplinas_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "editar") { Session["pessoa"] = e.CommandArgument; Response.Redirect("NovaDisciplina.aspx"); } if (e.CommandName == "excluir") { rnDisciplina D = new rnDisciplina(); D.ID_Disciplina = Convert.ToInt32(e.CommandArgument); D.excluir(); Response.Redirect("Disciplinas.aspx"); } }
public void preencherFormulario() { rnDisciplina D = new rnDisciplina(); //D.ID_Disciplina = Convert.ToInt32(Session["Disciplina"]); D.ID_Disciplina = Convert.ToInt32(Session["Disciplina"]); D.recuperarRegistro(); txtCodido.Text = D.Codigo_Disciplina; txtDisciplina.Text = D.Nome_Disciplina; txtEmenta.Text = D.Ementa_Disciplina; txtSemestre.Text = D.Semestre_Disciplina.ToString(); txtCargaHoraria.Text = D.CargaHoraria_Disciplina.ToString(); ddlCurso.SelectedValue = D.Curso.ID_Curso.ToString(); }
protected void btnBuscar_Click(object sender, EventArgs e) { rnDisciplina D = new rnDisciplina(); string valorBusca = txtBusca.Text; if (!String.IsNullOrEmpty(valorBusca)) { string query = "Nome_Disciplina LIKE '%" + valorBusca + "%'"; gdvDisciplinas.DataSource = null; gdvDisciplinas.DataSource = D.recuperarDisciplinas(query); gdvDisciplinas.DataBind(); } else { gdvDisciplinas.DataSource = D.recuperarDisciplinas(""); gdvDisciplinas.DataBind(); } }