Exemple #1
0
        private void AddTeams(FloorballBaseCtx ctx)
        {
            ctx.Teams.Add(new Team {
                Id = 1, TeamId = 1, Name = "FC Budapest", Country = CountriesEnum.HU, Coach = "Gipsz Jakab", Year = new DateTime(2016, 1, 1), Gender = GenderEnum.Men, LeagueId = 1, StadiumId = 1, Players = AddEntitiesById(ctx.Players, new List <int> {
                    1, 2, 3
                })
            });
            ctx.Teams.Add(new Team {
                Id = 2, TeamId = 1, Name = "FC Budapest", Country = CountriesEnum.HU, Coach = "Gipsz Jakab", Year = new DateTime(2016, 1, 1), Gender = GenderEnum.Men, LeagueId = 2, StadiumId = 1, Players = AddEntitiesById(ctx.Players, new List <int> {
                    1, 2, 3
                })
            });
            ctx.Teams.Add(new Team {
                Id = 3, TeamId = 2, Name = "Innebandy Club Falun", Country = CountriesEnum.SE, Coach = "Jutti Nilson", Year = new DateTime(2017, 1, 1), Gender = GenderEnum.Men, LeagueId = 3, StadiumId = 2
            });
            ctx.Teams.Add(new Team {
                Id = 4, TeamId = 3, Name = "Szegedi Farkasok", Country = CountriesEnum.HU, Coach = "Vadász János", Year = new DateTime(2016, 1, 1), Gender = GenderEnum.Men, LeagueId = 1, StadiumId = 3, Players = AddEntitiesById(ctx.Players, new List <int> {
                    4, 5
                })
            });
            ctx.Teams.Add(new Team {
                Id = 5, TeamId = 4, Name = "Floorball Ladies", Country = CountriesEnum.SE, Coach = "Kili Jilli", Year = new DateTime(2017, 1, 1), Gender = GenderEnum.Women, LeagueId = 4, StadiumId = 2
            });

            ctx.SaveChanges();
        }
        private void RemoveStatisticsForPlayerInTeam(Player player, Team team, FloorballBaseCtx ctx)
        {
            var statisctics = ctx.Statistics.Where(s => s.Player.Id == player.Id && s.Team.Id == team.Id).ToList();

            foreach (var s in statisctics)
            {
                ctx.Statistics.Remove(s);
            }
        }
Exemple #3
0
        protected void Init(FloorballBaseCtx ctx)
        {
            AddRoles(ctx);
            AddSuperAdmin(ctx);
            AddEventMessages(ctx);

            AddClients(ctx);

            ctx.SaveChanges();
        }
Exemple #4
0
        private void AddRoles(FloorballBaseCtx ctx)
        {
            foreach (var role in Roles)
            {
                ctx.Roles.Add(new IdentityRole {
                    Name = role.ToString()
                });
            }

            ctx.SaveChanges();
        }
Exemple #5
0
        private void AddClients(FloorballBaseCtx ctx)
        {
            //var ManagerSecret = Util.PasswordHasher.GetHash("ManagerApp");
            //var ConsumerSecret = Util.PasswordHasher.GetHash("ConsumerApp");

            ctx.Clients.Add(new Client {
                Id = "ManagerApp", AllowedOrigin = "*", ApplicationType = ApplicationType.Manager, IsActive = true, Name = "Manager Application", RefreshTokenLifeTime = 10, Secret = "gMGbgbwXK+ntUR+0kCfnIvmuMAZsu1+a3Eod8HN05kI="
            });
            ctx.Clients.Add(new Client {
                Id = "ConsumerApp", AllowedOrigin = "*", ApplicationType = ApplicationType.Consumer, IsActive = true, Name = "Consumer Application", RefreshTokenLifeTime = 10, Secret = "t6wM7qs9XUcXCCsgEy18NcCQgiZ7NmgB1o/4p9+Mcuo="
            });
        }
Exemple #6
0
        protected void Delete(FloorballBaseCtx ctx)
        {
            foreach (var table in tables)
            {
                ctx.Database.ExecuteSqlCommand("DELETE FROM [dbo].[" + table + "]");
                ctx.Database.ExecuteSqlCommand("DBCC CHECKIDENT('[dbo].[" + table + "]', RESEED, 0)");
            }

            foreach (var table in tablesWithoutPrimaryKey)
            {
                ctx.Database.ExecuteSqlCommand("DELETE FROM " + table);
            }
        }
