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); }
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; }
public void Add() { var model = new Role() { Name = "管理员" }; var result = RoleDao.Add(model); Assert.AreNotEqual(0, result); }
public bool Add([FromBody] Role role) { try { return(_roleDao.Add(role)); } catch (Exception ex) { nlog.Error(ex, "添加角色失败!", role.ToJSON()); return(false); } }
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; }
public bool SaveRole(Role role, ref string msg) { return(RoleDao.Add(role, ref msg)); }