예제 #1
0
 public AdminsService(IBaseRepository repository, IHasherService hasherService, ILoggingService loggingService, IPermissionGroupAdminService PermissionGroupAdminService)
 {
     this.repository     = repository;
     this.hasherService  = hasherService;
     this.loggingService = loggingService;
     this.PermissionGroupAdminService = PermissionGroupAdminService;
 }
예제 #2
0
        public MainViewModel(IHasherService hasherService, IWatcherService watcherService, IDialogService dialogService, IArgumentService argumentService)
        {
            BrowseCommand  = new DelegateCommand <Window>(_BrowseAction);
            ResetCommand   = new DelegateCommand(_ResetAction);
            CancelCommand  = new DelegateCommand(_CancelAction);
            ComputeCommand = new DelegateCommand(_ComputeAction);

            _hasherService  = hasherService;
            _watcherService = watcherService;
            _dialogService  = dialogService;

            _hasherService.WorkerProgressChanged += _WorkerProgressChanged;
            _hasherService.WorkerRunCompleted    += _WorkerRunCompleted;

            _watcherService.WatcherFileDeleteEvent += _WatcherFileDeleteEvent;
            _watcherService.WatcherFileRenameEvent += _WatcherFileRenameEvent;

            HashName = argumentService.HashName ?? _hasherService.DefaultHasher;
            FilePath = argumentService.FilePath ?? "";

            if (CanCompute && argumentService.ComputeNow)
            {
                _ComputeAction(null);
            }
        }
예제 #3
0
 public JwtAuthService(AzureGalleryContext context, IMapper mapper, IConfiguration configuration, IHasherService hasherService)
 {
     _context       = context;
     _iMapper       = mapper;
     _configuration = configuration;
     _hasherService = hasherService;
 }
예제 #4
0
 public UserService()
 {
     _emailValidatorService = Dependency.GetInstance<IEmailValidatorService>();
     _passwordValidatorService = Dependency.GetInstance<IPasswordValidatorService>();
     _userRepository = Dependency.GetInstance<IUserRepository>();
     _hasherService = Dependency.GetInstance<IHasherService>();
 }
예제 #5
0
 public AccountController(IUserService userService, ISessionService sessionService, IHasherService hasherService, IMapper mapper)
 {
     this.userService    = userService;
     this.sessionService = sessionService;
     this.hasherService  = hasherService;
     this.mapper         = mapper;
 }
예제 #6
0
        private void InitializeHasherService()
        {
            var mockHasherService = new Mock <IHasherService>();

            mockHasherService
            .Setup(x => x.GetHash(It.IsAny <string>()))
            .Returns("encryptedPassword");
            HasherServiceMock = mockHasherService.Object;
        }
        public HasherServiceTests()
        {
            IOptions <HasherSettings> options = Options.Create(new HasherSettings()
            {
                Salt = Convert.ToBase64String(Encoding.ASCII.GetBytes("someBase64string")),
            });

            _hasherService = new HasherService(options);
        }
예제 #8
0
 public AccountController(IMailService mailService, IAdminsService adminsService, ISessionService sessionService, IHasherService hasherService, IMapper mapper, IPermissionsService permissionsService)
 {
     this.adminsService      = adminsService;
     this.sessionService     = sessionService;
     this.hasherService      = hasherService;
     this.mapper             = mapper;
     this.permissionsService = permissionsService;
     this.mailService        = mailService;
 }
예제 #9
0
        public ConveyorBeltChainEngine(IServiceCollection services)
        {
            _servicesProvider = services.BuildServiceProvider();
            _hasherService    = _servicesProvider.GetService <IHasherService>();
            _blocks           = new List <Block>();// TODO: DI
            _logger           = _servicesProvider.GetRequiredService <ILoggerFactory>()
                                .CreateLogger <ConveyorBeltChainEngine>();

            _logger.LogDebug("ConveyorBeltChainEngine created successfully.");
        }
