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

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

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

            DbInitializer.Initialize(context);
        }
Ejemplo n.º 2
0
        public static void Initialize(GmmContext context)
        {
            context.Database.EnsureCreated();

            if (context.Bands.Any())
            {
                return;
            }

            //TODO read data from excel

            Member one = new Member
            {
                Name = "Ozzy Osbourne"
            };

            context.Members.AddRange(
                one
                );
            context.Bands.AddRange(
                new Band
            {
                Name    = "Black Sabbath",
                Members = new List <Member> {
                    one
                }
            });
            context.SaveChanges();

            //TODO Inital migration als data in db zit
        }
Ejemplo n.º 3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env,
                              GmmContext context, ApplicationDbContext idContext,
                              RoleManager <ApplicationRole> roleManager,
                              UserManager <ApplicationUser> userManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            //app.UseCookiePolicy(); //Removed cookie warning

            app.UseAuthentication();

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

            DbInitializer.Initialize(context);
            try
            {
                UsersInitializer.Initialize(idContext, userManager, roleManager).Wait();
            }
            catch (System.AggregateException ae)
            {
                //SqlException: Invalid object name 'AspNetRoles'
                //Identity tabbellen worden niet aangemaakt bij nieuwe database.
                //Oplossing: Update-Database
            }
        }
Ejemplo n.º 4
0
 public TentsController(GmmContext context)
 {
     _context = context;
 }
Ejemplo n.º 5
0
 public BandsController(GmmContext context)
 {
     _context = context;
 }
Ejemplo n.º 6
0
 public SpecialsController(GmmContext context)
 {
     _context = context;
 }
Ejemplo n.º 7
0
 public ProductieUnitsController(GmmContext context)
 {
     _context = context;
 }
Ejemplo n.º 8
0
 public MembersController(GmmContext context)
 {
     _context = context;
 }
Ejemplo n.º 9
0
 public OptredensController(GmmContext context)
 {
     _context = context;
 }
Ejemplo n.º 10
0
 public ImportController(IHostingEnvironment hostingEnvironment, GmmContext context)
 {
     _hostingEnvironment = hostingEnvironment;
     _context            = context;
 }
Ejemplo n.º 11
0
 public StagesController(GmmContext context)
 {
     _context = context;
 }
Ejemplo n.º 12
0
 public LogisticsController(GmmContext context)
 {
     _context = context;
 }
Ejemplo n.º 13
0
 public FunctionsController(GmmContext context)
 {
     _context = context;
 }
Ejemplo n.º 14
0
        public static void Initialize(GmmContext context)
        {
            context.Database.EnsureCreated();

            if (context.Bands.Any())
            {
                return;
            }

            //TODO read data from excel

            Function tourmanager = new Function
            {
                Name = "TourManager"
            }; Function prodmanager = new Function

            {
                Name = "Production Manager"
            }; Function begeleider = new Function
            {
                Name = "Artiestenbegeleider"
            };

            var members = new List <Member> {
                new Member
                {
                    Name     = "Thomas Reitz",
                    Function = tourmanager
                },
                new Member
                {
                    Name     = "George Reeves",
                    Function = prodmanager
                },
                new Member
                {
                    Name     = "Liesbeth Huber",
                    Function = begeleider
                },
                new Member
                {
                    Name     = "Nele Knockaert",
                    Function = begeleider
                }
            };

            Band sabbath = new Band
            {
                Name        = "Grey Sabbath",
                Members     = members,
                GroepsColor = 1
            };
            Stage mainstage = new Stage {
                Name = "Mainstage 1"
            };
            Tent maintent = new Tent {
                Name = "MainTENT 1"
            };

            Kleedkamer[] kleedkamers = new Kleedkamer[] {
                new Kleedkamer {
                    Name = "1"
                },
                new Kleedkamer {
                    Name = "6"
                }
            };
            ProductieUnit[] prodUnit = new ProductieUnit[] {
                new ProductieUnit {
                    Name = "P1"
                },
                new ProductieUnit {
                    Name = "P2"
                }
            };
            Voorziening voorziening = new Voorziening
            {
                Wasserij    = 1,
                Coolersband = 3,
                Comments    = "All food clearly labeled/nJuicer (x1)"
            };
            Catering catering = new Catering
            {
                AfterShow = true
            };
            Logistic logistic = new Logistic
            {
                Verlengkabels = true,
                Voltage110    = 6,
                Comments      = "110V elke KK/nQuick change on stage"
            };
            Special special = new Special
            {
                HdWitGr   = 100,
                HdZwartKl = 30,
                Runner    = 1,
                Arts      = 1,
                Zuurstof  = 2,
                Comments  = "Zuurstof + masker (x2)"
            };

            Optreden sabbOptreden = new Optreden
            {
                Band        = sabbath,
                Catering    = catering,
                Date        = DateTime.Now,
                Hours       = "None",
                Logistic    = logistic,
                Special     = special,
                Stage       = mainstage,
                Tent        = maintent,
                Voorziening = voorziening
            };

            BandKleedkamers[] sabbKleedkamer = new BandKleedkamers[kleedkamers.Length];
            for (int i = 0; i < kleedkamers.Length; i++)
            {
                sabbKleedkamer[i] = new BandKleedkamers
                {
                    Uurdatum   = DateTime.Now,
                    Kleedkamer = kleedkamers[i],
                    Optreden   = sabbOptreden
                };
            }
            ;
            BandProductieUnits[] sabbProd = new BandProductieUnits[prodUnit.Length];
            for (int i = 0; i < prodUnit.Length; i++)
            {
                sabbProd[i] = new BandProductieUnits
                {
                    Uurdatum      = DateTime.Now,
                    ProductieUnit = prodUnit[i],
                    Optreden      = sabbOptreden
                };
            }
            ;

            context.Members.AddRange(members);
            context.Bands.Add(sabbath);
            context.Stages.Add(mainstage);
            context.Tents.Add(maintent);

            context.Kleedkamers.AddRange(kleedkamers);
            context.ProductieUnits.AddRange(prodUnit);
            context.BandKleedkamers.AddRange(sabbKleedkamer);
            context.BandProductieUnits.AddRange(sabbProd);

            context.Voorzienings.Add(voorziening);
            context.Caterings.Add(catering);
            context.Logistics.Add(logistic);
            context.Specials.Add(special);
            context.Optredens.Add(sabbOptreden);

            context.SaveChanges();
        }
Ejemplo n.º 15
0
 public CateringsController(GmmContext context)
 {
     _context = context;
 }
Ejemplo n.º 16
0
 public VoorzieningsController(GmmContext context)
 {
     _context = context;
 }
Ejemplo n.º 17
0
 public KleedkamersController(GmmContext context)
 {
     _context = context;
 }