Пример #1
0
        /// <summary>
        /// این متد رکورد لاگین مربوط به کاربر را حذف میکند
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public virtual async Task <bool> Logout(long userId)
        {
            try
            {
                var user = await _userManager.FindByIdAsync(userId);

                if (user == null)
                {
                    return(false);
                }
                //حذف رکورد مربوط به جدول لاگین کاربر
                var userLogin = _userLoginRepository.Find(ul => ul.UserId == user.Id);
                if (userLogin != null)
                {
                    _userLoginRepository.Delete(userLogin);
                }
                _unitOfWork.SaveChanges();
                _authenticationManager.SignOut();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
            //_authenticationManager.SignOut();
        }
Пример #2
0
        private void tsbDelete_Click(object sender, EventArgs e)
        {
            var userAccess = userAccessRepository.GetAll();

            bool isAllowed = userAccess.Exists(u => u.FullName == Store.ActiveUser &&
                                               u.ObjectName == "User" && u.IsDelete);

            if (isAllowed == false && Store.IsAdministrator == false)
            {
                MessageBox.Show("Anda tidak dapat meghapus", "Perhatian", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                if (MessageBox.Show("Anda yakin ingin menghapus '" + txtUserName.Text + "'", "Perhatian",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    userRepository.Delete(new Guid(txtID.Text));
                    GetLastUser();

                    LoadUsers();

                    FillCode();
                }
            }
        }
        public bool RemoveLogin(User user, string loginProvider, string providerKey)
        {
            IUserLoginRepository repo = _data_repository_factory.GetIdentityDataRepository <IUserLoginRepository>();

            repo.Delete(new UserLoginData()
            {
                UserID = user.UserId, LoginProvider = loginProvider, ProviderKey = providerKey
            });
            return(true);
        }
        public async Task RemoveLoginAsync(ApplicationUser user, string loginProvider, string providerKey, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            var deleteUserLoginDto = new DeleteUserLoginDto
            {
                LoginProvider = loginProvider,
                ProviderKey   = providerKey,
                UserId        = user.Id
            };

            await _userLoginRepository.Delete(deleteUserLoginDto);
        }
Пример #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="objUserLogin"></param>
 public void DeleteUserLogin(UserLogin objUserLogin)
 {
     _userLoginRepository.Delete(objUserLogin);
     _unitOfWork.Commit();
 }
Пример #6
0
 public void Delete(int pkUid)
 {
     _userLoginRepository.Delete(pkUid);
 }