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 RealAddMoney(Person person) { ServiceProject.ServiceCardClient client = new ServiceProject.ServiceCardClient(); Console.WriteLine("How much money do you want to add to this user ?"); string amount = Console.ReadLine(); double amountDouble = Double.Parse(amount); client.AddMoneyToCard(person.Id, amountDouble); person = client.GetPersonById(person.Id); Console.WriteLine($"New balance : CHF {person.Balance}.- "); }
private static Person GetUserByUserId() { ServiceProject.ServiceCardClient client = new ServiceProject.ServiceCardClient(); Person person = null; while (person == null) { Console.WriteLine("Insert User ID :"); string userID = Console.ReadLine(); int userIdInt = Int32.Parse(userID); person = client.GetPersonById(userIdInt); } Console.WriteLine($"Person Username {person.Username} and ID {person.Id}: {person.LastName} {person.FirstName}"); Console.WriteLine($"Actual balance : CHF {person.Balance}.-"); return(person); }
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}.- "); }