Exemple #7
0
        private void AddStadiums(FloorballBaseCtx ctx)
        {
            ctx.Stadiums.Add(new Stadium {
                Id = 1, Name = "Arena Budapest", Address = "Valahol Street 5.", PostCode = "1111", City = "Budapest", Country = "Magyarország"
            });
            ctx.Stadiums.Add(new Stadium {
                Id = 2, Name = "Falun Sport Hall", Address = "Valahol Street 50.", City = "Falun", Country = "Sweden", PostCode = "1111"
            });
            ctx.Stadiums.Add(new Stadium {
                Id = 3, Name = "University Szeged", Address = "University Street 15.", City = "Szeged", PostCode = "1234", Country = "Magyarország"
            });

            ctx.SaveChanges();
        }
Exemple #8
0
        private void AddSuperAdmin(FloorballBaseCtx ctx)
        {
            //var pw = PasswordHasher.HashPassword("Initial1");

            ctx.Users.Add(new IdentityUser {
                UserName = SuperAdminUserName, PasswordHash = "AA/MTtdH588Of/vRRnB9/gC73Gt/XTQx+5TVtm85Tf2XDjyXrP/fuIt41uoPm55yKw=="
            });

            ctx.SaveChanges();

            var userManager = new UserManager <IdentityUser>(new UserStore <IdentityUser>(ctx));

            userManager.AddToRole(userManager.FindByName(SuperAdminUserName).Id, Role.SuperAdmin.ToString());
        }
        private void AddStatisticsForPlayerInTeam(Player player, Team team, FloorballBaseCtx ctx)
        {
            foreach (var type in Enum.GetValues(typeof(StatType)))
            {
                Statistic s = new Statistic();
                s.Type   = (StatType)type;
                s.Number = 0;
                s.Team   = team;
                s.Player = player;

                ctx.Statistics.Add(s);

                //AddUpdate(db, "addStat", DateTime.Now, player.RegNum, team.Id);
            }
        }
Exemple #10
0
        public void Seed(FloorballBaseCtx ctx)
        {
            Delete(ctx);

            Init(ctx);

            AddStadiums(ctx);
            AddReferees(ctx);
            AddLeagues(ctx);
            AddPlayers(ctx);
            AddTeams(ctx);
            AddMatches(ctx);
            AddStatistics(ctx);
            AddEvents(ctx);
        }
Exemple #11
0
        private void AddLeagues(FloorballBaseCtx ctx)
        {
            ctx.Leagues.Add(new League {
                Id = 1, Name = "Salming League", Country = CountriesEnum.HU, Type = LeagueTypeEnum.League, Rounds = 10, Gender = GenderEnum.Men, Year = new DateTime(2016, 1, 1), Class = ClassEnum.FirstClass
            });
            ctx.Leagues.Add(new League {
                Id = 2, Name = "Unihoc Cup", Country = CountriesEnum.HU, Type = LeagueTypeEnum.Cup, Rounds = 5, Gender = GenderEnum.Men, Year = new DateTime(2016, 1, 1), Class = ClassEnum.All
            });
            ctx.Leagues.Add(new League {
                Id = 3, Name = "Excel Elit League", Country = CountriesEnum.SE, Type = LeagueTypeEnum.League, Rounds = 8, Gender = GenderEnum.Men, Year = new DateTime(2017, 1, 1), Class = ClassEnum.FirstClass
            });
            ctx.Leagues.Add(new League {
                Id = 4, Name = "Excel Elit League Women", Country = CountriesEnum.SE, Type = LeagueTypeEnum.League, Rounds = 8, Gender = GenderEnum.Women, Year = new DateTime(2017, 1, 1), Class = ClassEnum.FirstClass
            });

            ctx.SaveChanges();
        }
