protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int idPlan = (int)GridView1.DataKeys[e.RowIndex].Value; Academia.Negocio.Planes oPlanes = new Academia.Negocio.Planes(); bool error = false; try { oPlanes.Borrar(idPlan); } catch { error = true; } if (error) { Page.Response.Redirect("abm_planes.aspx?exito=0"); } else { Page.Response.Redirect("abm_planes.aspx?exito=1"); } }
protected void Page_Load(object sender, EventArgs e) { try { if ((Academia.Entidades.Usuario.RolUsuario)Session["rol"] != Academia.Entidades.Usuario.RolUsuario.Administrador) { Page.Response.Redirect("MenuAlumno.aspx"); } } catch { Page.Response.Redirect("Login.aspx"); } if (!Page.IsPostBack) { if (Request.QueryString["idPlan"] == null) { this.tipoOp.Value = "alta"; this.lblTitulo.Text = "Agregar Plan"; this.btnGuardar.Text = "Agregar"; } else { Academia.Entidades.Plan plan = new Academia.Negocio.Planes().RecuperarUno(int.Parse(Request.QueryString["idPlan"]))[0]; this.txtAnio.Text = plan.Anio.ToString(); this.ddlEspecialidad.SelectedValue = plan.especialidad.IdEspecialidad.ToString(); this.tipoOp.Value = "modificacion"; this.lblTitulo.Text = "Modificar Plan"; this.btnGuardar.Text = "Modificar"; } } }