protected void Button1_Click(object sender, EventArgs e) { foreach (GridViewRow row in GridView1.Rows) { CheckBox cb = (CheckBox)row.FindControl("AprobarCheckBox"); 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("aprobado"); dset.Tables[0].Columns.Add("username"); dset.Tables[0].Rows[0]["id"] = GridView1.DataKeys[row.RowIndex].Values["id"].ToString(); if (cb.Checked) { dset.Tables[0].Rows[0]["aprobado"] = true; dset.Tables[0].Rows[0]["username"] = User.Identity.Name; repo.AprobarDesaprobarCasoMinsa(dset); } } GridView1.DataBind(); if (GridView1.Rows.Count == 0) Button1.Visible = false; else Button1.Visible = true; }
protected void aceptarButton_Click(object sender, EventArgs e) { 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"] = idHiddenField.Value; dset.Tables[0].Rows[0]["username"] = User.Identity.Name; dset.Tables[0].Rows[0]["aprobado"] = false; if (repo.AprobarDesaprobarCasoMinsa(dset)) { repo.enviarMensaje(asuntoTextBox.Text, observacionesTextBox.Text, Convert.ToInt32(idHiddenField.Value), true); GridViewReportes.DataBind(); } }
protected void aceptarButton_Click(object sender, EventArgs e) { 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"] = idHiddenField.Value; dset.Tables[0].Rows[0]["username"] = userHiddenField.Value; dset.Tables[0].Rows[0]["aprobado"] = false; if (repo.AprobarDesaprobarCasoMinsa(dset)) { repo.enviarMensaje(asuntoTextBox.Text,observacionesTextBox.Text,Convert.ToInt32(idHiddenField.Value),true); } GridView1.DataBind(); if (GridView1.Rows.Count == 0) Button1.Visible = false; else Button1.Visible = true; if (cBoxSelections.Count != 0) foreach (int id in cBoxSelections) { foreach (GridViewRow row in GridView1.Rows) { if (GridView1.DataKeys[row.RowIndex].Values["id"].ToString() == id.ToString()) ((CheckBox)row.FindControl("AprobarCheckBox")).Checked = true; } } }
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(); } }