protected void acceptButton_Click(object sender, EventArgs e) { try { if (this.IsValid) { AdministradordeSistema admin = new AdministradordeSistema(); int count = 0; foreach (ListItem it in permisos_CBList.Items) { if (it.Selected == true) { admin.eliminarPermiso(it.Text); count++; } } if (count > 1) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Permisos Eliminados')", true); } else { Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Permiso Eliminado')", true); } setCheckBoxes(); } } catch (Exception ex) { Session["Error_Msg"] = ex.Message; Response.Redirect("~/Error.aspx", true); } }
protected void acceptButton_Click(object sender, EventArgs e) { try { if (this.IsValid) { AdministradordeSistema admin = new AdministradordeSistema(); int count = 0; foreach (ListItem it in permisos_CBList.Items) { if (it.Selected == true) { admin.eliminarPermiso(it.Text); count++; } } if (count > 1) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Permisos Eliminados')", true); } else { Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Permiso Eliminado')", true); } setCheckBoxes(); } } catch (Exception ex) { Response.Write("<script>alert(" + ex.ToString() + " --Eliminar Permisos.aspx.cs / acceptButton_Click()" + ")</script>"); } }
public void eliminarPermisoTest() { AdministradordeSistema target = new AdministradordeSistema(); // TODO: Initialize to an appropriate value string identity = "Test"; // TODO: Initialize to an appropriate value bool flag = true; try { target.eliminarPermiso(identity); } catch (Exception) { flag = false; } Assert.IsTrue(flag); }