コード例 #1
0
        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();
        }
コード例 #2
0
ファイル: QueryTenantService.cs プロジェクト: nminhduc/jarvis
 public QueryTenantService(
     IDistributedCache cache,
     ICoreUnitOfWork uow)
 {
     _cache = cache;
     _uow   = uow;
 }
コード例 #3
0
        public void Setup()
        {
            var dbContextFactory = new SampleDbContextFactory();

            _dbContext      = dbContextFactory.CreateDbContext(new string[] { });
            _coreUnitOfWork = new CoreEfCoreUnitOfWork(_dbContext);
        }
コード例 #4
0
 public CoreApplicationService(TRepository linkedRepository, IMapper mapper, ICoreUnitOfWork unitOfWork, ILogger <CoreApplicationService <TEntity, TViewModel, TRepository> > logger)
 {
     LinkedRepository = linkedRepository;
     Mapper           = mapper;
     UnitOfWork       = unitOfWork;
     _logger          = logger;
 }
コード例 #5
0
 public HostTenantService(
     ICacheService cache,
     ICoreUnitOfWork uow)
 {
     _cache = cache;
     _uow   = uow;
 }
コード例 #6
0
 public UserAccountService(
     ICoreUnitOfWork coreUnitOfWork,
     IBankService bankService)
 {
     _coreUnitOfWork = coreUnitOfWork;
     _bankService    = bankService;
 }
コード例 #7
0
        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();
        }
コード例 #8
0
 public LabelsController(
     ICoreUnitOfWork uow,
     IWorkContext workcontext)
 {
     _uow         = uow;
     _workcontext = workcontext;
 }
コード例 #9
0
 public OrganizationRolesController(
     ICoreUnitOfWork uow,
     IWorkContext workcontext)
 {
     _uow         = uow;
     _workcontext = workcontext;
 }
コード例 #10
0
        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");
            }
        }
コード例 #11
0
 public TenantInfoController(
     ICoreUnitOfWork uow,
     IWorkContext workContext)
 {
     _uow         = uow;
     _workContext = workContext;
 }
コード例 #12
0
 internal GetEmployeeCommand(ICoreUnitOfWork coreUnitOfWork)
 {
     if (coreUnitOfWork == null)
     {
         throw new ArgumentNullException("coreUnitOfWork");
     }
     _coreUnitOfWork = coreUnitOfWork;
 }
コード例 #13
0
 internal CreateInventoryTransactionCommand(ICoreUnitOfWork coreUnitOfWork)
 {
     if (coreUnitOfWork == null)
     {
         throw new ArgumentNullException("coreUnitOfWork");
     }
     _coreUnitOfWork = coreUnitOfWork;
 }
コード例 #14
0
 public EmployeesServiceProvider(ICoreUnitOfWork coreUnitOfWork)
 {
     if (coreUnitOfWork == null)
     {
         throw new ArgumentNullException("coreUnitOfWork");
     }
     _coreUnitOfWork = coreUnitOfWork;
 }
コード例 #15
0
ファイル: FileService.cs プロジェクト: nminhduc/jarvis
 public FileService(
     IWebHostEnvironment env,
     ICoreUnitOfWork uowCore,
     IOptions <FileUploadOption> options)
 {
     _env     = env;
     _uowCore = uowCore;
     _options = options.Value;
 }
コード例 #16
0
ファイル: FileController.cs プロジェクト: nminhduc/jarvis
 public FileController(
     ICoreUnitOfWork uow,
     IWorkContext workContext,
     IFileService fileService)
 {
     _uow         = uow;
     _workContext = workContext;
     _fileService = fileService;
 }
コード例 #17
0
 public CoreController(
     IWorkContext workContext,
     INavigationService navigationService,
     ICoreUnitOfWork uow)
 {
     _workContext       = workContext;
     _navigationService = navigationService;
     _uow = uow;
 }
コード例 #18
0
 public SettingsController(
     ICoreUnitOfWork uowCore,
     IWorkContext workContext,
     ISettingService settingService)
 {
     _uowCore        = uowCore;
     _workContext    = workContext;
     _settingService = settingService;
 }
コード例 #19
0
 public ProfileController(
     IWorkContext workContext,
     IIdentityService identityService,
     ICoreUnitOfWork uow)
 {
     _workContext     = workContext;
     _identityService = identityService;
     _uow             = uow;
 }
コード例 #20
0
ファイル: InstallController.cs プロジェクト: nminhduc/jarvis
 public InstallController(
     ICoreUnitOfWork uow,
     UserManager <User> userManager,
     RoleManager <Role> roleManager,
     ISettingService settingService)
 {
     _uow            = uow;
     _userManager    = userManager;
     _roleManager    = roleManager;
     _settingService = settingService;
 }
コード例 #21
0
 public RolesController(
     IWorkContext workContext,
     IPoliciesStorage policiesStorage,
     ICoreUnitOfWork uow,
     IDistributedCache cache)
 {
     _workContext     = workContext;
     _policiesStorage = policiesStorage;
     _uow             = uow;
     _cache           = cache;
 }
コード例 #22
0
 public WalletService(
     ICoreUnitOfWork coreUnitOfWork,
     IBankRoutingService bankRoutingService,
     IConfiguration configuration,
     IFeeService feeService
     )
 {
     CoreUnitOfWork     = coreUnitOfWork;
     BankRoutingService = bankRoutingService;
     Configuration      = configuration;
     FeeService         = feeService;
 }
コード例 #23
0
ファイル: UsersController.cs プロジェクト: nminhduc/jarvis
 public UsersController(
     IIdentityService identityService,
     IEnumerable <IUserInfoService> userInfoServices,
     IWorkContext workcontext,
     ICoreUnitOfWork uow,
     IDistributedCache cache)
 {
     _identityService  = identityService;
     _userInfoServices = userInfoServices;
     _workcontext      = workcontext;
     _uow   = uow;
     _cache = cache;
 }
コード例 #24
0
 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;
 }
コード例 #25
0
 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"];
 }
コード例 #26
0
ファイル: AuthMiddlerware.cs プロジェクト: nminhduc/jarvis
        /// <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;
        }
コード例 #27
0
ファイル: TenantsController.cs プロジェクト: nminhduc/jarvis
 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;
 }
コード例 #28
0
        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();
        }
コード例 #29
0
        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();
        }
コード例 #30
0
ファイル: IdentityService.cs プロジェクト: nminhduc/jarvis
        //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;
        }