void AddPayments() { Console.WriteLine(); Console.WriteLine("ADDING PAYMENTS..."); try { CityHall c = service.FindCityHallByName("Valencia"); Gym g = c.FindGymByName("Gym1"); //Payment p = new Payment(new DateTime(2020, 9, 10, 18, 12, 5), "Free User", g.FreeUserPrice); //c.AddPayment(p); //service.AddPayment(p); //p = new Payment(new DateTime(2020, 9, 10, 18, 12, 6), "Free User", g.FreeUserPrice); //c.AddPayment(p); //service.AddPayment(p); //p = new Payment(new DateTime(2020, 9, 20, 18, 13, 5), "Free User", g.FreeUserPrice); //c.AddPayment(p); //service.AddPayment(p); //// Adding Payments //Activity a = g.FindActivityByName("Yoga 101"); //Enrollment e = a.FindEnrollment("123456789B"); //p = new Payment(new DateTime(2020, 8, 16, 12, 30, 0), "Quota", e.Activity.GetPriceForUser(g, e.User)); //c.AddPayment(p); //e.AddPayment(p); //service.AddPayment(p); //p = new Payment(new DateTime(2020, 8, 17, 13, 30, 1), "Quota", e.Activity.GetPriceForUser(g, e.User)); //c.AddPayment(p); //e.AddPayment(p); //service.AddPayment(p); //e = a.FindEnrollment("567890123K"); //p = new Payment(new DateTime(2020, 9, 29, 11, 24, 15), "Quota", e.Activity.GetPriceForUser(g, e.User)); //c.AddPayment(p); //e.AddPayment(p); //service.AddPayment(p); // Testing Payments foreach (Enrollment en in service.GetAllEnrollments()) { Console.WriteLine("\n Payments attached to " + en.User.Name); foreach (Payment moO in en.Payments) { Console.WriteLine(" " + moO.Description + " " + moO.Quantity); } } //Console.WriteLine("\n Free Swim payments"); //foreach (Payment pa in service.GetAllFreeUserPayments()) // Console.WriteLine(" " + pa.Quantity + " " + pa.Date); } catch (Exception e) { printError(e); } }