コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: Dog.cs プロジェクト: matysekmichal/isengard
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: Toolbox.cs プロジェクト: matysekmichal/isengard
        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);
        }
コード例 #5
0
 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();
 }
コード例 #6
0
 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();
 }