Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AjaxPro.Utility.RegisterTypeForAjax(typeof(Admin_index));//注册Ajax可调用的类的名称
        if (!Page.IsPostBack)
        {
            //登录验证
            Cms.Model.C_admin admin = adminUser.GetLoginState();
            Application["adminname"] = admin.user_name;
            Application["adminType"] = new Cms.BLL.C_admin_role().GetModel(Convert.ToInt32(admin.role_id)).role_name.ToString();

            // string action = this.Request.QueryString["action"] ?? "add";//编辑:edit 添加:add
            string column = this.Request.QueryString["id"] ?? "26";           //编辑:edit 添加:add
            bind_RepeaterNav();                                               //加载菜单
            this.files.InnerHtml = ListControl_Bind(Convert.ToInt32(column)); //加载栏目
            //switch (action)
            //{
            //    case "add":
            //        this.files.InnerHtml = ListControl_Bind(Convert.ToInt32(column));//加载栏目
            //        break;
            //    case "edit":
            //        this.files.InnerHtml = ListControl_Bind(Convert.ToInt32(column));//加载栏目
            //        break;
            //}
        }
    }
Exemplo n.º 2
0
    private void ShowInfo(int _id)
    {
        Cms.BLL.C_admin_role   bll   = new Cms.BLL.C_admin_role();
        Cms.Model.C_admin_role model = bll.GetModel(_id);
        txtRoleName.Text          = model.role_name;
        ddlRoleType.SelectedValue = model.role_type.ToString();
        //管理权限

        for (int i = 0; i < rptList.Items.Count; i++)
        {
            string navName = ((HiddenField)rptList.Items[i].FindControl("hidName")).Value;
            // CheckBoxList cblActionType = (CheckBoxList)rptList.Items[i].FindControl("cblActionType");
            System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox1 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox1");
            System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox2 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox2");
            System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox3 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox3");
            System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox4 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox4");
            System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox5 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox5");

            // for (int n = 0; n < cblActionType.Items.Count; n++)
            {
                Cms.BLL.C_admin_role_value bllrole_value = new Cms.BLL.C_admin_role_value();
                DataSet ds = bllrole_value.GetList("nav_name='" + navName + "' and role_id=" + _id);
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    string[] actionTypeArr = ds.Tables[0].Rows[0]["action_type"].ToString().Split(',');
                    for (int j = 0; j < actionTypeArr.Length; j++)
                    {
                        if (j == 0)
                        {
                            checkbox1.Checked = true;
                        }
                        if (j == 1)
                        {
                            checkbox2.Checked = true;
                        }
                        if (j == 2)
                        {
                            checkbox3.Checked = true;
                        }
                        if (j == 3)
                        {
                            checkbox4.Checked = true;
                        }
                        if (j == 4)
                        {
                            checkbox5.Checked = true;
                        }
                    }
                    //cblActionType.Items[n].Selected = true;
                }
            }
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// 检查管理员权限
    /// </summary>
    /// <param name="nav_name">菜单名称</param>
    /// <param name="action_type">操作类型</param>
    public void ChkAdminLevel(string nav_name, string action_type)
    {
        Cms.Model.C_admin    model = GetAdminInfo();
        Cms.BLL.C_admin_role bll   = new Cms.BLL.C_admin_role();
        bool result = bll.Exists(model.role_id);

        if (!result)
        {
            string msgbox = "parent.jsdialog(\"错误提示\", \"您没有管理该页面的权限,请勿非法进入!\", \"back\", \"Error\")";
            Response.Write("<script type=\"text/javascript\">" + msgbox + "</script>");
            Response.End();
        }
    }
Exemplo n.º 4
0
    public string getrolename(string role_type)
    {
        string result = "";

        Cms.BLL.C_admin_role blladmin_role = new Cms.BLL.C_admin_role();
        DataSet ds = blladmin_role.GetList("id=" + Convert.ToInt32(role_type));

        if (ds != null && ds.Tables[0].Rows.Count > 0)
        {
            result = ds.Tables[0].Rows[0]["role_name"].ToString();
        }
        return(result);
    }
Exemplo n.º 5
0
    public void DropList_Bind()
    {
        ddlRoleId.Items.Clear();

        Cms.BLL.C_admin_role blladmin_role = new Cms.BLL.C_admin_role();
        Cms.Model.C_Column   modelcolumn   = new Cms.Model.C_Column();
        DataSet ds = blladmin_role.GetList("");

        if (ds.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                DataRow dr = ds.Tables[0].Rows[i];
                if (Convert.ToInt32(dr["role_type"]) >= Convert.ToInt32(Application["adminType"]))
                {
                    ListItem item = new ListItem();
                    item.Text  = "" + dr["role_name"].ToString();
                    item.Value = dr["id"].ToString();
                    ddlRoleId.Items.Add(item);
                }
            }
        }
    }
Exemplo n.º 6
0
    private bool DoEdit(int _id)
    {
        bool result = false;

        Cms.BLL.C_admin_role   bll   = new Cms.BLL.C_admin_role();
        Cms.Model.C_admin_role model = bll.GetModel(_id);

        model.role_name = txtRoleName.Text.Trim();
        model.role_type = int.Parse(ddlRoleType.SelectedValue);

        //管理权限
        Cms.BLL.C_admin_role_value   bllrole_value   = new Cms.BLL.C_admin_role_value();
        Cms.Model.C_admin_role_value modelrole_value = new Cms.Model.C_admin_role_value();
        bllrole_value.DeleteList("role_id=" + _id);
        for (int i = 0; i < rptList.Items.Count; i++)
        {
            string navName = ((HiddenField)rptList.Items[i].FindControl("hidName")).Value;
            //CheckBoxList cblActionType = (CheckBoxList)rptList.Items[i].FindControl("cblActionType");
            //for (int n = 0; n < cblActionType.Items.Count; n++)
            //{
            //    if (cblActionType.Items[n].Selected == true)
            //    {
            //        modelrole_value.role_id = _id;
            //        modelrole_value.nav_name = navName;
            //        modelrole_value.action_type = cblActionType.Items[n].Value;
            //        bllrole_value.Add(modelrole_value);
            //    }
            //}
            System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox1 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox1");
            System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox2 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox2");
            System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox3 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox3");
            System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox4 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox4");
            System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox5 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox5");
            string[] actionTypeArr = ((HiddenField)rptList.Items[i].FindControl("hidActionType")).Value.Split(',');


            string str = "";
            if (checkbox1.Checked == true)
            {
                str += actionTypeArr[0] + ",";
            }
            if (checkbox2.Checked == true)
            {
                str += actionTypeArr[1] + ",";
            }
            if (checkbox3.Checked == true)
            {
                str += actionTypeArr[2] + ",";
            }
            if (checkbox4.Checked == true)
            {
                str += actionTypeArr[3] + ",";
            }
            if (checkbox5.Checked == true)
            {
                str += actionTypeArr[4] + ",";
            }
            if (str.Length > 0)
            {
                str = str.Substring(0, str.Length - 1);
                modelrole_value.role_id     = _id;
                modelrole_value.nav_name    = navName;
                modelrole_value.action_type = str;
                bllrole_value.Add(modelrole_value);
            }
        }


        if (bll.Update(model))
        {
            adminUser.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), model.role_name); //记录日志
            result = true;
        }
        return(result);
    }