예제 #10
0
 public AdminsController(IAdminsService adminsService, IHasherService hasherService, IWebHostEnvironment hostEnvironment,
                         ISessionService sessionService, ILoggingService loggingService, IMapper mapper)
 {
     this.adminsService   = adminsService;
     this.hasherService   = hasherService;
     this.hostEnvironment = hostEnvironment;
     this.sessionService  = sessionService;
     this.loggingService  = loggingService;
     this.mapper          = mapper;
 }
예제 #11
0
 public AutentificationService(IUnitOfWork unitOfWork, IHasherService hasher, IOptions <AppSettings> appSettings)
 {
     this.unitOfWork = unitOfWork;
     this.hasher     = hasher;
     _appSettings    = appSettings.Value;
 }
예제 #12
0
 public PermissionsGroupService(IBaseRepository repository, IHasherService hasherService, ILoggingService loggingService)
 {
     this.repository     = repository;
     this.loggingService = loggingService;
 }
예제 #13
0
 public LoginCommandHandler(IDbContext context, IHasherService hasherService)
 {
     _context       = context;
     _hasherService = hasherService;
 }
예제 #14
0
        private async Task Seed(IconicFundDbContext context, IWebHostEnvironment _hostingEnvironment, IHasherService hasherService)
        {
            if (!await context.Roles.AnyAsync())
            {
                context.Roles.Add(new Role {
                    Id = Guid.Parse(Constants.MainAdminRoleId), Name = "مدير النظام"
                });
                //context.Roles.Add(new Role { Id = Guid.Parse(Constants.SaftyRoleId), Name = "السلامة" });
                //context.Roles.Add(new Role { Id = Guid.Parse(Constants.LiftsRoleId), Name = "المصاعد" });
                //context.Roles.Add(new Role { Id = Guid.Parse(Constants.EngineeringOfficeRoleId), Name = "المكاتب الهندسية" });

                await context.SaveChangesAsync();
            }

            if (!await context.Admins.AnyAsync())
            {
                context.Admins.Add(new Admin
                {
                    Id           = Guid.Parse(Constants.MainAdminId),
                    FirstName    = "مدير",
                    LastName     = "النظام",
                    MobileNumber = "567123432",
                    Email        = "*****@*****.**",
                    EmplyeeNo    = "1",
                    NationalId   = "1",
                    Password     = hasherService.ComputeSha256Hash("mainadmin"),
                    CanApprove   = true,

                    IsActive            = true,
                    ActivationStartDate = DateTime.Now,
                    ActivationEndDate   = null,

                    Roles = new List <AdminRole> {
                        new AdminRole {
                            RoleId = Guid.Parse(Constants.MainAdminRoleId)
                        }
                    }
                });

                await context.SaveChangesAsync();
            }

            //if (!context.SaftyOffices.Any())
            //{
            //    context.SaftyOffices.Add(new SaftyOffice { Name = "مركز السلامة الميدانية بالمنطقة المركزية " });
            //    context.SaftyOffices.Add(new SaftyOffice { Name = "مركز السلامة الميدانية بالشوقية" });
            //    context.SaftyOffices.Add(new SaftyOffice { Name = "مركز السلامة الميدانية بالعزيزية" });
            //    context.SaftyOffices.Add(new SaftyOffice { Name = "مركز السلامة الميدانية بالمعابدة" });
            //    context.SaftyOffices.Add(new SaftyOffice { Name = "مركز السلامة الميدانية بالشرايع" });

            //    await context.SaveChangesAsync();
            //}

            if (!context.Nationalities.Any() && !context.Cities.Any() && !context.Regions.Any())
            {
                var seedPath             = Path.Combine(_hostingEnvironment.ContentRootPath, "Seed");
                var CitiesJSONtxt        = File.ReadAllText(Path.Combine(seedPath, "Cities.json"));
                var NationalitiesJSONtxt = File.ReadAllText(Path.Combine(seedPath, "Nationalities.json"));
                var RegionsJSONtxt       = File.ReadAllText(Path.Combine(seedPath, "Regions.json"));

                var Cities        = JsonConvert.DeserializeObject <CityViewModels>(CitiesJSONtxt);
                var Nationalities = JsonConvert.DeserializeObject <NationalitiesViewModel>(NationalitiesJSONtxt);
                var Regions       = JsonConvert.DeserializeObject <RegionsViewModel>(RegionsJSONtxt);
                context.Database.OpenConnection();
                try
                {
                    await context.Database.ExecuteSqlRawAsync("SET IDENTITY_INSERT dbo.Cities ON");

                    context.Cities.AddRange(Cities.Cities);
                    await context.SaveChangesAsync();

                    await context.Database.ExecuteSqlRawAsync("SET IDENTITY_INSERT dbo.Cities OFF");


                    await context.Database.ExecuteSqlRawAsync("SET IDENTITY_INSERT dbo.Regions ON");

                    context.Regions.AddRange(Regions.Regions);
                    await context.SaveChangesAsync();

                    await context.Database.ExecuteSqlRawAsync("SET IDENTITY_INSERT dbo.Regions OFF");


                    await context.Database.ExecuteSqlRawAsync("SET IDENTITY_INSERT dbo.Nationalities ON");

                    context.Nationalities.AddRange(Nationalities.Nationalities);
                    await context.SaveChangesAsync();

                    await context.Database.ExecuteSqlRawAsync("SET IDENTITY_INSERT dbo.Nationalities OFF");
                }
                finally
                {
                    context.Database.CloseConnection();
                }

                //context.Cities.AddRange(Cities.Cities);
                //context.Nationalities.AddRange(Nationalities.Nationalities);
                //context.Regions.AddRange(Regions.Regions);

                //await context.SaveChangesAsync();
            }
        }
