Ejemplo n.º 1
0
        public JsonResult EditManager_role(int id, string txt_role_name, string txt_action_type)
        {
            Common.Json            json = new Common.Json();
            DAO.BLL.B_Manager_role b_mr = new DAO.BLL.B_Manager_role();
            var m_mr = b_mr.Get(id);
            List <SearchTemplate> st = new List <SearchTemplate>()
            {
                new SearchTemplate()
                {
                    key = "role_name", value = txt_role_name, searchType = Common.EnumBase.SearchType.Eq
                }
            };
            var res = b_mr.GetCount(st);

            if (m_mr.role_name != txt_role_name)
            {
                if (res > 0)
                {
                    json.status  = -1;
                    json.msg     = "角色名已存在!";
                    json.pitchId = "txt_role_name";
                    return(Json(json));
                }
            }
            Domain.Manager_role model = m_mr;
            model.role_name = txt_role_name;
            b_mr.Update(model);
            B_Manager_role_value b_mrv = new B_Manager_role_value();

            b_mrv.Update(txt_action_type, model.id);
            json.msg = "修改成功!";

            return(Json(json));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取管理员角色
        /// </summary>
        /// <returns></returns>
        public string[] GetRoles(string id)
        {
            B_Manager_role b_mr  = new B_Manager_role();
            var            model = Get(Convert.ToInt32(id));

            if (model == null)
            {
                return(new string[] { "" });
            }
            return(new string[] { model.manager_role.role_name });
        }
Ejemplo n.º 3
0
        public JsonResult AddManager_role(string txt_role_name, string txt_action_type)
        {
            Common.Json            json = new Common.Json();
            DAO.BLL.B_Manager_role b_mr = new DAO.BLL.B_Manager_role();
            List <SearchTemplate>  st   = new List <SearchTemplate>()
            {
                new SearchTemplate()
                {
                    key = "role_name", value = txt_role_name, searchType = Common.EnumBase.SearchType.Eq
                }
            };
            var res = b_mr.GetCount(st);

            if (res > 0)
            {
                json.status  = -1;
                json.msg     = "角色名已存在!";
                json.pitchId = "txt_role_name";
                return(Json(json));
            }
            Domain.Manager_role model = new Domain.Manager_role();
            model.role_name = txt_role_name;
            res             = b_mr.Save(model);
            if (res <= 0)
            {
                json.status = -1;
                json.msg    = "添加失败!";
                return(Json(json));
            }
            B_Manager_role_value b_mrv = new B_Manager_role_value();

            b_mrv.Update(txt_action_type, res);
            json.msg = "添加成功!";

            return(Json(json));
        }