Example #1
0
        void ValidateMobileNumber(UserAccount account, string mobile)
        {
            if (!String.IsNullOrWhiteSpace(mobile))
            {
                var query =
                    from a in userAccountService.GetAll(account.Tenant)
                    where a.MobilePhoneNumber == mobile && a.ID != account.ID
                    select a;

                if (query.Any())
                {
                    Tracing.Verbose("[UserAccountValidation.MobilePhoneMustBeUnique] validation failed: {0}, {1}", account.Tenant, account.Username);
                    throw new ValidationException(Resources.ValidationMessages.MobilePhoneAlreadyInUse);
                }
            }
        }