Esempio n. 1
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);
        }
Esempio n. 2
0
        public string AddRole(AddRoleServiceForm form)
        {
            Role role = new Role
            {
                DataAccessType = form.DataAccessType,
                Creator = form.Creator,
                IsDeleted = 0,
                Name = form.Name,
                ParentID = form.ParentID,
                Remark = form.Remark,
            };
            //新增角色
            ISqlMapper mapper = MapperHelper.GetMapper();
            RoleDao dao = new RoleDao(mapper);
            Menu_RoleDao mrdao = new Menu_RoleDao(mapper);

            #region risk role
            string id = dao.Add(role);
            AddRoleAuth(mapper, form, id);
            #endregion

            #region menu
            if (form.Menus != null)
            {
                foreach (var mr in form.Menus)
                {
                    mrdao.Add(new Menu_Role { RoleID = id, MenuID = mr.ID });
                }
            }
            #endregion

            return id;
        }
Esempio n. 3
0
        public void Add()
        {
            var model = new Role()
            {
                Name = "管理员"
            };

            var result = RoleDao.Add(model);

            Assert.AreNotEqual(0, result);
        }
Esempio n. 4
0
 public bool Add([FromBody] Role role)
 {
     try
     {
         return(_roleDao.Add(role));
     }
     catch (Exception ex)
     {
         nlog.Error(ex, "添加角色失败!", role.ToJSON());
         return(false);
     }
 }
Esempio n. 5
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;
        }
Esempio n. 6
0
 public bool SaveRole(Role role, ref string msg)
 {
     return(RoleDao.Add(role, ref msg));
 }