Exemple #12
0
        private void AddEvents(FloorballBaseCtx ctx)
        {
            ctx.Events.Add(new Event {
                Id = 1, EventMessageId = 51, MatchId = 1, PlayerId = 1, TeamId = 1, Time = new TimeSpan(00, 10, 10), Type = EventType.G
            });
            ctx.Events.Add(new Event {
                Id = 2, EventMessageId = 52, MatchId = 1, PlayerId = 2, TeamId = 1, Time = new TimeSpan(00, 10, 10), Type = EventType.A
            });
            ctx.Events.Add(new Event {
                Id = 3, EventMessageId = 10, MatchId = 1, PlayerId = 4, TeamId = 4, Time = new TimeSpan(00, 22, 40), Type = EventType.G
            });
            ctx.Events.Add(new Event {
                Id = 4, EventMessageId = 47, MatchId = 1, PlayerId = 5, TeamId = 4, Time = new TimeSpan(00, 51, 00), Type = EventType.P2
            });

            ctx.SaveChanges();
        }
Exemple #13
0
        private void AddMatches(FloorballBaseCtx ctx)
        {
            ctx.Matches.Add(new Match {
                Id = 1, LeagueId = 1, HomeTeamId = 1, AwayTeamId = 4, Date = new DateTime(2017, 04, 04), StadiumId = 1, Time = new TimeSpan(18, 00, 00), Round = 1, Players = AddEntitiesById(ctx.Players, new List <int> {
                    1, 2, 3, 4, 5
                }), Referees = AddEntitiesById(ctx.Referees, new List <int> {
                    1, 2
                })
            });
            ctx.Matches.Add(new Match {
                Id = 2, LeagueId = 1, HomeTeamId = 4, AwayTeamId = 1, Date = new DateTime(2017, 04, 012), StadiumId = 3, Time = new TimeSpan(20, 00, 00), Round = 1, Players = AddEntitiesById(ctx.Players, new List <int> {
                    1, 2, 3, 4, 5
                }), Referees = AddEntitiesById(ctx.Referees, new List <int> {
                    3, 4
                }),
            });

            ctx.SaveChanges();
        }
Exemple #14
0
        private void AddReferees(FloorballBaseCtx ctx)
        {
            ctx.Referees.Add(new Referee {
                Id = 1, Name = "Referee 1", Number = 1, BirthDate = new DateTime(1970, 6, 6)
            });
            ctx.Referees.Add(new Referee {
                Id = 2, Name = "Referee 2", Number = 1, BirthDate = new DateTime(1980, 6, 6)
            });
            ctx.Referees.Add(new Referee {
                Id = 3, Name = "Referee 3", Number = 1, BirthDate = new DateTime(1977, 6, 10)
            });
            ctx.Referees.Add(new Referee {
                Id = 4, Name = "Referee 4", Number = 1, BirthDate = new DateTime(1990, 11, 2)
            });
            ctx.Referees.Add(new Referee {
                Id = 5, Name = "Referee 5", BirthDate = new DateTime(1970, 6, 6)
            });

            ctx.SaveChanges();
        }
Exemple #15
0
        private void AddPlayers(FloorballBaseCtx ctx)
        {
            ctx.Players.Add(new Player {
                FirstName = "Best", LastName = "Player", Id = 1, BirthDate = new DateTime(1990, 10, 30), Number = 10,
            });
            ctx.Players.Add(new Player {
                FirstName = "Worst", LastName = "Player", Id = 2, BirthDate = new DateTime(1980, 11, 3), Number = 8
            });
            ctx.Players.Add(new Player {
                FirstName = "Good", LastName = "Player", Id = 3, BirthDate = new DateTime(1997, 1, 21), Number = 9
            });
            ctx.Players.Add(new Player {
                FirstName = "Another Good", LastName = "Player", Id = 4, BirthDate = new DateTime(1997, 3, 21), Number = 19
            });
            ctx.Players.Add(new Player {
                FirstName = "Noname", LastName = "Player", Id = 5, BirthDate = new DateTime(1967, 1, 1), Number = 29
            });

            ctx.SaveChanges();
        }