예제 #15
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IconicFundDbContext context, IHasherService hasherService)
        {
            //app.UseDevExpressControls();
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseRequestLocalization(new RequestLocalizationOptions
            {
                DefaultRequestCulture = new RequestCulture(new CultureInfo("AR")),
                SupportedCultures     = new List <CultureInfo>
                {
                    new CultureInfo("AR")
                },
                SupportedUICultures = new List <CultureInfo>
                {
                    new CultureInfo("AR")
                }
            });

            //===== Initialize and Seed DB =======//
            InitializeDatabase(app);
            Seed(context, env, hasherService).Wait();
            //=====================================//

            //Create needed direcotries for uploaded files
            FoldersConfig.RegisterAll(env);

            app.UseSession();
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(

                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
        }
예제 #16
0
 public HasherNotExistError(IHasherService svc, string value, [CallerMemberName] string propertyName = null)
 {
     HasError     = !svc.HasherExists(value);
     ErrorMessage = "This hasher does not exist.";
     PropertyName = propertyName;
 }
예제 #17
0
 public UserService(IRepository repository, IHasherService hasherService)
 {
     this.repository    = repository;
     this.hasherService = hasherService;
 }
예제 #18
0
 public UserService(IUnitOfWork unitOfWork, IHasherService hasher, IBasketService basketService)
 {
     this.unitOfWork    = unitOfWork;
     this.hasher        = hasher;
     this.basketService = basketService;
 }
 public SeedSampleDataCommandHandler(IDbContext context, IHasherService hasher)
 {
     _context = context;
     _hasher  = hasher;
 }
예제 #20
0
 public HashServiceTests()
 {
     _hasherService = Dependency.GetInstance<IHasherService>();
 }
 public BasicSystemSettingService(IBaseRepository repository, IHasherService hasherService, ILoggingService loggingService)
 {
     this.repository     = repository;
     this.hasherService  = hasherService;
     this.loggingService = loggingService;
 }
 public CookiesAuthenticationService(IUsersRepository usersRepository, IHasherService hasher, IHttpContextAccessor accessor)
 {
     _hasher          = hasher;
     _usersRepository = usersRepository;
     _accessor        = accessor;
 }