public static List<MinistryRank> CalculateMinistryRanks(MinistryParticipationRecord record, out string missingRequirements) { var rank = new KnightPremier(); var results = rank.GetHighestQualifiedRank(record, out missingRequirements); return results .OfType<MinistryRank>() .ToList(); }
public MinistryRank(int EP, int War, int Demo, int DI) { minimumRecordForRank = new MinistryParticipationRecord() { War = War, Demo = Demo, Participation = EP, DemoInitiation = DI }; }
public static MinistryParticipationRecord GetMinistryRecord(int id) { var webContent = GetWebContentForId(id); var stringContents = webContent.Split(new string[] { Environment.NewLine, "\n" }, StringSplitOptions.RemoveEmptyEntries); string relevantString = stringContents.First(str => str.Contains("<tr ALIGN=CENTER BGCOLOR=\"#6DCFF6\">")); var values = relevantString.Split(new string[] { "<td>", "</td>" }, StringSplitOptions.RemoveEmptyEntries); int sillyInt = 0; var valArray = values .Where(val => int.TryParse(val, out sillyInt)) .Select(val => int.Parse(val)) .ToArray(); MinistryParticipationRecord record = new MinistryParticipationRecord() { Participation = valArray[0], War = valArray[1], Demo = valArray[2], DemoInitiation = valArray[3] }; return record; }