private static void RealPrint(Person person) { ServiceProject.ServiceCardClient client = new ServiceProject.ServiceCardClient(); PrintType printTypeSpec = null; while (printTypeSpec == null) { Console.WriteLine("Choose what you want to print : "); DisplayQuotas(); string printChoice = Console.ReadLine(); int printChoiceInt = Int32.Parse(printChoice); printTypeSpec = client.GetPrintTypeById(printChoiceInt); } Console.WriteLine("How much of these you want to print ?"); string numberOfCopies = Console.ReadLine(); int numberOfCopiesInt = Int32.Parse(numberOfCopies); int result = client.Print(printTypeSpec.Id, person.Id, numberOfCopiesInt); if (result == 0) { Console.WriteLine("Payment failure : You don't have enough money"); Console.WriteLine($"You have tried to print {numberOfCopiesInt} {printTypeSpec.Description} {printTypeSpec.Color} {printTypeSpec.RectoVerso} for CHF {printTypeSpec.Price * numberOfCopiesInt}.- to {person.FirstName} {person.LastName}"); Console.WriteLine($"Actual balance : CHF {person.Balance}.-"); } else { person = client.GetPersonById(person.Id); Console.WriteLine($"You have just printed {numberOfCopiesInt} {printTypeSpec.Description} {printTypeSpec.Color} {printTypeSpec.RectoVerso} for CHF {printTypeSpec.Price * numberOfCopiesInt}.- to {person.FirstName} {person.LastName}"); Console.WriteLine($"New balance : CHF {person.Balance}.- "); } }
private static void RealAddQuotas(Person person) { ServiceProject.ServiceCardClient client = new ServiceProject.ServiceCardClient(); PrintType printTypeSpec = null; while (printTypeSpec == null) { Console.WriteLine("Choose which quotas you want to add ?"); DisplayQuotas(); string quotaChoice = Console.ReadLine(); int quotaChoiceInt = Int32.Parse(quotaChoice); printTypeSpec = client.GetPrintTypeById(quotaChoiceInt); } Console.WriteLine("How much of this quotas do you want to add? "); string numberOfCopies = Console.ReadLine(); int numberOfCopiesInt = Int32.Parse(numberOfCopies); client.AddMoneyToCard(person.Id, printTypeSpec.Price * numberOfCopiesInt); Person personRefresh = client.GetPersonById(person.Id); Console.WriteLine($"You have just added {numberOfCopiesInt} {printTypeSpec.Description} {printTypeSpec.Color} {printTypeSpec.RectoVerso} for CHF {printTypeSpec.Price * numberOfCopiesInt}.- to {personRefresh.FirstName} {personRefresh.LastName}"); Console.WriteLine($"New balance : CHF {personRefresh.Balance}.- "); }