Ejemplo n.º 1
0
        public void SaveData(ModSysRole t)
        {
            BllSysRole    bll  = new BllSysRole();
            ModJsonResult json = new ModJsonResult();

            t.Status    = (int)StatusEnum.正常;
            t.CreaterId = CurrentMaster.Id;        //创建人编号
            t.RoleType  = CurrentMaster.Attribute; //角色类型
            if (string.IsNullOrEmpty(t.CompanyID))
            {
                t.CompanyID = CurrentMaster.Cid;
            }
            if (!string.IsNullOrEmpty(Request["modify"])) //修改
            {
                var model = bll.LoadData(t.Id);
                model.Name         = t.Name;
                model.Introduction = t.Introduction;
                int result = bll.Update(model);
                if (result <= 0)
                {
                    json.success = false;
                    json.msg     = "修改失败,请稍后再操作!";
                }
            }
            else
            {
                t.Id = Guid.NewGuid().ToString();
                int result = bll.Insert(t);
                if (result <= 0)
                {
                    json.success = false;
                    json.msg     = " 保存失败,请稍后再操作!";
                }
            }

            LogInsert(OperationTypeEnum.操作, "角色配置", CurrentMaster.UserName + "角色配置新增或修改操作正常.");

            WriteJsonToPage(json.ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 查看他人权限设置
        /// </summary>
        public void GetOtherfunTree()
        {
            if (CurrentMaster != null)
            {
                string       _typeId = Request["TypeID"]; _key = Request["key"];
                string       output; DataTable mytab = null;
                BllSysMaster mybase = new BllSysMaster();

                //查询角色创建人
                BllSysRole role     = new BllSysRole();
                var        roleInfo = role.LoadData(_key);
                var        other    = mybase.LoadData(roleInfo.CreaterId); //角色用户
                if (other.Attribute != (int)AdminTypeEnum.普通员工)            //超级管理员,不用控权
                {
                    _where += " and TypeID=" + _typeId + " and Status=" + (int)StatusEnum.正常;
                    mytab   = new BllSysFun().GetTreeList(_where).Tables[0]; //获取所有树
                }
                else
                {
                    string roleIdList = new BllSysMasterRole().GetMasterRole(other.Id);
                    if (!String.IsNullOrEmpty(roleIdList))
                    {
                        _where += " and TypeID=" + _typeId + "and Status=" + (int)StatusEnum.正常;
                        mytab   = mybase.GetAuthByPage(roleIdList, _where).Tables[0];
                    }
                    else
                    {
                        WriteJsonToPage(Output);
                        return;
                    }
                }
                GetTreeNode(mytab);//功能权限
            }
            Output = Output.Replace("check", "checked");
            WriteJsonToPage(Output);
        }