protected void GridViewReportes_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Select") { int intFila = Convert.ToInt32(e.CommandArgument.ToString()); //Obtener DataKey de la fila string idCaso = GridViewReportes.DataKeys[intFila].Value.ToString(); //Dirigire a la página editar Response.Redirect("~/Hospital/InfoCaso.aspx?id=" + idCaso.Trim()); } else if (e.CommandName == "desaprobar"){ idHiddenField.Value = GridViewReportes.DataKeys[Convert.ToInt32(e.CommandArgument.ToString())].Values["id"].ToString(); Modal.Show(); } else if (e.CommandName == "aprobar") { Repositorio repo = new Repositorio(); DataSet dset = new DataSet(); dset.Tables.Add(); //agregamos una tabla al dataser dset.Tables[0].Rows.Add(); //se agrega una fila a la tabla creada dset.Tables[0].Columns.Add("id"); dset.Tables[0].Columns.Add("username"); dset.Tables[0].Columns.Add("aprobado"); dset.Tables[0].Rows[0]["id"] = GridViewReportes.DataKeys[Convert.ToInt32(e.CommandArgument.ToString())].Values["id"].ToString(); dset.Tables[0].Rows[0]["username"] = User.Identity.Name; dset.Tables[0].Rows[0]["aprobado"] = true; if (repo.AprobarDesaprobarCasoMinsa(dset)) { GridViewReportes.DataBind(); } } else if (e.CommandName == "eliminar") { Repositorio repo = new Repositorio(); int intFila = Convert.ToInt32(e.CommandArgument.ToString()); //Obtener DataKey de la fila string idCaso = GridViewReportes.DataKeys[intFila].Value.ToString(); if (repo.EliminarCaso(idCaso, User.Identity.Name)) { } GridViewReportes.DataBind(); } else if (e.CommandName == "restaurar") { Repositorio repo = new Repositorio(); int intFila = Convert.ToInt32(e.CommandArgument.ToString()); //Obtener DataKey de la fila string idCaso = GridViewReportes.DataKeys[intFila].Value.ToString(); if (repo.RestaurarCasoDespuesDeEliminado(idCaso, User.Identity.Name)) { } GridViewReportes.DataBind(); } }