private void Subscribe_Btn(object sender, RoutedEventArgs e) { if (AreUserFieldsOk()) { string login = Login_TxtBox.Text; string password = Password_Box.Password; DateTime birthday = (DateTime)Birthday_DatePicker.SelectedDate; short streetNumber = Convert.ToInt16(StreetNumber_TxtBox.Text); string streetName = StreetName_TxtBox.Text; string cityName = CityName_TxtBox.Text; string postalCode = PostalCode_TxtBox.Text; Region region = (Region)Region_cmbBox.SelectedItem; City city = CityFactory.Get(cityName, postalCode, region); Address address = AddressFactory.Get(streetNumber, streetName, city); string encryptedPassword = Password.Encrypt(password.ToString()); if (!User.IsInDb(login, encryptedPassword)) { User user = UserFactory.Create(login, encryptedPassword, birthday, address); DialogBox.Ok("Success", "User has been correctly recorded"); ResetInscription(); } else { DialogBox.Ok("Error", "Check fields"); } } else { DialogBox.Ok("Error", "Check fields"); } }