public static bool EditWorkRole(NWorkRoleModel model) { var existCode = SonFact.Cur.Top <WorkRole>(t => t.Code == model.Code && t.Id != model.Id); if (existCode != null) { throw new Exception("呵呵!权限代码重复,请修改"); } var exist = SonFact.Cur.Top <WorkRole>(t => t.Id == model.Id); exist.Name = model.Name; exist.Code = model.Code; exist.DomainId = model.DomainId; exist.ParentCode = model.ParentCode; exist.PermissionType = model.PermissionType; exist.RoleType = model.RoleType; exist.CrossPermissionType = model.CrossPermissionType; exist.IsValid = model.IsValid; exist.EditTime = DateTime.Now; exist.EditUserId = 0; exist.EditTime = DateTime.Now; exist.EditUserId = 0; var result = SonFact.Cur.Update(exist); return(result > 0); }
public Br <List <NWorkRoleModel> > SearchWorkRole(NWorkRoleModel request) { var result = per.SearchWorkRole(request); return(new Br <List <NWorkRoleModel> > { Data = result }); }
public Br <bool> EditWorkRole(NWorkRoleModel request) { var result = per.EditWorkRole(request); return(new Br <bool> { Data = result }); }
private static void SearchWorkRoleChildren(NWorkRoleModel model, int level, List <WorkRole> oldlist) { model.Level = level; var childrenlist = oldlist.Where(o => o.ParentCode == model.Code).ToList(); var newlist = new List <NWorkRoleModel>(); childrenlist.ForEach(o => newlist.Add(EntityMapper.Mapper <WorkRole, NWorkRoleModel>(o))); model.Children = newlist; level += 1; foreach (var item in newlist) { SearchWorkRoleChildren(item, level, oldlist); } }
//角色管理 public static List <NWorkRoleModel> SearchWorkRole(NWorkRoleModel request) { var list = new List <NWorkRoleModel>(); var oldlisttmp = SonFact.Cur.FindMany <WorkRole>(t => t.IsValid == true); var first = SonFact.Cur.Top <WorkRole>(t => t.Code == "super_admin"); if (first == null) { return(list); } var firstModel = EntityMapper.Mapper <WorkRole, NWorkRoleModel>(first); list.Add(firstModel); SearchWorkRoleChildren(firstModel, 0, oldlisttmp); return(list); }
public static bool AddWorkRole(NWorkRoleModel model) { var exist = SonFact.Cur.Top <WorkRole>(t => t.Code == model.Code); if (exist != null) { throw new Exception("呵呵!权限代码重复,请修改"); } var newPer = EntityMapper.Mapper <NWorkRoleModel, WorkRole>(model); newPer.AddTime = DateTime.Now; newPer.EditTime = DateTime.Now; newPer.AddUserId = 0; newPer.EditUserId = 0; var res = SonFact.Cur.Insert(newPer); return(res > 0); }
public bool EditWorkRole(NWorkRoleModel model) { return(PermissionDataCore.EditWorkRole(model)); }
public bool AddWorkRole(NWorkRoleModel model) { return(PermissionDataCore.AddWorkRole(model)); }
public List <NWorkRoleModel> SearchWorkRole(NWorkRoleModel request) { return(PermissionDataCore.SearchWorkRole(request)); }