Exemplo n.º 1
0
        virtual public void PrintInfo()
        {
            Console.Write("Please enter License Plate: ");
            string license  = Console.ReadLine();
            string license2 = license.Insert(license.Length - 2, "-");

            LicensePlate = license2.Insert(2, "-");
            LicensePlate = LicensePlate.ToUpper();

            Console.Write("Please enter the manufacturer: ");
            string manufacturer = Make;

            manufacturer = Console.ReadLine();

            Console.Write("Please enter the model: ");
            string model = Model;

            model = Console.ReadLine();

            Console.Write("Please enter year: ");
            int year = Year;

            year = int.Parse(Console.ReadLine());

            Console.Write("Please enter the color: ");
            string color = Color;

            color = Console.ReadLine();

            Console.WriteLine("===========================");
            Console.WriteLine($"License plate number: {LicensePlate}");
            Console.WriteLine($"Manufacturer: {manufacturer}");
            Console.WriteLine($"Model: {model}");
            Console.WriteLine($"Year: {year}");
            Console.WriteLine("============================");
        }
Exemplo n.º 2
0
        private bool ValidateInput()
        {
            if (String.IsNullOrEmpty(Brand) || String.IsNullOrEmpty(ModelName) || String.IsNullOrEmpty(ModelYear) || String.IsNullOrEmpty(Color) || String.IsNullOrEmpty(FirstName) || String.IsNullOrEmpty(LastName) || String.IsNullOrEmpty(ICNumber) || String.IsNullOrEmpty(Phone) || String.IsNullOrEmpty(Email))
            {
                MessageBox.Show("Rejected request!\nThere are empty fields!", "Error!", MessageBoxButton.OK, MessageBoxImage.Information);
                return(false);
            }

            if (ParseToInt(ModelYear) > DateTime.Now.Year || ParseToInt(ModelYear) < 1900)
            {
                MessageBox.Show("Rejected request!\nThere was an error with the Model Date!", "Error!", MessageBoxButton.OK, MessageBoxImage.Information);
                return(false);
            }


            if (isNumeric(Phone) || ICNumber.Length < 10 || ICNumber.Length > 15)
            {
                MessageBox.Show("Rejected request!\nThere was an error with the Phone Number!", "Error!", MessageBoxButton.OK, MessageBoxImage.Information);
                return(false);
            }

            if (isNumeric(ICNumber) || ICNumber.Length != 13)
            {
                MessageBox.Show("Rejected request!\nThere was an error with the Identity Card Number!", "Error!", MessageBoxButton.OK, MessageBoxImage.Information);
                return(false);
            }

            if (LicensePlate.Length > 11 || LicensePlate.Length < 8 || !LicensePlate.Equals(LicensePlate.ToUpper()))
            {
                MessageBox.Show("Rejected request!\nThere was an error with the License Plate input!", "Error!", MessageBoxButton.OK, MessageBoxImage.Information);
                return(false);
            }
            return(true);
        }