private async Task <User> ModifUserStatus(int id, AccountStatusEnum status) { try { var user = await this.kraken.RepositoryUser.GetById(id); if (user == null) { this.NewNotification("User", "User does not exist."); return(user); } user.Status = status; var userModified = await this.kraken.RepositoryUser.Update(user); await this.kraken.Commit(); return(userModified); } catch (Exception exception) { await this.kraken.Rollback(); this.NewNotification("ServiceUser.ModifUserStatus", $"Exception: {exception.Message}"); return(await Task.FromResult <User>(null)); } }
public async Task <IList <User> > GetAllByStatus(AccountStatusEnum status) { var users = await this.dbSet.Where(user => user.Status == status) .ToListAsync() .ConfigureAwait(false); return(users); }
public GetListAccountDto( int id, AccountStatusEnum accountStatus, string email, int provinceId) { Id = id; AccountStatus = accountStatus; Email = email; ProvinceId = provinceId; }
public GetByEmailAccountDto( int id, AccountStatusEnum accountStatus, string email, GetByEmailAccountAddressDto?address) { Id = id; AccountStatus = accountStatus; Email = email; Address = address; }
public List <Models.Account> GetListAccount(string status = "") { List <Models.AccountDb> listDbAccounts = new List <Models.AccountDb>(); List <Models.Account> result = new List <Models.Account>(); try { using (var connection = new SqlConnection(Common.DATA_BASE_CONNECTION_STRING)) { if (string.IsNullOrEmpty(status)) { listDbAccounts = connection.Query <Models.AccountDb>($"Select * FROM Accounts").ToList(); } else { listDbAccounts = connection.Query <Models.AccountDb>($"Select * FROM Accounts WHERE Status='{status}'").ToList(); } listDbAccounts.ForEach(t => { try { DateTime birthDate = Convert.ToDateTime(t.BirthDate); GenderEnum gender = (GenderEnum)Enum.Parse(typeof(GenderEnum), t.Gender, true); AccountStatusEnum statusEnum = (AccountStatusEnum)Enum.Parse(typeof(AccountStatusEnum), t.Status, true); result.Add(new Models.Account() { Guid = t.Guid, Email = t.Email, Address = t.Address, DisplayName = t.DisplayName, CardContact = t.CardContact, _isRunning = false, BirthDate = birthDate, Gender = gender, Password = t.Password, Status = statusEnum }); } catch (Exception) { } }); } } catch (Exception ex) { return(result); } return(result); }
public AccountRegisterDto( int id, AccountStatusEnum accountStatus, string email, AccountRegisterAddressDto address) { Id = id; AccountStatus = accountStatus; Email = email; Address = address; }
private Account( Sid sid, string samPath, ObjectClass objectClass ) { m_Sid = sid; m_SamPath = samPath; m_ObjectClass = objectClass; m_accountStatus = AccountStatusEnum.Account_Good; m_Enabled = true; }
public async Task ChangeAccountStatus(Guid id, AccountStatusEnum newStatus) { if (newStatus == AccountStatusEnum.Pending) { throw new BrandscreenException("cannot change to pending status"); } var account = await GetAccount(id); switch (newStatus) { case AccountStatusEnum.Rejected: if (account.UtcStatusChangedDateTime.HasValue) { throw new BrandscreenException("cannot change to rejected status as it has been activated or rejected"); } account.IsApproved = false; account.IsActive = false; account.UtcStatusChangedDateTime = _clock.UtcNow; _buyerAccountRepositoryAsync.Update(account); break; case AccountStatusEnum.Activated: account.IsApproved = true; account.IsActive = true; account.UtcStatusChangedDateTime = _clock.UtcNow; _buyerAccountRepositoryAsync.Update(account); break; case AccountStatusEnum.Suspended: if (!account.UtcStatusChangedDateTime.HasValue) { throw new BrandscreenException("cannot chagne to suspended status only activated or rejected status is allowed"); } account.IsActive = false; account.UtcStatusChangedDateTime = _clock.UtcNow; _buyerAccountRepositoryAsync.Update(account); break; } if (account.ObjectState == ObjectState.Modified) { // new status has been accepted await _brandscreenContext.SaveChangesAsync(); } else { throw new BrandscreenException($"not support {newStatus} status"); } }
public AccountRegisterCommand( string correlationToken, AccountStatusEnum accountStatus, string email, string password, int provinceId, bool?agree) : base(correlationToken) { AccountStatus = accountStatus; Email = email; Password = password; ProvinceId = provinceId; Agree = agree; }
public async Task <ActionResult <IEnumerable <DtoUser> > > ReadAllByStatus(string status) { Logger.LogInformation($"UserController.ReadAllByStatus: GET: api/v1/users/status/{status}"); if (status.Length == 0) { return(BadRequest("Error: The user STATUS is empty!")); } // Case Insensitive: AccountStatusEnum accountStatus = (AccountStatusEnum)Enum.Parse(typeof(AccountStatusEnum), status, true); var models = await this.appServiceUser.GetAllUsersByStatus(accountStatus); return(Ok(models)); }
private Account( bool isLocal, string domainFlat, Sid sid, string samPath, string adsiPath, ObjectClass objectClass ) { m_IsLocal = isLocal; m_DomainFlat = domainFlat; m_Sid = sid; m_SamPath = samPath; m_AdsiPath = adsiPath; m_ObjectClass = objectClass; m_accountStatus = AccountStatusEnum.Account_Good; m_Enabled = IsUserEnabled(); }
public static string GetStatusStringFromEnum(AccountStatusEnum accountStatus) { string status = string.Empty; switch (accountStatus) { case AccountStatusEnum.Account_Good: status = "G"; break; case AccountStatusEnum.Account_Suspected: status = "S"; break; default: Debug.Assert(true, "Unknown accountStatus"); status = "S"; break; } return(status); }
/// <summary> /// Задает значение уровня аккаунта пользователя с заданным идентификатором. /// </summary> /// <param name="id">Идентификатор пользователя.</param> /// <param name="accountStatus">Задаваемый уровень аккаунта.</param> public void SetUserAccountStatus(string id, AccountStatusEnum accountStatus) { var isUserExist = _unitOfWork.UserRepository.Get(u => u.Id == id) .FirstOrDefault() != null; // Проверка на наличие пользователя в хранилище. if (!isUserExist) { return; } var user = Mapper.Map <Rocket.BL.Common.Models.User.User>( _unitOfWork.UserRepository.GetById(id)); user.AccountStatus = accountStatus; var dbUser = Mapper.Map <DbUser>(user); _unitOfWork.UserRepository.Update(dbUser); _unitOfWork.SaveChanges(); }
public static User Create(int?id, string login, string firstName, string lastName, string displayName, string competentProfile, string userPricipalName, string passwordHash, string phoneNumber, string email, Team assignedTeam, AccountStatusEnum status, ICollection <UserClaims> claims, DateTime?modificateDate) { return(new User { Id = id, Login = login, FirstName = firstName, LastName = lastName, DisplayName = displayName, CompetentProfile = competentProfile, UserPricipalName = userPricipalName, PasswordHash = passwordHash, PhoneNumber = phoneNumber, Email = email, AssignedTeam = assignedTeam, Status = status, Claims = claims, ModificateDate = modificateDate, }); }
public static string MapAccountStatus(AccountStatusEnum v) { switch (v) { case AccountStatusEnum.Forbidden: return "已锁定"; case AccountStatusEnum.Deleted: return "已注销"; case AccountStatusEnum.Inexistence: return "不存在"; case AccountStatusEnum.Active: return "正常"; case AccountStatusEnum.Quit: return "离职"; } return ""; }
// // Constructor public AccountStatus(AccountStatusEnum status) { this.Status = status; }
public User( int id, string email, string password, string group, DateTime registered, AccountStatusEnum status, string roles, string photo, string nickname, string firstName, string lastName, string phone, DateTime?birthDate, char?gender ) : this(id, email, password, group, registered, status, roles) { this.setUser(photo, nickname, firstName, lastName, phone, birthDate, gender); }
public User( int id, string email, string password, string group, DateTime registered, AccountStatusEnum status, string roles ) : base(id, email, password, group, registered, status, roles) { }
public async Task <IEnumerable <DtoUser> > GetAllUsersByStatus(AccountStatusEnum status) { return(this.mapper.Map <IEnumerable <DtoUser> >( await this.serviceUser.GetAllUsersByStatus(status) )); }
/// <summary> /// 获取所有用户 /// </summary> /// <param name="status">状态</param> /// <returns></returns> public List<Users> GetAllUser(AccountStatusEnum status) { UsersLogic ul = new UsersLogic(); var where = string.Format(" Status = {0}", (int)status); return ul.GetAllUser(where); }
public Account( int id, string email, string password, string group, DateTime registered, AccountStatusEnum status, string roles ) : this(email, password, group) { this.Id = id; this.Registered = registered; this.Status = status; this.Roles = roles; }
public void JustDecompileGenerated_set_AccountStatus(AccountStatusEnum value) { this.JustDecompileGenerated_AccountStatus_k__BackingField = value; }
public async Task <IEnumerable <User> > GetAllUsersByStatus(AccountStatusEnum status) { return(await this.kraken.RepositoryUser.GetAllByStatus(status)); }