public AuthController(IBusinessUser authService, ITokenHelper tokenHelper, IBusinessCustomer customerService, IBusinessAccount accountService, IBusinessTransaction transactionService) { _authService = authService; _tokenHelper = tokenHelper; _customerService = customerService; _accountService = accountService; _transactionService = transactionService; }
public AccountController(IOptions <TokenOptions> jwtOptions, IBusinessUser service) { _service = service; _TokenOptions = jwtOptions.Value; // recebendo o value do token ThrowIfInvalidOptions(_TokenOptions); // usando o metodo criado para tratamento de excessões // vericar se é preciso para versões mais recentes se nao precisar pode apagar essa configuração _serializeSettings = new JsonSerializerSettings { Formatting = Formatting.Indented, ContractResolver = new CamelCasePropertyNamesContractResolver() }; }
/// <summary> /// 清理某些已经改变的缓存 /// </summary> /// <param name="entity"></param> private static void CleanUpCache(IBusinessUser entity) { CacheHelper.Remove(CoreCacheKeys.GetUserByAccountKey(entity.UserName)); CacheHelper.Remove(CoreCacheKeys.GetUserByAccountKey(entity.UserEmail)); CacheHelper.Remove(CoreCacheKeys.GetUserByEMailKey(entity.UserEmail)); CacheHelper.Remove(CoreCacheKeys.GetUserByGuidKey(entity.UserGuid)); CacheHelper.Remove(CoreCacheKeys.GetUserByNameKey(entity.UserName)); CacheHelper.Remove(CoreCacheKeys.GetUserRolesByGuidKey(entity.UserGuid)); CacheHelper.RemoveByPattern(CoreCacheKeys.GetUserListPrefixKey()); }
/// <summary> /// 根据实体构建缓存 /// </summary> /// <param name="entity"></param> private static void BuildUpCache(IBusinessUser entity) { CacheHelper.Set(CoreCacheKeys.GetUserByAccountKey(entity.UserName), entity, CacheHelper.AFewTime); CacheHelper.Set(CoreCacheKeys.GetUserByAccountKey(entity.UserEmail), entity, CacheHelper.AFewTime); CacheHelper.Set(CoreCacheKeys.GetUserByEMailKey(entity.UserEmail), entity, CacheHelper.AFewTime); CacheHelper.Set(CoreCacheKeys.GetUserByGuidKey(entity.UserGuid), entity, CacheHelper.AFewTime); CacheHelper.Set(CoreCacheKeys.GetUserByNameKey(entity.UserName), entity, CacheHelper.AFewTime); }
/// <summary> /// 更新用户 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static bool UpdateUser(IBusinessUser entity) { BusinessUser originalModel = BusinessUserBLL.Get(entity.UserGuid, true); if (string.IsNullOrEmpty(entity.UserFullPath) || originalModel.UserNameDisplay != entity.UserNameDisplay || originalModel.DepartmentGuid != entity.DepartmentGuid) { entity.UserFullPath = GetFullPath(entity); } bool isSuccessful = DALSave.UpdateUser(entity); if (isSuccessful == true) { if (entity is IModelExtensible) { ((IModelExtensible)entity).PropertyNames = ((IModelExtensible)entity).ExtensiableRepository.GetSerializerData().Keys; ((IModelExtensible)entity).PropertyValues = ((IModelExtensible)entity).ExtensiableRepository.GetSerializerData().Values; } if (entity.UserFullPath != originalModel.UserFullPath) { ChangeFullPath(originalModel.UserFullPath, entity.UserFullPath); } CleanUpCache(entity); BuildUpCache(entity); } return isSuccessful; }
/// <summary> /// 获取部门内用户的全路径 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static string GetFullPath(IBusinessUser entity) { return string.Format("{0}||{1}", BusinessDepartmentBLL.Instance.GetFullPath(entity.DepartmentGuid), entity.UserNameDisplay); }
/// <summary> /// 创建用户 /// </summary> /// <param name="entity"></param> /// <param name="status"></param> /// <returns></returns> public static BusinessUser CreateUser(IBusinessUser entity, out CreateUserRoleStatuses status) { entity = BusinessUserDAL.DealWithPassword(entity); entity.UserFullPath = GetFullPath(entity); BusinessUser entityCreated = DALSave.CreateUser(entity, out status); if (status == CreateUserRoleStatuses.Successful) { CleanUpCache(entity); BuildUpCache(entityCreated); } return entityCreated; }
public UserController(IBusinessUser service) { _service = service; }
public AccountController(IBusinessUser userBusiness) { _userBusiness = userBusiness; }
public UserController(IBusinessUser _member) { member = _member; }
// GET: User public UserController(IBusinessUser busiuser) { _busiuser = busiuser; }
public ServiceUser(IBusinessBase <User> businessBase, IBusinessUser businessUser) : base(businessBase) { _businessUser = businessUser; }
public LoginController(IBusinessUser businesUserParam) { businesUser = businesUserParam; }
public LoginController() { businesUser = new BusinessUser(); }
public LoginController(IOptions <AppSettings> appSettings, IBusinessUser businessUser, IHostingEnvironment env) { _businessUser = businessUser; _appSettings = appSettings.Value; _env = env; }