public override int GetHashCode()
        {
            unchecked
            {
                const int hashBase   = (int)2166136261;
                const int multiplier = 16777619;

                int hash = hashBase;
                hash = (hash * multiplier) ^ Uln.GetHashCode();
                hash = (hash * multiplier) ^ (GivenNames is null ? 0 : GivenNames.GetHashCode());
                hash = (hash * multiplier) ^ (FamilyName is null ? 0 : FamilyName.GetHashCode());
                return(hash);
            }
        }
        protected override void Dispose(bool disposing)
        {
            // If you need thread safety, use a lock around these
            // operations, as well as in your methods that use the resource.
            if (!_disposed)
            {
                if (disposing)
                {
                    if (Birthdate != null)
                    {
                        Birthdate.Dispose();
                    }
                    if (Surname != null)
                    {
                        Surname.Dispose();
                    }
                    if (Surname2 != null)
                    {
                        Surname2.Dispose();
                    }
                    if (GivenNames != null)
                    {
                        GivenNames.Dispose();
                    }
                    if (IDNumber != null)
                    {
                        IDNumber.Dispose();
                    }

                    if (_backgroundView != null)
                    {
                        _backgroundView.Dispose();
                    }
                }

                // Indicate that the instance has been disposed.
                Birthdate       = null;
                Surname         = null;
                Surname2        = null;
                GivenNames      = null;
                IDNumber        = null;
                _backgroundView = null;

                _disposed = true;
            }
        }
Ejemplo n.º 3
0
        public string GetFullNameForDisplay()
        {
            string displayname = "";

            for (int i = 1; i <= 3; i++)
            {
                if (!GivenNames.ContainsKey(i))
                {
                    break;
                }

                displayname += GivenNames[i] + " ";
            }

            displayname += Surname;

            return(displayname);
        }
Ejemplo n.º 4
0
        public ActionResult SignUp(AccountRegistration information)
        {
            var username = new Username(information.Username);

            bool usernameIsAvailable = _accountRegistrationService.IsUsernameAvailable(username);

            if (!usernameIsAvailable)
            {
                TempData.RegistrationFailureReason.Store(RegistrationFailureReason.UsernameNotAvailable);
                TempData.AccountRegistrationInformation.Store(information);
                return(RedirectToAction <AccountController>(c => c.SignUp()));
            }

            var password             = new Password(information.Password);
            var passwordConfirmation = new Password(information.PasswordConfirmation);

            if (!password.Equals(passwordConfirmation))
            {
                TempData.RegistrationFailureReason.Store(RegistrationFailureReason.PasswordsDoNotMatch);
                return(RedirectToAction <AccountController>(c => c.SignUp()));
            }

            var emailAddress             = new EmailAddress(information.Email);
            var emailAddressConfirmation = new EmailAddress(information.EmailConfirmation);

            if (!emailAddress.Equals(emailAddressConfirmation))
            {
                TempData.RegistrationFailureReason.Store(RegistrationFailureReason.EmailsDoNotMatch);
                return(RedirectToAction <AccountController>(c => c.SignUp()));
            }

            var foo = new GivenNames();

            var fullName            = new FullName(new Name(information.LastName), new GivenNames(information.FirstName));
            var accountRegistration = new AccountManagement.AccountRegistration(username, password, fullName, new EmailAddress(information.Email));

            _accountRegistrationService.CreateAccount(accountRegistration);

            TempData.NewAccountUsername.Store(accountRegistration.Username);
            return(RedirectToAction <AccountController>(c => c.SignUpComplete()));
        }