⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rolemanage.ascx.cs

📁 CRM管理系统 CRM管理系统
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Itsv.BLL.SystemManage;

public partial class Ctrls_RoleManage : PageBaseUserCtrl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            //验证用户角色
            this.CheckUserState();

            //绑定数据
            this.BindGridView(this.GetRolesData(), this.gvRole, "role_id");

        }
    }
    private DataSet GetRolesData()
    {
        RolesBLL rolebll = new RolesBLL();
        DataSet ds = rolebll.GetList("", ref this.msg);
        rolebll = null;
        if (ds == null)
        {
            this.ShowMessage(this.msg);
        }
        return ds;
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Response.Redirect("rolesadd.aspx");
    }
    /// <summary>
    /// 删除处理
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        string ids = string.Empty;
        string roles = string.Empty;
        for (int i = 0; i < this.gvRole.Rows.Count; i++)
        {
            CheckBox cb = (CheckBox)this.gvRole.Rows[i].FindControl("ckb");
            if (cb.Checked)
            {
                ids += this.gvRole.DataKeys[i].Value.ToString() + "|";
                roles += gvRole.Rows[i].Cells[1].Text + "|";
            }
        }
        if (ids == string.Empty)
        {
            this.ShowMessage("尚未选择需要删除的角色");
            return;
        }
        string[] ss = ids.Split('|');
        string[] role = roles.Split('|');
        RolesBLL bll = new RolesBLL();
        for (int i = 0; i < ss.Length; i++)
        {
            if (ss[i].Trim().Length > 0)
            {
                if (!bll.Delete(int.Parse(ss[i]), ref this.msg))
                {
                    this.ShowMessage(msg);
                    return;
                }
                else
                {
                    this.WriteUserAction("删除角色:" + role[i]);
                }
            }
        }
        this.BindGridView(this.GetRolesData(), this.gvRole, "role_id");
    }
    /// <summary>
    /// 刷新处理
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnReflash_Click(object sender, EventArgs e)
    {
        this.BindGridView(this.GetRolesData(), this.gvRole, "role_id");
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -