예제 #1
0
        protected void grdAluno_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            AlunoDTO dto = new AlunoDTO();

            if (e.CommandName == "Inativar")
            {
                int index   = int.Parse((string)e.CommandArgument);
                int IdAluno = int.Parse(grdAluno.DataKeys[index]["IdAluno"].ToString());

                dto.idAluno  = IdAluno;
                dto.situacao = "I";

                AlunoBRL brl = new AlunoBRL();
                if (brl.updateAlunoSituacaoById(dto))
                {
                    Response.Redirect("AllUser");
                }
            }
            else if (e.CommandName == "Ativar")
            {
                int index   = int.Parse((string)e.CommandArgument);
                int IdAluno = int.Parse(grdAluno.DataKeys[index]["IdAluno"].ToString());

                dto.idAluno  = IdAluno;
                dto.situacao = "A";

                AlunoBRL brl = new AlunoBRL();
                if (brl.updateAlunoSituacaoById(dto))
                {
                    Response.Redirect("AllUser");
                }
            }
            else if (e.CommandName == "Nome")
            {
                int index   = int.Parse((string)e.CommandArgument);
                int IdAluno = int.Parse(grdAluno.DataKeys[index]["IdAluno"].ToString());

                //Session.Add("IdUsuarioDetalhe", IdAluno.ToString());
                Response.Redirect("DetailUser?id=" + IdAluno.ToString());
            }
        }