Esempio n. 1
0
    protected void checkRoleExists(object source, ServerValidateEventArgs args)
    {
        string code = ((TextBox)(this.FV_Role.FindControl("tbCode"))).Text;
        Role   user = TheRoleMgr.LoadRole(code);

        if (user != null)
        {
            args.IsValid = false;
        }
    }
Esempio n. 2
0
    protected void ODS_User_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
    {
        UserRole userRole = new UserRole();

        userRole.Role = TheRoleMgr.LoadRole("everyone");
        userRole.User = user;
        TheUserRoleMgr.CreateUserRole(userRole);
        if (CreateEvent != null)
        {
            CreateEvent(user.Code, e);
            ShowSuccessMessage("Security.User.AddUser.Successfully", user.Code);
        }
    }
Esempio n. 3
0
    protected void lbtnDelete_Click(object sender, EventArgs e)
    {
        string code = ((LinkButton)sender).CommandArgument;

        try
        {
            TheRoleMgr.DeleteRole(code);
            ShowSuccessMessage("Security.Role.DeleteRole.Successfully", code);
            UpdateView();
        }
        catch (Castle.Facilities.NHibernateIntegration.DataException ex)
        {
            ShowErrorMessage("Security.Role.DeleteRole.Fail", code);
        }
    }
    protected void ToInBT_Click(object sender, EventArgs e)
    {
        List <Permission> pList = new List <Permission>();

        foreach (ListItem item in this.CBL_NotInPermission.Items)
        {
            if (item.Selected)
            {
                pList.Add(ThePermissionMgr.LoadPermission(Convert.ToInt32(item.Value)));
            }
        }
        if (pList.Count > 0)
        {
            TheRolePermissionMgr.CreateRolePermissions(TheRoleMgr.LoadRole(this.lbCode.Text), pList);
        }
        this.CBL_NotInPermission.DataBind();
        this.CBL_InPermission.DataBind();
        this.cb_InPermission.Checked    = false;
        this.cb_NotInPermission.Checked = false;
        UpdateUserLastModifyDate();
    }
Esempio n. 5
0
    protected void ToInBT_Click(object sender, EventArgs e)
    {
        List <Role> rList = new List <Role>();

        foreach (ListItem item in this.CBL_NotInRole.Items)
        {
            if (item.Selected)
            {
                rList.Add(TheRoleMgr.LoadRole(item.Value));
            }
        }
        if (rList.Count > 0)
        {
            TheUserRoleMgr.CreateUserRoles(TheUserMgr.LoadUser(this.lbCode.Text), rList);
        }
        this.CBL_NotInRole.DataBind();
        this.CBL_InRole.DataBind();
        this.cb_InRole.Checked    = false;
        this.cb_NotInRole.Checked = false;
        UpdateUserLastModifyDate();
    }
Esempio n. 6
0
 protected void FV_Role_DataBound(object sender, EventArgs e)
 {
     Role role = TheRoleMgr.LoadRole(this.RoleCode);
 }