Exemplo n.º 1
0
 public AuthController(IBusinessUser authService, ITokenHelper tokenHelper, IBusinessCustomer customerService, IBusinessAccount accountService, IBusinessTransaction transactionService)
 {
     _authService        = authService;
     _tokenHelper        = tokenHelper;
     _customerService    = customerService;
     _accountService     = accountService;
     _transactionService = transactionService;
 }
Exemplo n.º 2
0
        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()
            };
        }
Exemplo n.º 3
0
        /// <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());
        }
Exemplo n.º 4
0
        /// <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);
        }
Exemplo n.º 5
0
        /// <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;
        }
Exemplo n.º 6
0
 /// <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);
 }
Exemplo n.º 7
0
 /// <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;
 }
Exemplo n.º 8
0
 public UserController(IBusinessUser service)
 {
     _service = service;
 }
Exemplo n.º 9
0
 public AccountController(IBusinessUser userBusiness)
 {
     _userBusiness = userBusiness;
 }
Exemplo n.º 10
0
 public UserController(IBusinessUser _member)
 {
     member = _member;
 }
Exemplo n.º 11
0
 // GET: User
 public UserController(IBusinessUser busiuser)
 {
     _busiuser = busiuser;
 }
Exemplo n.º 12
0
 public ServiceUser(IBusinessBase <User> businessBase, IBusinessUser businessUser)
     : base(businessBase)
 {
     _businessUser = businessUser;
 }
Exemplo n.º 13
0
 public LoginController(IBusinessUser businesUserParam)
 {
     businesUser = businesUserParam;
 }
Exemplo n.º 14
0
 public LoginController()
 {
     businesUser = new BusinessUser();
 }
Exemplo n.º 15
0
 public LoginController(IOptions <AppSettings> appSettings, IBusinessUser businessUser, IHostingEnvironment env)
 {
     _businessUser = businessUser;
     _appSettings  = appSettings.Value;
     _env          = env;
 }