Exemple #1
0
 public bool IsValid(Vehicle vehicle)
 {
     if (!_dateValidator.IsValid(vehicle.VehicleManufactoringYear) && !_dateValidator.IsValid(vehicle.VehicleModelYear))
     {
         return(false);
     }
     if (!_numberValidator.IsPositive(vehicle.VehicleCurrentFipeValue.ToString()) && !_numberValidator.IsPositive(vehicle.VehicleCurrentMileage.ToString()))
     {
         return(false);
     }
     return(true);
 }
Exemple #2
0
 public bool IsValid(Pet pet)
 {
     if (!_dateValidator.IsValid(pet.PetBirthdate))
     {
         return(false);
     }
     return(true);
 }
Exemple #3
0
 public bool IsValid(Realty realty)
 {
     if (!_dateValidator.IsValid(realty.RealtyConstructionDate))
     {
         return(false);
     }
     if (!_numberValidator.IsPositive(realty.RealtyMarketValue.ToString()) && !_numberValidator.IsPositive(realty.RealtySaleValue.ToString()))
     {
         return(false);
     }
     return(true);
 }
 public bool IsValid(MobileDevice mobileDevice)
 {
     if (!_dateValidator.IsValid(mobileDevice.MobileDeviceManufactoringYear))
     {
         return(false);
     }
     if (!_numberValidator.IsPositive(mobileDevice.MobileDeviceInvoiceValue.ToString()))
     {
         return(false);
     }
     return(true);
 }
Exemple #5
0
        public void LogOut(TextBox name, TextBox surname, TextBox dayOfBirth, TextBox bcn, Person person, TextBlock LOG)
        {
            bool OkName   = true;
            bool OkSurame = true;
            bool OkDate   = true;
            bool OkBcn    = true;

            if (name.Text != null | name.Text == "YourName")
            {
                person.Name = name.Text;
            }
            else
            {
                MessageBox.Show("Name format is wrong", "Format Error", MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            if (surname.Text != null | surname.Text == "YourSurname")
            {
                person.Surname = surname.Text;
            }
            else
            {
                MessageBox.Show("Surname format is wrong", "Format Error", MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            if (dayOfBirth.Text != null | dayOfBirth.Text == "day.month.year")
            {
                person.DayOfBirth = dayOfBirth.Text;
            }
            else
            {
                MessageBox.Show("Day of birth format is wrong", "Format Error", MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            if (bcn.Text != null | bcn.Text == "xxxxxx/xxx")
            {
                person.BCN = bcn.Text;
            }
            else
            {
                MessageBox.Show("BCN format is wrong", "Format Error", MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            if (OkName = stringValidator.IsValid(person.Name))
            {
                LOG.Text += person.Name;
                LOG.Text += " ";
            }
            if (OkSurame = stringValidator.IsValid(person.Surname))
            {
                LOG.Text += person.Surname;
                LOG.Text += " ";
            }
            if (OkDate = dateValidator.IsValid(person.DayOfBirth))
            {
                LOG.Text += person.DayOfBirth;
                LOG.Text += " ";
            }
            if (OkBcn = bcnValidator.IsValid(person.BCN, person.DayOfBirth))
            {
                LOG.Text += person.BCN;
                LOG.Text += "-----------------------------------------------------------";
            }
        }