Beispiel #1
0
 public bool DeleteRole(Role form)
 {
     UserBLL userbll = new UserBLL();
     var user = userbll.GetCurrentUser();
     form.LastUpdator = user.User.ID;
     return bll.DeleteRole(form.ID);
 }
Beispiel #2
0
        public string AddRole(AddRoleServiceForm form)
        {
            string weixinid = Common.WeiXinDepartmentID;
            if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["WeiXinDepartmentID"])) weixinid = ConfigurationManager.AppSettings["WeiXinDepartmentID"];
            Role role = new Role
            {
                DataAccessType = form.DataAccessType,
                Creator = form.Creator,
                IsDeleted = 0,
                Name = form.Name,
                ParentID = form.ParentID,
                Remark = form.Remark,
                WeiXinID = weixinid,
            };
            //新增角色
            ISqlMapper mapper = Common.GetMapperFromSession();
            RoleDao dao = new RoleDao(mapper);

            #region risk role
            string id = dao.Add(role);
            AddRoleAuth(mapper, form, id);
            #endregion
            return id;
        }
Beispiel #3
0
 /// <summary>
 /// 递归获得角色子级的角色
 /// </summary>
 /// <param name="role"></param>
 /// <param name="allroles"></param>
 /// <param name="list"></param>
 private void GetSubRole_Resc(Role role, List<Role> allroles, List<Role> list)
 {
     var subroles = allroles.FindAll(t => t.ParentID == role.ID);
     foreach (var r in subroles)
     {
         if (!list.Contains(r))
         {
             list.Add(r);
         }
         GetSubRole_Resc(r, allroles, list);
     }
 }