Exemple #1
0
    /// <summary>
    /// 初始该角色的小类菜单
    /// </summary>
    private void DataBind_Role()
    {
        if (Request.QueryString["Id"] == null || !Tools.Validator.IsPositiveInt(Request.QueryString["Id"].ToString()))
        {
            return;
        }
        model = role.GetModel(Tools.StringHelp.GetInt(Request.QueryString["Id"]));
        if (model == null)
        {
            return;
        }

        this.txt_RoleName.Text = model.roleName.ToString();
        if (!string.IsNullOrEmpty(model.pageId))
        {
            //初始化CheckBoxList选中项
            foreach (RepeaterItem DataItem in rpt_RoleList.Items)
            {
                foreach (ListItem item in ((CheckBoxList)DataItem.FindControl("cbList")).Items)
                {
                    if (("," + model.pageId.ToString() + ",").IndexOf("," + item.Value + ",") != -1)
                    {
                        item.Selected = true;
                    }
                }
            }
        }
    }
Exemple #2
0
    /// <summary>
    /// 保存选中的小类Id
    /// </summary>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        DataSet tempds = common.GetList("select roleName from tb_sys_role where roleName='" + txt_RoleName.Text + "' ");
        if (!Tools.Validator.CheckDataSet(tempds, 0))
        {
            Test_BUL.sys_role role = new Test_BUL.sys_role();
            Test_Model.sys_role model = new Test_Model.sys_role();
            model.roleName = txt_RoleName.Text;
            model.pageId = getCheckBoxListValue();
            model.addTime = DateTime.Now;
            model.addUser = adminGetCount;

            if (role.Add(model) > 0)
                lblMsg.InnerHtml = "<script type='text/javascript'>alert('添加成功!');window.location='Manage_Role.aspx'</script>";
        }
        else
            lblMsg.InnerHtml = "<script type='text/javascript'>alert('该角色名称已经存在!');</script>";
    }
Exemple #3
0
    /// <summary>
    /// 保存选中的小类Id
    /// </summary>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        DataSet tempds = common.GetList("select roleName from tb_sys_role where roleName='" + txt_RoleName.Text + "' ");

        if (!Tools.Validator.CheckDataSet(tempds, 0))
        {
            Test_BUL.sys_role   role  = new Test_BUL.sys_role();
            Test_Model.sys_role model = new Test_Model.sys_role();
            model.roleName = txt_RoleName.Text;
            model.pageId   = getCheckBoxListValue();
            model.addTime  = DateTime.Now;
            model.addUser  = adminGetCount;

            if (role.Add(model) > 0)
            {
                lblMsg.InnerHtml = "<script type='text/javascript'>alert('添加成功!');window.location='Manage_Role.aspx'</script>";
            }
        }
        else
        {
            lblMsg.InnerHtml = "<script type='text/javascript'>alert('该角色名称已经存在!');</script>";
        }
    }
Exemple #4
0
    /// <summary>
    /// 初始该角色的小类菜单
    /// </summary>
    private void DataBind_Role()
    {
        if (Request.QueryString["Id"] == null || !Tools.Validator.IsPositiveInt(Request.QueryString["Id"].ToString()))
            return;
        model = role.GetModel(Tools.StringHelp.GetInt(Request.QueryString["Id"]));
        if (model == null)
            return;

        this.txt_RoleName.Text = model.roleName.ToString();
        if (!string.IsNullOrEmpty(model.pageId))
        {
            //初始化CheckBoxList选中项
            foreach (RepeaterItem DataItem in rpt_RoleList.Items)
            {
                foreach (ListItem item in ((CheckBoxList)DataItem.FindControl("cbList")).Items)
                {
                    if (("," + model.pageId.ToString() + ",").IndexOf("," + item.Value + ",") != -1)
                        item.Selected = true;
                }
            }
        }
    }