protected void Page_Load(object sender, EventArgs e)
    {
        oRoleAction = new DL_WEB.DAL.Master.RoleAction();
        RoleID      = Request.Params.GetValues("RoleID") != null?Convert.ToInt32(Request.Params.GetValues("RoleID")[0]) : 0;

        if (RoleID != 0)
        {
            RadTree1.DataFieldID       = "ActionID";
            RadTree1.DataFieldParentID = "ParentID";
            RadTree1.DataSource        = oRoleAction.LoadRoleActionsByRoleID(RoleID);
            RadTree1.DataBind();
        }
        else
        {
            Response.Redirect("Roles.aspx");
        }
    }
    protected void RadTree1_NodeCheck(object o, RadTreeNodeEventArgs e)
    {
        oRoleAction = new DL_WEB.DAL.Master.RoleAction();
        RadTreeNode node     = e.NodeChecked;
        Int32       ActionID = Convert.ToInt32(node.ID.Substring(9));

        if (!node.Checked)
        {
            oRoleAction.AddNew();
            oRoleAction.ActionID = ActionID;
            oRoleAction.RoleID   = RoleID;
            node.Checked         = true;
        }
        else
        {
            oRoleAction.LoadByPrimaryKey(RoleID, ActionID);
            oRoleAction.MarkAsDeleted();
            node.Checked = false;
        }
        oRoleAction.Save();
    }
示例#3
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        if (Context.User.Identity.IsAuthenticated)
        {
            if (null == Session["Organization"])
            {
                if (!(Request.FilePath.Contains("ActiveOrganization.aspx") || Request.FilePath.Contains("Logoff.aspx")))
                {
                    Response.Redirect("./ActiveOrganization.aspx?redirecturl=" + HttpUtility.UrlEncode(Request.FilePath));
                }
                else
                {
                    MyGeneration.dOOdads.BusinessEntity.ClearConnectionString();
                }
            }
            else
            {
                DL_WEB.DAL.Master.Organization org = Session["Organization"] as DL_WEB.DAL.Master.Organization;

                ProfileTopLink.Visible   = ProfileBottomLink.Visible = true;
                lblOrganizationName.Text = ": " + org.Name;

                if (Session["RoleActions"] == null)
                {
                    DL_WEB.DAL.Master.UserRole oUserRole = new DL_WEB.DAL.Master.UserRole();
                    oUserRole.Where.UserID.Operator         = WhereParameter.Operand.Equal;
                    oUserRole.Where.UserID.Value            = DL_WEB.DAL.Master.User.GetUserID(Context.User.Identity.Name);
                    oUserRole.Where.OrganizationID.Operator = WhereParameter.Operand.Equal;
                    oUserRole.Where.OrganizationID.Value    = org.OrganizationID;
                    oUserRole.Query.Load();
                    DL_WEB.DAL.Master.RoleAction oRoleAction = new DL_WEB.DAL.Master.RoleAction();
                    DataTable dtRoleActions = oRoleAction.LoadRoleActionsByRoleID(oUserRole.RoleID);
                    Session.Add("RoleActions", dtRoleActions);
                }
            }
        }
    }