/// <summary>获取角色列表。主角色在前,其它角色升序在后</summary> /// <returns></returns> public virtual Int32[] GetRoleIDs() { var ids = RoleIDs.SplitAsInt().OrderBy(e => e).ToList(); if (RoleID > 0) { ids.Insert(0, RoleID); } return(ids.Distinct().ToArray()); }
/// <summary>插入管理员与角色表映射</summary> protected Int32 InsertAdminRole() { var result = 0; if (!String.IsNullOrEmpty(RoleIDs)) { Int32[] ss = RoleIDs.SplitAsInt(","); if (ss != null && ss.Length > 0) { EntityList <AdminRole> list = new EntityList <AdminRole>(); foreach (Int32 item in ss) { AdminRole entity = new AdminRole(); entity.AdminID = ID; entity.RoleID = item; list.Add(entity); } result += list.Insert(true); } } return(result); }