private static Criteria.Criteria Expression() { int option; Criteria.Criteria c, c1; c = CriteriaMenu(); do { option = LogicalMenu(); switch (option) { case 1: c1 = CriteriaMenu(); c = new CriteriaAnd(c, c1); break; case 2: c1 = CriteriaMenu(); c = new CriteriaOr(c, c1); break; default: break; } } while (option != 0); return(c); }
/// <summary> /// Browses through the bet history with the following filters: /// 1 - Open bets /// 2 - Closed bets /// 3 - More coins than a certain amount /// 4 - Less coins than a certain amount ///</summary> /// <param name="UserEmail"></param> private static void FilterBetHistory(string UserEmail) { int option; Dictionary <int, Bet> bets = BetESS.GetBetsFrom(UserEmail); Dictionary <int, Bet> result; Criteria.Criteria c, c1; Console.WriteLine("##############\n EXPRESSION \n##############"); c = Expression(); Console.WriteLine("##############\n END OF EXPRESSION \n##############"); do { option = LogicalMenu(); switch (option) { case 1: Console.WriteLine("##############\n EXPRESSION \n##############"); c1 = Expression(); c = new CriteriaAnd(c, c1); Console.WriteLine("##############\n END OF EXPRESSION \n##############"); break; case 2: Console.WriteLine("##############\n EXPRESSION \n##############"); c1 = Expression(); c = new CriteriaOr(c, c1); Console.WriteLine("##############\n END OF EXPRESSION \n##############"); break; default: break; } } while (option != 0); Console.WriteLine("###############"); result = c.meetCriteria(bets); foreach (Bet b in result.Values) { Console.WriteLine(b.ToString()); } }