public bool IsLowerOrEqual(RolePriority r) { if (r.Major < 1) { return(false); } else if (Major < 1) { return(true); } else { return(Major < r.Major || Major == r.Major && Minor <= r.Minor); } }
internal static dynamic MakeJsonRole(EntityAbs <Role> rabs, RolePriority admMax) { return(new { id = rabs.DataBehind.ID, name = rabs.DataBehind.RoleName, path = Utils.GetHtmlRolePath(rabs.DataBehind.DistinctString), priority = rabs.DataBehind.RolePriority, hasParents = rabs.ParentExists, hasChilds = rabs.ChildExists, childsLoaded = rabs.IsChildsLoaded, pid = rabs.DataBehind.ParentID == null ? new Nullable <int>() : rabs.DataBehind.ParentID, op = admMax.Major >= rabs.DataBehind.RolePriority }); }