public bool CanVoteRecall(Account targetAccount, RoleType roleType) { if (roleType.IsVoteable && targetAccount.FactionID == FactionID && (!roleType.IsClanOnly || targetAccount.ClanID == ClanID)) return true; else return false; }
public static MvcHtmlString PrintClanRoleHolders(this HtmlHelper helper, RoleType rt, Clan c) { List<MvcHtmlString> holders = new List<MvcHtmlString>(); foreach (AccountRole acc in rt.AccountRoles.Where(x => x.Account.ClanID == c.ClanID)) { holders.Add(PrintAccount(helper, acc.Account)); } return new MvcHtmlString(String.Join(", ", holders)); }
public bool CanRecall(Account targetAccount, RoleType roleType) { if (targetAccount.AccountID != AccountID && targetAccount.FactionID == FactionID && (!roleType.IsClanOnly || targetAccount.ClanID == ClanID)) { return AccountRolesByAccountID.Any( x => x.RoleType.RoleTypeHierarchiesByMasterRoleTypeID.Any(y => y.CanRecall && y.SlaveRoleTypeID == roleType.RoleTypeID)); } else return false; }
public static MvcHtmlString PrintRoleType(this HtmlHelper helper, RoleType rt) { var factoids = new List<string>(); if (rt.IsClanOnly) factoids.Add("clan based"); if (rt.IsOnePersonOnly) factoids.Add("only one person can hold this"); if (rt.IsVoteable) factoids.Add("is voteable"); if (rt.RoleTypeHierarchiesByMasterRoleTypeID.Any(x => x.CanAppoint)) { factoids.Add("appoints: " + string.Join(", ", rt.RoleTypeHierarchiesByMasterRoleTypeID.Where(x => x.CanAppoint) .Select(x => x.SlaveRoleType.Name))); } if (rt.RoleTypeHierarchiesByMasterRoleTypeID.Any(x => x.CanRecall)) { factoids.Add("recalls: " + string.Join(", ", rt.RoleTypeHierarchiesByMasterRoleTypeID.Where(x => x.CanRecall) .Select(x => x.SlaveRoleType.Name))); } if (rt.RightBomberQuota != 0) factoids.Add(string.Format("bomber quota {0:F0}%", rt.RightBomberQuota*100)); if (rt.RightDropshipQuota != 0) factoids.Add(string.Format("dropship quota {0:F0}%", rt.RightDropshipQuota*100)); if (rt.RightWarpQuota != 0) factoids.Add(string.Format("warp quota {0:F0}%", rt.RightWarpQuota*100)); if (rt.RightMetalQuota != 0) factoids.Add(string.Format("metal quota {0:F0}%", rt.RightMetalQuota*100)); if (rt.RightSetEnergyPriority) factoids.Add("can set energy priorities"); if (rt.RightDiplomacy) factoids.Add("can control diplomacy"); if (rt.RightEditTexts) factoids.Add("controls texts"); return new MvcHtmlString(string.Format("<span title=\"<b>{0}</b><ul>{1}</ul>\"><b>{2}</b></span>", rt.Description, string.Join("", factoids.Select(x => "<li>" + x + "</li>")), rt.Name + " ")); }