eliminarRol() public method

public eliminarRol ( long identity ) : void
identity long
return void
示例#1
0
    protected void acceptButton_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.IsValid)
            {
                AdministradordeSistema admin = new AdministradordeSistema();//tmp
                int count = 0;
                BL.Rol rl = new Rol();

                foreach (ListItem it in roles_CBList.Items)
                {
                    if (it.Selected)
                    {
                        long rolId = rl.getRolID((it.Text));
                        admin.eliminarRol(rolId);
                        count++;
                    }
                }

                if (count > 1)
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Roles Eliminados')", true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Rol 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();//tmp
                int count = 0;
                BL.Rol rl = new Rol();

                foreach (ListItem it in roles_CBList.Items)
                {
                    if (it.Selected)
                    {
                        long rolId = rl.getRolID((it.Text));
                        admin.eliminarRol(rolId);
                        count++;
                    }
                }

                if (count > 1)
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Roles Eliminados')", true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Rol Eliminado')", true);
                }
                setCheckBoxes();
            }
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert(" + ex.ToString() + " --Eliminar Roles.aspx.cs / acceptButton_Click()" + ")</script>");
        }
    }
 public void eliminarRolTest()
 {
     AdministradordeSistema target = new AdministradordeSistema(); // TODO: Initialize to an appropriate value
     long identity = 18; // TODO: Initialize to an appropriate value
     bool flag=true;
     try
     {
         target.eliminarRol(identity);
     }
     catch (Exception)
     {
         flag = false;
     }
     Assert.IsTrue(flag);
 }