Exemple #16
0
 private void AddEventMessages(FloorballBaseCtx ctx)
 {
     ctx.EventMessages.Add(new EventMessage {
         Id = 1, Code = 201, Message = "Szabálytalan ütés"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 2, Code = 202, Message = "Ellenfél ütőjének le-/visszafogása"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 3, Code = 203, Message = "Ellenfél ütőjének fel-/megemelése"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 4, Code = 204, Message = "Szabálytalan rugás (ellenfél vagy ellenfél ütője)"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 5, Code = 205, Message = "Magas láb (derék felett)"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 6, Code = 206, Message = "Magasütő (Ütője bármely részével derék felett)"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 7, Code = 207, Message = "Szabálytalan lökés"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 8, Code = 208, Message = "Durvaság (lerántás, gáncsolás)"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 9, Code = 209, Message = "Fogás"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 10, Code = 210, Message = "Akadályozás, feltartás"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 11, Code = 211, Message = "Szabálytalan távolság"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 12, Code = 212, Message = "Fekvőjáték"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 13, Code = 213, Message = "Kezezés"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 14, Code = 214, Message = "Fejelés"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 15, Code = 215, Message = "Szabálytalan csere"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 16, Code = 216, Message = "Túl sok játékos a pályán"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 17, Code = 217, Message = "Ismétlődő szabálytalanságok"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 18, Code = 218, Message = "Játék késleltetése"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 19, Code = 219, Message = "Reklamálás"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 20, Code = 220, Message = "Engedély nálküli játéktérre lépés"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 21, Code = 221, Message = "Szabálytalan felszerelés (személyes felsz., ruházat, sisak"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 22, Code = 222, Message = "Csapatkapitány ütő mérését kéri, de szabályos"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 23, Code = 223, Message = "Szabálytalan számozás"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 24, Code = 224, Message = "Ütő nélküli játék"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 25, Code = 225, Message = "Törött ütő eltávolításának hiánya a pályáról"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 26, Code = 501, Message = "Erőszakos ütés"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 27, Code = 502, Message = "Veszélyes játék"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 28, Code = 503, Message = "Akasztás"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 29, Code = 504, Message = "Játékos eldobja az ütőjét vagy felszerelését, eldobja magát"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 30, Code = 504, Message = "Játékos ellenfelét veszályes módon támadja"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 31, Code = 504, Message = "Játékos ellenfelét palánknak vagy a kapunak löki"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 32, Code = 505, Message = "Játékos sorozatosan 2 perces kiállításhoz vezető szabálytalanságokat követ el"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 33, Code = 301, Message = "Végleges kiállítás I. - technikai"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 34, Code = 301, Message = "Végleges kiállítás I. - játékos mádosszor kap 2+10-et"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 35, Code = 301, Message = "Végleges kiállítás I. - ütő szándékos eltörése"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 36, Code = 301, Message = "Végleges kiállítás I. - súlyosan durva szabálytalanság"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 37, Code = 302, Message = "Végleges kiállítás II. - dulakodás"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 38, Code = 302, Message = "Végleges kiállítás II. - játék szabotálása"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 39, Code = 302, Message = "Végleges kiállítás II. - csapatvezetés másodszor kap 2+10-et"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 40, Code = 302, Message = "Végleges kiállítás II. - játékos másodszor kap 5 percet"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 41, Code = 302, Message = "Végleges kiállítás II. - megerősített vagy mérés előtt javított ütő"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 42, Code = 303, Message = "Végleges kiállítás III. - verekedés"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 43, Code = 303, Message = "Végleges kiállítás III. - brutális szabálytalanság"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 44, Code = 303, Message = "Végleges kiállítás III. - gyalázkodó beszéd"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 45, Code = 401, Message = "Időkérés"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 46, Code = 402, Message = "Büntetőlövés"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 47, Code = 601, Message = "Emberelőnyös"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 48, Code = 602, Message = "Emberhátrányos"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 49, Code = 603, Message = "Üreskapus"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 50, Code = 604, Message = "Büntetőből szerzett"
     });
     ctx.EventMessages.Add(new EventMessage {
         Id = 51, Code = 606, Message = "Normál"
     });
     ctx.EventMessages.Add(new EventMessage {
         Code = -1, Message = "Gólpassz"
     });
 }
Exemple #17
0
 public void Seed(FloorballBaseCtx ctx)
 {
 }
Exemple #18
0
 private void AddStatistics(FloorballBaseCtx ctx)
 {
 }