protected void GridViewTurmas_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Editar") { DAL.DALTurma Insert = new DAL.DALTurma(); int index = Convert.ToInt32(e.CommandArgument.ToString()); DataKey keys = GridViewTurmas.DataKeys[index]; string IdTurma = keys.Value.ToString(); Session["IdTurma"] = IdTurma; Response.Redirect("~/Admin/WebFormGerenciarTurma.aspx"); } if (e.CommandName == "Matriculados") { int index = Convert.ToInt32(e.CommandArgument); DataKey keyIdTurma = GridViewTurmas.DataKeys[index]; Session["IdTurma"] = keyIdTurma.Value; Response.Redirect("~/Matricula/WebFormVisualizarMatriculados.aspx"); } if (e.CommandName == "Espera") { int index = Convert.ToInt32(e.CommandArgument); DataKey keyIdTurma = GridViewTurmas.DataKeys[index]; Session["IdTurma"] = keyIdTurma.Value; Response.Redirect("~/Matricula/WebFormVisualizarListaEspera.aspx"); } }
protected void Excluir_Click(object sender, EventArgs e) { DAL.DALTurma Delete = new DAL.DALTurma(); Delete.Delete(turma.idTurma.ToString()); Session.Remove("IdTurma"); Response.Redirect("~/Admin/WebFormVisualizacaoTurma.aspx"); }
public void CarregarDadosAluno() { matricula = (Modelo.Matricula)Session["matricula"]; Modelo.Aluno aluno = new DAL.DALAluno().select(matricula.idAluno.ToString()); Modelo.Turma turma = new DAL.DALTurma().Select(matricula.idTurma.ToString()); LabelData.Text = matricula.dataMatricula.ToShortDateString(); }
protected void InserirTurma_Click(object sender, EventArgs e) { DAL.DALTurma dALTurma = new DAL.DALTurma(); Modelo.Turma turma = new Modelo.Turma(0, TxtNomeTurma.Text, int.Parse(TxtAno.Text), TxtHorário.Text, DateTime.Parse(CalendarDataInicio.Text), DateTime.Parse(CalendarDataFim.Text), int.Parse(TxtNumVagas.Text), int.Parse(DropDownListDisciplina.SelectedItem.Value)); dALTurma.Insert(turma); Response.Redirect("~/Admin/WebFormVisualizacaoTurma.aspx"); }
protected void AtualizarTurma_Click(object sender, EventArgs e) { DAL.DALTurma dALTurma = new DAL.DALTurma(); turma.nomeTurma = TxtNomeTurma.Text; turma.ano = int.Parse(TxtAno.Text); turma.horario = TxtHorário.Text; turma.dataInicio = DateTime.Parse(CalendarDataInicio.Text); turma.dataFim = DateTime.Parse(CalendarDataFim.Text); turma.qtdVagas = int.Parse(TxtNumVagas.Text); turma.idDisciplina = int.Parse(DropDownListDisciplina.SelectedItem.Value); dALTurma.Update(turma); Session.Remove("IdTurma"); Response.Redirect("~/Admin/WebFormVisualizacaoTurma.aspx"); }
protected void GridViewTurma_SelectedIndexChanged(object sender, EventArgs e) { int IndexGridViewTurma = Convert.ToInt32(GridViewTurma.SelectedRow.RowIndex); DataKey keysTurmaID = GridViewTurma.DataKeys[IndexGridViewTurma]; string IdTurma = keysTurmaID.Value.ToString(); DAL.DALTurma DalTurma = new DAL.DALTurma(); LabelTurma.Text = DalTurma.Select(IdTurma).nomeTurma; LabelDataInicio.Text = DalTurma.Select(IdTurma).dataInicio.ToShortDateString(); LabelDataFim.Text = DalTurma.Select(IdTurma).dataFim.ToShortDateString(); VerificarDisponibilidade(); PanelSelecaoTurma.Visible = false; PanelTurma.Visible = true; }
public void CarregarItemEdicao() { DAL.DALTurma dALTurma = new DAL.DALTurma(); turma = dALTurma.Select(Session["IdTurma"].ToString()); if (!IsPostBack) { TxtNomeTurma.Text = turma.nomeTurma; TxtAno.Text = turma.ano.ToString(); TxtHorário.Text = turma.horario; CalendarDataInicio.Text = turma.dataInicio.ToShortDateString(); CalendarDataFim.Text = turma.dataFim.ToShortDateString(); TxtNumVagas.Text = turma.qtdVagas.ToString(); DropDownListDisciplina.SelectedValue = turma.idDisciplina.ToString(); } }
protected void VerificarDisponibilidade() { PanelMatricular.Visible = false; PanelListaEspera.Visible = false; int IndexGridViewTurma = Convert.ToInt32(GridViewTurma.SelectedRow.RowIndex); DataKey keysTurmaID = GridViewTurma.DataKeys[IndexGridViewTurma]; string IdTurma = keysTurmaID.Value.ToString(); DAL.DALTurma DalTurma = new DAL.DALTurma(); DAL.DALMatricula dALMatricula = new DAL.DALMatricula(); if (dALMatricula.VagaDisponivel(IdTurma)) { CarregarDocumentosDisciplina(DalTurma.Select(IdTurma).idDisciplina.ToString()); LabelTurmaStatus.Visible = false; PanelMatricular.Visible = true; } else { LabelTurmaStatus.Visible = true; PanelListaEspera.Visible = true; } }