public static Address SetData() { var address = new Address(); Console.WriteLine("Wprowadź dane nowego adresu"); address.SetData(Toolbox.InputString("Podaj ulicę: ", false), Toolbox.InputString("Podaj Miasto: ", false), Toolbox.InputString("Podaj Kod Pocztowy: ", false), Toolbox.InputInteger("Nr Domu: ", 1, 200)); return(address); }
public Pet CreatePet() { var result = new Dog(); Console.WriteLine("=== Wprowadź dane nowego psa ==="); result.SetData(Toolbox.InputString("Podaj imie psa :", false), Toolbox.InputInteger("Podaj wiek psa:", 0, 20), TypeOfPet.NoData, Toolbox.InputString("Gatunek psa :", false), Toolbox.InputString("Rasa psa :", false) ); return(result); }
public static Person CreatePerson() { var result = new Person(); Console.WriteLine("=== Wprowadź dane nowej osoby ==="); result.SetData(Toolbox.InputString("Podaj imie:", false), Toolbox.InputString("Podaj nazwisko:", false), Toolbox.InputInteger("Podaj wiek", 0, 120), Toolbox.InputEmail("Podaj email: ")); result.Address.SetData(Toolbox.InputString("Podaj ulice:", false), Toolbox.InputString("Podaj miasto:", false), Toolbox.InputString("Podaj kod pocztowy:", false), Toolbox.InputInteger("Podaj nr domu:", 1, int.MaxValue)); return(result); }
public static int InputInteger(string inputText, int min, int max) { int result = 0; while (true) { string liczba = Toolbox.InputString(inputText, false); result = int.Parse(liczba); if (!int.TryParse(liczba, out result) || (result < min || result > max)) { Console.WriteLine("Wprowadzono niepoprawna wartosc (Zakres {0} {1})", min, max); } else { break; } } return(result); }
public Person(TypesGender gender, string name, string surname, string age, string email) : this() { this.Gender = gender; this.SetData(Toolbox.InputString(name, false), Toolbox.InputString(surname, false), Toolbox.InputInteger(age, 0, 99), Toolbox.InputEmail(email)); this.Address = new Address(); }
public Person(TypesGender gender, string name, string surname) : this() { this.Gender = gender; this.SetData(Toolbox.InputString(name, false), Toolbox.InputString(surname, false)); this.Address = new Address(); }