コード例 #1
0
ファイル: UserAccountService.cs プロジェクト: rodmjay/Ideal
        protected internal virtual void DeleteAccount(User account)
        {
            if (_settings.AllowAccountDeletion || !account.IsAccountVerified)
            {
                //Tracing.Verbose(String.Format("[UserAccountService.DeleteAccount] removing account record: {0}, {1}", account.Tenant, account.Username));
                this._userRepository.Delete(account);
            }
            else
            {
                //Tracing.Verbose(String.Format("[UserAccountService.DeleteAccount] marking account closed: {0}, {1}", account.Tenant, account.Username));
                account.CloseAccount();
            }

            using (var tx = new TransactionScope())
            {
                this._userRepository.SaveOrUpdate(account);

                if (this._notificationService != null)
                {
                    this._notificationService.SendAccountDelete(account);
                }

                tx.Complete();
            }
        }