public async Task Setup() { var dbContextFactory = new DbContextFactory(); DbContext = dbContextFactory.CreateDbContext(new string[] { }); CoreUnitOfWork = new CoreEfCoreUnitOfWork(DbContext); var brankoBankService = new BrankoBankService(); BankRoutingService = new BankRoutingService(brankoBankService); FeeService = new FeeService(); var inMemorySettings = new Dictionary <string, string> { { "MaximalDeposit", "750000" }, { "MaximalWithdraw", "500000" }, { "NumberOfDaysAfterCreationWithNoFee", "0" }, { "FirstTransactionFreeEachMonth", "True" }, { "FixedFeeLimit", "10000" }, { "FixedFee", "100" }, { "PercentageFee", "1" }, { "AdminPassword", "123456" } }; Configuration = new ConfigurationBuilder() .AddInMemoryCollection(inMemorySettings) .Build(); }
public QueryTenantService( IDistributedCache cache, ICoreUnitOfWork uow) { _cache = cache; _uow = uow; }
public void Setup() { var dbContextFactory = new SampleDbContextFactory(); _dbContext = dbContextFactory.CreateDbContext(new string[] { }); _coreUnitOfWork = new CoreEfCoreUnitOfWork(_dbContext); }
public CoreApplicationService(TRepository linkedRepository, IMapper mapper, ICoreUnitOfWork unitOfWork, ILogger <CoreApplicationService <TEntity, TViewModel, TRepository> > logger) { LinkedRepository = linkedRepository; Mapper = mapper; UnitOfWork = unitOfWork; _logger = logger; }
public HostTenantService( ICacheService cache, ICoreUnitOfWork uow) { _cache = cache; _uow = uow; }
public UserAccountService( ICoreUnitOfWork coreUnitOfWork, IBankService bankService) { _coreUnitOfWork = coreUnitOfWork; _bankService = bankService; }
public async Task Setup() { var dbContextFactory = new SampleDbContextFactory(); DbContext = dbContextFactory.CreateDbContext(new string[] { }); CoreUnitOfWork = new EfCoreUnitOfWork(DbContext); var firstBankService = new FirstBankService(); BankRoutingService = new BankRoutingService(firstBankService); FeeService = new FeeService(); var inMemorySettings = new Dictionary <string, string> { { "MaxDeposit", "1000000" }, { "MaxWithdraw", "100000" }, { "DaysAfterWalletCreationWithNoFee", "7" }, { "IsFirstTransferFreeInMonth", "True" }, { "FixedFee", "100" }, { "FeeLimit", "10000" }, { "PercentageFee", "1" } }; Configuration = new ConfigurationBuilder() .AddInMemoryCollection(inMemorySettings) .Build(); }
public LabelsController( ICoreUnitOfWork uow, IWorkContext workcontext) { _uow = uow; _workcontext = workcontext; }
public OrganizationRolesController( ICoreUnitOfWork uow, IWorkContext workcontext) { _uow = uow; _workcontext = workcontext; }
public WalletService( ICoreUnitOfWork unitOfWork, IBankService bankService, IPassService passService, string numberOfFirstDaysWithoutComission, TransferFactory transferFactory, string maxWithdraw, string maxDeposit ) { UnitOfWork = unitOfWork; BankService = bankService; PassService = passService; TransferFactory = transferFactory; if (!int.TryParse(numberOfFirstDaysWithoutComission, out NumberOfFirstDaysWithoutComission)) { throw new ArgumentException("Invalid NumberOfFirstDaysWithoutComission string"); } if (!decimal.TryParse(maxWithdraw, out MaxWithdraw)) { throw new ArgumentException("Invalid MaxDeposit string"); } if (!decimal.TryParse(maxDeposit, out MaxDeposit)) { throw new ArgumentException("Invalid MaxDeposit string"); } }
public TenantInfoController( ICoreUnitOfWork uow, IWorkContext workContext) { _uow = uow; _workContext = workContext; }
internal GetEmployeeCommand(ICoreUnitOfWork coreUnitOfWork) { if (coreUnitOfWork == null) { throw new ArgumentNullException("coreUnitOfWork"); } _coreUnitOfWork = coreUnitOfWork; }
internal CreateInventoryTransactionCommand(ICoreUnitOfWork coreUnitOfWork) { if (coreUnitOfWork == null) { throw new ArgumentNullException("coreUnitOfWork"); } _coreUnitOfWork = coreUnitOfWork; }
public EmployeesServiceProvider(ICoreUnitOfWork coreUnitOfWork) { if (coreUnitOfWork == null) { throw new ArgumentNullException("coreUnitOfWork"); } _coreUnitOfWork = coreUnitOfWork; }
public FileService( IWebHostEnvironment env, ICoreUnitOfWork uowCore, IOptions <FileUploadOption> options) { _env = env; _uowCore = uowCore; _options = options.Value; }
public FileController( ICoreUnitOfWork uow, IWorkContext workContext, IFileService fileService) { _uow = uow; _workContext = workContext; _fileService = fileService; }
public CoreController( IWorkContext workContext, INavigationService navigationService, ICoreUnitOfWork uow) { _workContext = workContext; _navigationService = navigationService; _uow = uow; }
public SettingsController( ICoreUnitOfWork uowCore, IWorkContext workContext, ISettingService settingService) { _uowCore = uowCore; _workContext = workContext; _settingService = settingService; }
public ProfileController( IWorkContext workContext, IIdentityService identityService, ICoreUnitOfWork uow) { _workContext = workContext; _identityService = identityService; _uow = uow; }
public InstallController( ICoreUnitOfWork uow, UserManager <User> userManager, RoleManager <Role> roleManager, ISettingService settingService) { _uow = uow; _userManager = userManager; _roleManager = roleManager; _settingService = settingService; }
public RolesController( IWorkContext workContext, IPoliciesStorage policiesStorage, ICoreUnitOfWork uow, IDistributedCache cache) { _workContext = workContext; _policiesStorage = policiesStorage; _uow = uow; _cache = cache; }
public WalletService( ICoreUnitOfWork coreUnitOfWork, IBankRoutingService bankRoutingService, IConfiguration configuration, IFeeService feeService ) { CoreUnitOfWork = coreUnitOfWork; BankRoutingService = bankRoutingService; Configuration = configuration; FeeService = feeService; }
public UsersController( IIdentityService identityService, IEnumerable <IUserInfoService> userInfoServices, IWorkContext workcontext, ICoreUnitOfWork uow, IDistributedCache cache) { _identityService = identityService; _userInfoServices = userInfoServices; _workcontext = workcontext; _uow = uow; _cache = cache; }
public WorkContext( ICoreUnitOfWork uow, IHttpContextAccessor httpContextAccessor, IEnumerable <ITenantIdentificationService> identificationServices, UserManager <User> userManager, IDistributedCache cache) { _uow = uow; _httpContext = httpContextAccessor.HttpContext; _identificationServices = identificationServices; _userManager = userManager; _cache = cache; }
public WalletService( ICoreUnitOfWork coreUnitOfWork, IBankRoutingService bankRoutingService, IFeeService feeService, IConfiguration configuration) { CoreUnitOfWork = coreUnitOfWork; BankRoutingService = bankRoutingService; FeeService = feeService; MaxDeposit = decimal.Parse(configuration["MaxDeposit"]); MaxWithdraw = decimal.Parse(configuration["MaxWithdraw"]); DaysAfterWalletCreationWithNoFee = Int32.Parse(configuration["DaysAfterWalletCreationWithNoFee"]); IsFirstTransferFreeInMonth = bool.Parse(configuration["IsFirstTransferFreeInMonth"]); FixedFee = decimal.Parse(configuration["FixedFee"]); PercentageFee = Int32.Parse(configuration["PercentageFee"]); FeeLimit = decimal.Parse(configuration["FeeLimit"]); AdminPASS = configuration["AdminPASS"]; }
/// <summary> /// Kiểm tra token còn hạn hay ko /// </summary> /// <param name="context"></param> /// <param name="configuration"></param> /// <param name="uow"></param> /// <returns></returns> public async Task Invoke(HttpContext context, IConfiguration configuration, ICoreUnitOfWork uow) { var auth = context.Request.Headers["Authorization"].ToString(); if (string.IsNullOrWhiteSpace(auth)) { await _next.Invoke(context); return; } auth = auth.Replace("Bearer ", ""); var jwtHandler = new JwtSecurityTokenHandler(); var token = jwtHandler.ReadToken(auth); //lấy token từ cache var bytes = await _cache.GetAsync($"TokenInfos:{token.Id}"); if (bytes != null) { await _next.Invoke(context); return; } //lấy từ DB ra xem có dữ liệu không var repoTenant = uow.GetRepository <ITokenInfoRepository>(); var tokenInfo = await repoTenant.QueryByCodeAsync(Guid.Parse(token.Id)); if (tokenInfo != null && tokenInfo.AccessToken == auth) { //lưu vào cache var cacheOption = new DistributedCacheEntryOptions(); cacheOption.AbsoluteExpiration = tokenInfo.ExpireAt; await _cache.SetAsync($"TokenInfos:{tokenInfo.Code}", Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(tokenInfo)), cacheOption); await _next.Invoke(context); return; } context.Response.StatusCode = 401; //UnAuthorized return; }
public TenantsController( ICoreUnitOfWork uow, UserManager <User> userManager, IPasswordValidator <User> passwordValidator, IWorkContext workContext, IPasswordHasher <User> passwordHasher, //IConnectionMultiplexer redis, IDistributedCache cache, IModuleManager moduleManager) { _uow = uow; _userManager = userManager; _passwordValidator = passwordValidator; _workContext = workContext; _passwordHasher = passwordHasher; //_redis = redis; _cache = cache; _moduleManager = moduleManager; }
public async Task Setup() { var dbContextFactory = new DbContextFactory(); DbContext = dbContextFactory.CreateDbContext(new string[] { }); CoreUnitOfWork = new CoreEfCoreUnitOfWork(DbContext); var brankoBankService = new BrankoBankService(); BankRoutingService = new BankRoutingService(brankoBankService); FeeService = new FeeService(); var inMemorySettings = new Dictionary <string, string> { { "MaximalDeposit", "2000000" }, { "MaximalWithdraw", "2000000" }, }; Configuration = new ConfigurationBuilder() .AddInMemoryCollection(inMemorySettings) .Build(); }
public GenericRepository(ICoreUnitOfWork unitOfWork) { this.unitOfWork = unitOfWork; this.objectContext = this.unitOfWork.ObjectContext; this.dbSet = this.objectContext.CreateObjectSet <TEntity>(); internalLocal = new ObservableCollection <TEntity>( this.objectContext.ObjectStateManager .GetObjectStateEntries(System.Data.EntityState.Unchanged | System.Data.EntityState.Added | System.Data.EntityState.Modified) .Where(entry => entry.Entity is TEntity) .Select(entry => (TEntity)entry.Entity)); this.objectContext.ObjectStateManager.ObjectStateManagerChanged += OnObjectStateManagerChanged; this.internalLocal.CollectionChanged += OnInternalLocalChanged; this.detectChanges = true; this.detectLocalChanges = true; var containerName = this.objectContext.DefaultContainerName; var container = this.unitOfWork.ObjectContext.MetadataWorkspace.GetEntityContainer(containerName, System.Data.Metadata.Edm.DataSpace.CSpace); this.entitySet = container.BaseEntitySets.Where(set => set.ElementType.Name.Equals(typeof(TEntity).Name)).FirstOrDefault(); this.baseType = this.GetBaseType(); }
//private readonly IConnectionMultiplexer _redis; public IdentityService( IOptions <IdentityOption> options, IHttpContextAccessor httpContextAccessor, UserManager <User> userManager, SignInManager <User> signInManager, IPasswordHasher <User> passwordHasher, ICoreUnitOfWork uow, IEnumerable <IUserInfoService> userInfoServices, IDistributedCache cache, //IConnectionMultiplexer redis, IWorkContext workContext) { _options = options.Value; _httpContextAccessor = httpContextAccessor; _userManager = userManager; _signInManager = signInManager; _passwordHasher = passwordHasher; _uow = uow; _userInfoServices = userInfoServices; _cache = cache; _workContext = workContext; //_redis = redis; }