Ejemplo n.º 1
0
        private void SeedUsers(UserManager <AppUser> userManager)
        {
            var superAdminSettings = new SuperAdminSettings();

            _configuration.GetSection(nameof(SuperAdminSettings)).Bind(superAdminSettings);
            UsersSeed.Seed(userManager, superAdminSettings);
        }
Ejemplo n.º 2
0
        // Default values
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            DestinationsSeed destinationsSeed = new DestinationsSeed();

            modelBuilder.Entity <DestinationInfo>().HasData(destinationsSeed.Items);

            UsersSeed usersSeed = new UsersSeed();

            modelBuilder.Entity <UserInfo>().HasData(usersSeed.Items);
        }
Ejemplo n.º 3
0
        private static async Task SeedIdentity(IHost host)
        {
            using var serviceScope = host.Services.CreateScope();

            var roleManager = serviceScope.ServiceProvider
                              .GetRequiredService <RoleManager <IdentityRole> >();

            var userManager = serviceScope.ServiceProvider
                              .GetRequiredService <UserManager <IdentityUser> >();

            await RolesSeed.Seed(roleManager);

            await UsersSeed.Seed(userManager);
        }
Ejemplo n.º 4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            //if (env.IsDevelopment())
            //{
            app.UseDeveloperExceptionPage();
            app.UseBrowserLink();
            //}
            //else
            //{
            //    app.UseExceptionHandler("/Home/Error");
            //}

            app.UseStaticFiles();

            app.UseAuthentication();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            IServiceScopeFactory scopeFactory = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>();

            using (IServiceScope scope = scopeFactory.CreateScope())
            {
                var profilesRepository = scope.ServiceProvider.GetRequiredService <IProfilesRepository>();
                ProfilesSeed.Seed(profilesRepository);

                var userManager = scope.ServiceProvider.GetRequiredService <UserManager <ApplicationUser> >();
                var roleManager = scope.ServiceProvider.GetRequiredService <RoleManager <IdentityRole> >();

                var usersSeed = new UsersSeed(profilesRepository);
                usersSeed.Seed(userManager).Wait();

                RolesSeed.Seed(roleManager).Wait();
                UserRolesSeed.Seed(userManager).Wait();
            }
        }
Ejemplo n.º 5
0
        private void UsersForm_Load(object sender, EventArgs e)
        {
            gcUsersData.DataSource = UsersSeed.SeedList();

            parent.ChangeVisibility_ActionListRibbonGroup(false);

            parent.ChangeEnableOption_bbMarkAsSentInvoice(false);
            parent.ChangeEnableOption_bbPayInvoice(false);
            parent.ChangeEnableOption_bbStornoInvoice(false);
            parent.ChangeEnableOption_bbCancelInvoice(false);
            parent.ChangeEnableOption_bbEditDataInvoice(false);
            parent.ChangeEnableOption_LoginAsUser(false);

            parent.ChangeEnableOption_bbOpenClientInvoice(false);
            parent.ChangeEnableOption_bbAnnounceInvoice(false);

            parent.ChangeEnableOption_bbCancelCommand(false);
            parent.ChangeEnableOption_bbSaveCommand(false);
            parent.ChangeEnableOption_bbCreateShipperCommand(false);

            parent.ChangeEnableOption_Filter(false);
        }
        /// <inheritdoc />
        protected override async void Seed(ApplicationDbContext context)
        {
            context.Campuses.AddOrUpdate(CampusesSeed.ToArray());
            await context.SaveChangesAsync();

            context.Countries.AddOrUpdate(CountriesSeed.ToArray());
            await context.SaveChangesAsync();

            context.Modules.AddOrUpdate(ModulesSeed.ToArray());
            await context.SaveChangesAsync();

            context.Roles.AddOrUpdate(RolesSeed.ToArray());
            await context.SaveChangesAsync();

            context.Runs.AddOrUpdate(RunsSeed.ToArray());
            await context.SaveChangesAsync();

            context.Assignments.AddOrUpdate(AssignmentsSeed.ToArray());
            await context.SaveChangesAsync();

            context.Books.AddOrUpdate(BooksSeed.ToArray());
            await context.SaveChangesAsync();

            context.Courses.AddOrUpdate(CoursesSeed.ToArray());
            await context.SaveChangesAsync();

            context.CourseModules.AddOrUpdate(CourseModulesSeed.ToArray());
            await context.SaveChangesAsync();

            context.Users.AddOrUpdate(UsersSeed.ToArray());
            await context.SaveChangesAsync();

            context.UserRoles.AddOrUpdate(UserRolesSeed.ToArray());
            await context.SaveChangesAsync();

            context.Results.AddOrUpdate(ResultsSeed.ToArray());
            await context.SaveChangesAsync();

            context.Rentals.AddOrUpdate(RentalsSeed.ToArray());
            await context.SaveChangesAsync();

            context.Enrolments.AddOrUpdate(EnrolmentsSeed.ToArray());
            await context.SaveChangesAsync();

            context.Rooms.AddOrUpdate(RoomsSeed.ToArray());
            await context.SaveChangesAsync();

            context.Lectures.AddOrUpdate(LecturesSeed.ToArray());
            await context.SaveChangesAsync();

            context.Halls.AddOrUpdate(HallsSeed.ToArray());
            await context.SaveChangesAsync();

            context.Libraries.AddOrUpdate(LibrariesSeed.ToArray());
            await context.SaveChangesAsync();

            context.LibraryBooks.AddOrUpdate(LibraryBooksSeed.ToArray());
            await context.SaveChangesAsync();

            context.Graduations.AddOrUpdate(GraduationsSeed.ToArray());
            await context.SaveChangesAsync();
        }
Ejemplo n.º 7
0
 /**
  * USERS
  */
 public void SeedUsers()
 {
     Users = UsersSeed.Seed();
 }