public JsonDotNetResult Create(CompetitionCreateCommand command) { return ExecuteInExplicitTransaction( action: () => { var competition = new Competition(); competition.Update(command); RavenSession.Store(competition); RavenSession.SaveChanges(); var scheduleCreateCommand = new ScheduleCreateCommand { CompetitionId = competition.Id, Days = competition.Days }; scheduleCreateCommand.CopyCommandPropertiesFrom(command); var schedule = new Schedule(); schedule.Update(scheduleCreateCommand); RavenSession.Store(schedule); RavenSession.SaveChanges(); var url = Url.Action("Details", "Competition", new {id = competition.Id.ForMvc()}); return new JsonDotNetResult(url); }); }
public Match CreateMatch(DateTime matchDate, TimeSpan time, Venue venue, CompetitionMatchType matchType, Competition competition, Team homeTeam, Team awayTeam) { if (homeTeam.GetType() == awayTeam.GetType()) { Match match = new Match(); match.MatchDate = matchDate; match.MatchTime = time; match.Venue = venue; match.CompetitionMatchType = matchType; match.Competition = competition; match.HomeTeam = homeTeam; match.AwayTeam = awayTeam; context.Matches.Add(match); context.SaveChanges(); return match; } else { return null; } }
public void Insert(string Name, string Platforms, DateTime Start, DateTime Finish) { // insert object Competition c = new Competition(Start, Finish, Name, Platforms); settings.AddCompetition(c.ToSCompetition()); settings.FireSettingsChanged(); }
public void Setup() { var sqlDatabaseMigrator = new SqlDatabaseMigrator(); sqlDatabaseMigrator.MigrateToLatest(ConfigurationManager.ConnectionStrings["WinShooterConnection"].ConnectionString); using (var databaseSession = NHibernateHelper.OpenSession()) { this.testCompetition = (from competition in databaseSession.Query<Competition>() where competition.Name == CompetitionName select competition).FirstOrDefault(); if (this.testCompetition == null) { // No test competition found this.testCompetition = new Competition { CompetitionType = CompetitionType.Field, Name = CompetitionName, StartDate = DateTime.Now }; using (var transaction = databaseSession.BeginTransaction()) { databaseSession.Save(this.testCompetition); transaction.Commit(); } } } }
public SerializedCompetition(Competition x, Uri Prefix, UriTemplate CompetitionTemplate, UriTemplate CompetitionResultTemplate) { ID = x.CompetitionID; Title = x.Title; Venue = x.Venue; ReferenceURI = CompetitionTemplate.BindByPosition(Prefix, ID.ToString()); CompetitionResultsURI = CompetitionResultTemplate.BindByPosition(Prefix, ID.ToString()); }
public Cup Build() { if (competition == null) { competition = A.NationalLeague.InWorld(A.World.Build()).Build(); } return new Cup(competition, "Test", 1, DayOfWeek.Saturday, 2, stages); }
public void WriteAndReadCompetitions() { var tempName = Guid.NewGuid().ToString(); using (var databaseSession = NHibernateHelper.OpenSession()) { var competitions = from competition in databaseSession.Query<Competition>() where competition.Name == tempName select competition; Assert.IsNotNull(competitions); Assert.AreEqual(0, competitions.Count()); var toAdd = new Competition { Name = tempName, CompetitionType = CompetitionType.Field, IsPublic = true, StartDate = DateTime.Now, UseNorwegianCount = false }; using (var transaction = databaseSession.BeginTransaction()) { databaseSession.Save(toAdd); transaction.Commit(); } } using (var databaseSession = NHibernateHelper.OpenSession()) { var competitions = from competition in databaseSession.Query<Competition>() where competition.Name == tempName select competition; Assert.IsNotNull(competitions); Assert.AreEqual(1, competitions.Count()); using (var transaction = databaseSession.BeginTransaction()) { databaseSession.Delete(competitions.ToArray()[0]); transaction.Commit(); } } using (var databaseSession = NHibernateHelper.OpenSession()) { var competitions = from competition in databaseSession.Query<Competition>() where competition.Name == tempName select competition; Assert.IsNotNull(competitions); Assert.AreEqual(0, competitions.Count()); } }
public PlayerCompetition(Competition competition, int clubId, int uniqueIndex, string frenoyLink, string ranking, int position, int rankingIndex, int rankingValue) { Competition = competition; ClubId = clubId; FrenoyLink = frenoyLink; Ranking = ranking; Position = position; UniqueIndex = uniqueIndex; RankingIndex = rankingIndex; RankingValue = rankingValue; }
/// <summary> /// Picks the winner. /// </summary> /// <param name="competition">The competition.</param> public override void PickWinner(Competition competition) { if (competition.ClosingDateHasPassed) { if (competition.HasCorrectEntrants) competition.Winner = competition.CorrectEntrants.SelectRandom(); DomainEvents.Raise(new WinnerSelectedEvent(competition)); competition.SetCompetitionState(new ClosedState()); } }
//public CompetitionVM() //{ // Date = new DateTime(2015, 10, 03, 14, 0, 0); //} public CompetitionVM(Competition comp) { this.comp = comp; Team[] teams = comp.Teams.ToArray(); if (teams.Length >= 2) { TeamOne = new TeamVM(teams[0]); TeamTwo = new TeamVM(teams[1]); } }
public Competition CreateCompetition(string name, DateTime startDate, DateTime endDate, County county) { Competition c = new Competition(); c.Name = name; c.StartDate = startDate.Date; c.EndDate = endDate.Date; c.County = county; context.Competitions.Add(c); context.SaveChanges(); return c; }
public void Create(string CreaotrId, int TrackId, CompetitionType type, bool IsPublic, int lapsCount, DateTime startDateTime, DateTime endDateTime) { var competition = new Competition { TrackId = TrackId, Type = type, IsPublic = IsPublic, LapsCount = lapsCount, StartDateTime = startDateTime, EndDateTime = endDateTime }; this.competitions.Add(competition); this.competitions.Save(); }
public CompetitionModel(Competition data) { this.ID = data.ID; this.CategoryId = data.ID; this.Start = data.Start; this.End = data.End; this.Duration = data.Duration; this.Name = data.Name; this.Description = data.Description; var problems = DataHelper.GetTasks(this.ID); this.SelectedProblems = problems.Select(x => x.ID).ToArray(); this.ProblemList = GetProblems(this.SelectedProblems); }
public static Race getTestRace() { Competition comp = new Competition(); comp.Location = "Birrfeld"; Race r = new Race(); r.Date = DateTime.Now; r.Name = "Schweizermeisterschaft"; string localPath = System.IO.Directory.GetCurrentDirectory(); Parcours p = new Parcours(localPath + @"\Tests\testparcours2.dxf"); r.ParcoursCollection.Add(p); r.TargetFlightDuration = new TimeSpan(0); Competitor comp = new Competitor(); comp.AcCallsign = "gibb"; comp.Country = "Switzerland"; comp.PilotFirstName = "Quack"; comp.PilotName = "Crashpilot"; comp.NavigatorFirstName = "Christopher"; comp.NavigatorName = "Columbus"; r.Competitors.Add(comp); CompetitorGroup group = new CompetitorGroup(); group.Competitors.Add(comp); r.CompetitorGroups.Add(group); Flight f = new Flight(localPath + @"\Tests\Track1_c172.GAC", p.Routes[0], p); f.CompetitorGroup = group; f.Competitor = comp; r.Flights = new FlightCollection(); r.Flights.Add(f); //r.ImportFlight(group, comp, localPath + @"\Tests\Track1_c172.GAC"); //Flight f = r.Flights.GetFlightByGroupAndCompetitorId(group.Id, comp.Id); Map m = new Map(new Bitmap(Image.FromFile(localPath + @"\Tests\635320_251980_668600_230020.jpg")), new GpsPoint(251980, 635320, GpsPointFormatImport.Swiss), new GpsPoint(230020, 668600, GpsPointFormatImport.Swiss)); r.Map = m; //r.SetMap(@"..\..\635320_251980_668600_230020.jpg"); return r; }
public Competition DeleteCompetition(Competition comp) { Competition cmp = context.Competitions .Where(c => c == comp) .FirstOrDefault(); if (cmp != null) { context.Competitions.Remove(cmp); context.SaveChanges(); return cmp; } else { return null; } }
public CompetitionDataIndexViewModel(Schedule schedule , Competition competition , IEnumerable<Level> levels , IEnumerable<Division> divisions , IEnumerable<Gym> gyms , IEnumerable<Registration> registrations , IEnumerable<Performance> performances ) { Schedule = schedule; Competition = competition; Levels = levels; Divisions = divisions; Gyms = gyms; Registrations = registrations; Performances = performances; ScoringMap = new ScoringMap(); }
public int AddCompetition(int compClass, int compGroup, string userID) { // Temp solution to bug: Competition ID doens't match teamID Competition compo = new Competition { ID = (from c in db.Competitions select c).Count(), Class = compClass, Group = compGroup, UserID = userID }; if(compo.ID == 0) { compo.ID = 1; } db.Competitions.Add(compo); int compID = db.SaveChanges(); Competition comp = (from c in db.Competitions where c.Group == compo.Group && c.Class == compo.Class select c).FirstOrDefault(); return comp.ID; }
private ICollection<DivisionRanking> GetFrenoyRanking(TtcDbContext dbContext, Competition competition, int divisionId) { var key = new TeamRankingKey(competition, divisionId); if (RankingCache.ContainsKey(key)) { return RankingCache[key]; } var frenoy = new FrenoyTeamsApi(dbContext, competition); var ranking = frenoy.GetTeamRankings(divisionId); if (!RankingCache.ContainsKey(key)) { lock (CacheLock) { if (!RankingCache.ContainsKey(key)) { RankingCache.Add(key, ranking); } } } return ranking; }
public FrenoyApiBase(ITtcDbContext ttcDbContext, Competition comp) { _db = ttcDbContext; bool isVttl = comp == Competition.Vttl; _settings = isVttl ? FrenoySettings.VttlSettings : FrenoySettings.SportaSettings; _isVttl = isVttl; if (isVttl) { _frenoy = new FrenoyVttl.TabTAPI_PortTypeClient(); _thuisClubId = _db.Clubs.Single(x => x.CodeVttl == _settings.FrenoyClub).Id; } else { // Sporta _thuisClubId = _db.Clubs.Single(x => x.CodeSporta == _settings.FrenoyClub).Id; var binding = new BasicHttpBinding("TabTAPI_Binding"); binding.Security.Mode = BasicHttpSecurityMode.None; var endpoint = new EndpointAddress(FrenoySportaEndpoint); _frenoy = new TabTAPI_PortTypeClient(binding, endpoint); } }
public SchedulingEditViewModel(Competition competition) { Competition = competition; }
public int updateCompetitionInDatabase(Competition cmpt, string CompetitionDate) { SqlConnection con; SqlCommand cmd; try { con = connect("DefaultConnection"); // create the connection } catch (Exception ex) { // write to log lf.Main("Competition", ex.Message); return 0; } String cStr = BulidCompetitionInDatabase(cmpt, CompetitionDate); cmd = CreateCommand(cStr, con); // create the command try { int numEffected = cmd.ExecuteNonQuery(); // execute the command return numEffected; } finally { if (con != null) { // close the db connection con.Close(); } } }
/// ----------------------------------------------------------------------------- /// <summary> /// Page_Load runs when the control is loaded /// </summary> /// <remarks> /// </remarks> /// <history> /// </history> /// ----------------------------------------------------------------------------- protected void Page_Load(System.Object sender, System.EventArgs e) { base.Page_Load(sender, e); try { ServiceReference service = new ServiceReference("~/DesktopModules/ATI_Base/resources/services/StreamService.asmx"); service.InlineScript = true; ScriptManager.GetCurrent(Page).Services.Add(service); if (!Page.IsPostBack && !Page.IsCallback) { aqufitEntities entities = new aqufitEntities(); if (Request["a"] != null) { long aId = Convert.ToInt64(Request["a"]); CompetitionAffiliate affiliate = entities.CompetitionAffiliates.FirstOrDefault(a => a.Id == aId); atiRadComboSearchAffiliates.Items.Add(new RadComboBoxItem() { Selected = true, Text = affiliate.Name, Value = "" + affiliate.Id }); // set the sex to all rblSex.Items.FindByValue("A").Selected = true; } baseUrl = ResolveUrl("~/"); Competition comp = null; long compKey = 0; if (Request["c"] != null) { compKey = Convert.ToInt64(Request["c"]); comp = entities.Competitions.FirstOrDefault(c => c.Id == compKey); } if (compKey <= 0) { comp = entities.Competitions.FirstOrDefault(); } workoutTabTitle.Text = "Competition: " + comp.Name; atiWorkoutPanel.Visible = true; var regionList = entities.CompetitionRegions.Select(r => new { Text = r.Name, Id = r.Id }).ToList(); ddlRegion.DataTextField = "Text"; ddlRegion.DataValueField = "Id"; // ddlRegion.DataSource = regionList; // ddlRegion.DataBind(); ddlRegion.Items.Add(new ListItem() { Text = "All Regions", Value = "0", Selected = true }); foreach (var item in regionList) { ddlRegion.Items.Add(new ListItem() { Text = item.Text, Value = "" + item.Id }); } //RadGrid1.MasterTable //var regionList = entities.Com.Select(r => new {Text = r.Name, Id = r.Id }).ToList(); //ddlAffiliate if (RadGrid1.MasterTableView.SortExpressions.Count == 0) { GridSortExpression expression = new GridSortExpression(); expression.FieldName = "OverallRank"; expression.SortOrder = GridSortOrder.Ascending; RadGrid1.MasterTableView.SortExpressions.AddSortExpression(expression); } User angie = entities.UserSettings.OfType <User>().Include("CompetitionAthletes").FirstOrDefault(u => u.Id == 515); atiFeaturedProfile.Settings = angie; litRank.Text = "<span class=\"grad-FFF-EEE\" style=\"float: right; display: inline-block; border: 1px solid #ccc; text-align: center; padding: 7px;\">World Rank<br /><em style=\"font-size: 18px;\">" + angie.CompetitionAthletes.First().OverallRank + "</em></span>"; //grad-FFF-EEE } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
public void RunCallCostParamsPerfTests() => Competition.Run(this, RunConfig);
private string serializeCompetition(Competition x) { SerializedCompetition c = new SerializedCompetition(x, Prefix, CompetitionResourceTemplate, CompetitionResultTemplate); return JsonConvert.SerializeObject(c); }
public async Task ImportCompetitionFromFIFA(ImportCompetition importCompetition) { var queryBuilder = new QueryBuilder { { "IdCompetition", importCompetition.CompetitionId.ToString() }, { "IdSeason", importCompetition.SeasonId.ToString() } }; if (importCompetition.StageId.HasValue) { queryBuilder.Add("idStage", importCompetition.StageId.Value.ToString()); } var message = await _client.GetAsync($"https://api.fifa.com/api/v1/calendar/matches?{queryBuilder.ToQueryString()}"); var content = await message.Content.ReadAsStringAsync(); var response = JsonSerializer.Deserialize <FifaResponse <Model.FIFA.Match> >(content); if (!response.Results.Any()) { return; } var competitionId = $"{importCompetition.CompetitionId}/{importCompetition.SeasonId}"; var competitionResponses = await _awsJsInterop.GraphQlAsync <CompetitionResponses>(FootballChampionship.Model.Queries.GET_COMPETITION, new { id = competitionId, owner = "null" }); var competition = competitionResponses.GetCompetition; if (competition == null) { competition = new Competition { Matches = new AwsGraphQlList <FootballChampionship.Model.Match> { Items = new List <FootballChampionship.Model.Match>() }, From = DateTimeOffset.MaxValue }; } var mutation = competition.Id == null ? Model.Mutations.CREATE_COMPETITION : Model.Mutations.UPDATE_COMPETITION; var matches = response.Results.OrderBy(r => r.Date); var firstMatch = matches.First(); var lastMatch = matches.Last(); var fromDate = competition.From; var toDate = competition.To; var importedMatchList = competition.Matches.Items; if (importedMatchList.Any()) { var firstDate = importedMatchList.First().BeginAt; fromDate = firstDate < fromDate ? firstDate : fromDate; var lastDate = importedMatchList.Last().BeginAt; toDate = lastDate > toDate ? lastDate : toDate; } competitionResponses = await _awsJsInterop.GraphQlAsync <CompetitionResponses>(mutation, new { input = new { Id = competitionId, Title = firstMatch.CompetitionName.First().Description, From = fromDate.Date.ToAwsDate(), To = toDate.Date.ToAwsDate(), localizedNames = firstMatch.CompetitionName.Select(n => new LocalizedName { Locale = n.Locale, Value = n.Description }) } }); competition = competition.Id == null ? competitionResponses.CreateCompetition : competitionResponses.UpdateCompetition; competition.Matches = new AwsGraphQlList <FootballChampionship.Model.Match> { Items = importedMatchList.ToList() }; CompetitionUpdated?.Invoke(competition); foreach (var match in matches) { await UpdateMatch(competition, match); } await UpdateMatches(competitionId, competition, queryBuilder, "fr-FR"); await UpdateMatches(competitionId, competition, queryBuilder, "de-DE"); }
private async Task UpdateMatch(Competition competition, Model.FIFA.Match fifaMatch) { var homeTeam = await GetOrCreateTeam(fifaMatch.Home); var awayTeam = await GetOrCreateTeam(fifaMatch.Away); var localizedNames = fifaMatch.StageName.Select(n => new LocalizedName { Locale = n.Locale, Value = n.Description }); var group = fifaMatch.GroupName.Select(n => new LocalizedName { Locale = n.Locale, Value = n.Description }); var mutation = Model.Mutations.CREATE_MATCH; var savedMatch = competition.Matches.Items.FirstOrDefault(i => i.Id == fifaMatch.IdMatch); if (savedMatch != null) { savedMatch.LocalizedNames = savedMatch.LocalizedNames ?? new List <LocalizedName>(); localizedNames = savedMatch.LocalizedNames .Concat(localizedNames) .Distinct(_localizedNameComparer); group = savedMatch.Group .Concat(group) .Distinct(_localizedNameComparer); mutation = Model.Mutations.UPDATE_MATCH; } var matchResponses = await _awsJsInterop.GraphQlAsync <Model.MatchResponses>(mutation, new { input = new { id = fifaMatch.IdMatch, group, number = fifaMatch.MatchNumber, matchCompetitionId = competition.Id, beginAt = fifaMatch.Date, placeHolderHome = homeTeam?.Name ?? fifaMatch.PlaceHolderA, placeHolderAway = awayTeam?.Name ?? fifaMatch.PlaceHolderB, localizedNames } }); var match = matchResponses.CreateMatch ?? matchResponses.UpdateMatch; if (savedMatch != null) { savedMatch.BeginAt = match.BeginAt; savedMatch.Group = match.Group; savedMatch.LocalizedNames = match.LocalizedNames; savedMatch.MatchTeams = match.MatchTeams; savedMatch.Number = match.Number; savedMatch.PlaceHolderAway = match.PlaceHolderAway; savedMatch.PlaceHolderHome = match.PlaceHolderHome; } else { var matchList = (IList <FootballChampionship.Model.Match>)competition.Matches.Items; matchList.Add(match); } var matchTeams = match.MatchTeams.Items; MatchTeam homeMatchTeam = null; if (homeTeam != null) { homeMatchTeam = matchTeams.FirstOrDefault(mt => mt.Team.Id == homeTeam.Id); if (homeMatchTeam == null) { var homeMatchTeamResponse = await _awsJsInterop.GraphQlAsync <MatchTeamResponses>(Model.Mutations.CREATE_MATCH_TEAM, new { input = new { id = Guid.NewGuid(), isHome = true, matchTeamTeamId = homeTeam.Id, matchTeamMatchId = fifaMatch.IdMatch } }); homeMatchTeam = homeMatchTeamResponse.CreateMatchTeam; } homeMatchTeam.Team = homeTeam; } MatchTeam awayMatchTeam = null; if (awayTeam != null) { awayMatchTeam = matchTeams.FirstOrDefault(mt => mt.Team.Id == awayTeam.Id); if (awayMatchTeam == null) { var awayMatchTeamResponse = await _awsJsInterop.GraphQlAsync <MatchTeamResponses>(Model.Mutations.CREATE_MATCH_TEAM, new { input = new { id = Guid.NewGuid(), isHome = false, matchTeamTeamId = awayTeam.Id, matchTeamMatchId = fifaMatch.IdMatch } }); awayMatchTeam = awayMatchTeamResponse.CreateMatchTeam; } awayMatchTeam.Team = awayTeam; } match.MatchTeams.Items = new List <MatchTeam> { homeMatchTeam, awayMatchTeam }; MatchUpdated?.Invoke(match); }
public void RunListCapacityPerfTest() => Competition.Run(this);
public static void Initialize(KickerContext context) { context.Database.EnsureCreated(); if (context.Users.Any()) { //return; context.Database.EnsureDeleted(); context.Database.EnsureCreated(); } var gameType1 = new GameType { Name = "1v1" }; var gameType2 = new GameType { Name = "2v2" }; context.GameTypes.AddRange(gameType1, gameType2); context.SaveChanges(); var gameStatus1 = new GameStatus { Name = "Challenged" }; var gameStatus2 = new GameStatus { Name = "Planned" }; var gameStatus3 = new GameStatus { Name = "Playing" }; var gameStatus4 = new GameStatus { Name = "Played" }; var gameStatus5 = new GameStatus { Name = "Dispute" }; var gameStatus6 = new GameStatus { Name = "Declined" }; var gameStatus7 = new GameStatus { Name = "Verify" }; context.GameStatus.AddRange(gameStatus1, gameStatus2, gameStatus3, gameStatus4, gameStatus5, gameStatus6, gameStatus7); context.SaveChanges(); var userRole = new Role { Name = "User" }; var adminRole = new Role { Name = "Admin" }; var captainRole = new Role { Name = "Captain" }; context.Roles.AddRange( userRole, adminRole, captainRole); context.SaveChanges(); var pic1 = new File { Name = "Morty Smith", Path = "Morty_Smith.jpg" }; var tablePic1 = new File { Name = "tafel1", Path = "uploads/tafel1.png" }; var tablePic2 = new File { Name = "tafel2", Path = "uploads/tafel2.jpg" }; var userPic1 = new File { Name = "martha-grant", Path = "uploads/martha-grant.jpg" }; var userPic2 = new File { Name = "franklin-day", Path = "uploads/franklin-day" }; var userPic3 = new File { Name = "alberto-garrett", Path = "uploads/alberto-garrett.jpg" }; var userPic4 = new File { Name = "tracey-bell", Path = "uploads/tracey-bell" }; context.Files.AddRange(pic1, tablePic1, tablePic2, userPic1, userPic2, userPic3, userPic4); context.SaveChanges(); var group1 = new Group { Name = "Thomas More Kicker Team", CompanyName = "Thomas More", Location = "Geel", GroupPicture = pic1 }; var group2 = new Group { Name = "UCLL Kicker Team", CompanyName = "UCLL", Location = "Hasselt", GroupPicture = pic1 }; context.Groups.AddRange(group1, group2); context.SaveChanges(); var user1 = new User { Role = adminRole, Username = "******", Password = BC.HashPassword("admin123"), FirstName = "admin", LastName = "Istrator", Email = "*****@*****.**", Group = group1, UserPicture = pic1 }; var user2 = new User { Role = userRole, Username = "******", Password = BC.HashPassword("user123"), FirstName = "Martha", LastName = "Grant", Email = "*****@*****.**", Group = group1, UserPicture = userPic1 }; var user3 = new User { Role = userRole, Username = "******", Password = BC.HashPassword("user123"), FirstName = "Franklin", LastName = "Day", Email = "*****@*****.**", Group = group2, UserPicture = userPic2 }; var user4 = new User { Role = captainRole, Username = "******", Password = BC.HashPassword("captian123"), FirstName = "Alberto", LastName = "Garrett", Email = "*****@*****.**", Group = group1, UserPicture = userPic3 }; var user5 = new User { Role = captainRole, Username = "******", Password = BC.HashPassword("captian123"), FirstName = "Tracey", LastName = "Bell", Email = "*****@*****.**", Group = group2, UserPicture = userPic4 }; context.Users.AddRange(user1, user2, user3, user4, user5); context.SaveChanges(); var team1 = new Team { TeamName = "TM Team 1", Group = group1 }; var team2 = new Team { TeamName = "UCLL Team 1", Group = group2 }; context.Teams.AddRange(team1, team2); context.SaveChanges(); var teamUser1 = new TeamUser { Team = team1, User = user2 }; var teamUser2 = new TeamUser { Team = team1, User = user4 }; var teamUser3 = new TeamUser { Team = team2, User = user3 }; var teamUser4 = new TeamUser { Team = team2, User = user5 }; context.TeamUsers.AddRange(teamUser1, teamUser2, teamUser3, teamUser4); context.SaveChanges(); team1.TeamUsers.Add(teamUser1); team1.TeamUsers.Add(teamUser1); team2.TeamUsers.Add(teamUser3); team2.TeamUsers.Add(teamUser4); context.SaveChanges(); user2.TeamUsers.Add(teamUser1); user3.TeamUsers.Add(teamUser3); user4.TeamUsers.Add(teamUser2); user5.TeamUsers.Add(teamUser4); context.SaveChanges(); var table1 = new Table { TableName = "TM Table 1", CompanyName = "Thomas More", ContactPerson = user1, Address = "Geel", TablePicture = tablePic1 }; var table2 = new Table { TableName = "UCLL Table 1", CompanyName = "UCLL", ContactPerson = user1, Address = "Hasselt", TablePicture = tablePic2 }; context.Table.AddRange(table1, table2); context.SaveChanges(); var competition1 = new Competition { Name = "Kicker Championship 2020", GameType = gameType1 }; context.Competitions.Add(competition1); context.SaveChanges(); var tournament1 = new Tournament { Name = "Semi-finals", Competition = competition1 }; context.Tournaments.Add(tournament1); context.SaveChanges(); var game1 = new Game { TeamA = team1, TeamB = team2, Table = table1, GameType = gameType1, Tournament = tournament1, ChallengedBy = team1, ChallengedGroup = team2, GameStatus = gameStatus2 }; var game2 = new Game { TeamA = team2, TeamB = team1, Table = table1, GameType = gameType2, Tournament = tournament1, ScoreTeamA = 1, ScoreTeamB = 2, ChallengedBy = team2, ChallengedGroup = team1, GameStatus = gameStatus5 }; context.Games.AddRange(game1, game2); context.SaveChanges(); }
public async Task <IActionResult> Delete(Competition competition) { _context.DeleteCompetition(competition); return(RedirectToAction(nameof(Index))); }
protected override TimeSpan OnProcess() { var competition = new Competition(); var offset = TimeSpan.FromDays(_settings.Offset); if (Competition.AllYears.Any(y => y.Year == _settings.StartFrom.Year) && (_settings.StartFrom + offset) < DateTime.Today) { this.AddInfoLog(LocalizedStrings.Str2306Params, _settings.StartFrom); foreach (var year in Competition.AllYears.Where(d => d.Year >= _settings.StartFrom.Year).ToArray()) { if (!CanProcess()) { break; } this.AddInfoLog(LocalizedStrings.Str2827Params, year); var yearCompetition = competition.Get(year); foreach (var date in yearCompetition.Days.Where(d => d >= _settings.StartFrom).ToArray()) { if (!CanProcess()) { break; } if (_settings.IgnoreWeekends && !ExchangeBoard.Forts.IsTradeDate(date.ApplyTimeZone(ExchangeBoard.Forts.TimeZone), true)) { this.AddDebugLog(LocalizedStrings.WeekEndDate, date); continue; } var canUpdateFrom = true; foreach (var member in yearCompetition.Members) { if (!CanProcess()) { canUpdateFrom = false; break; } var trades = yearCompetition.GetTrades(EntityRegistry.Securities, member, date); if (trades.Any()) { foreach (var group in trades.GroupBy(i => i.SecurityId)) { SaveOrderLog(GetSecurity(group.Key), group.OrderBy(i => i.ServerTime)); } } else { this.AddDebugLog(LocalizedStrings.NoData); } } if (canUpdateFrom) { _settings.StartFrom = date; SaveSettings(); } } } } else { this.AddInfoLog(LocalizedStrings.Str2828Params, _settings.StartFrom); } return(base.OnProcess()); }
public Competition UpdateCompetition(Competition existingCompetition, CompetitionRequest request) { existingCompetition.IsPrivate = request.IsPrivate; existingCompetition.IsHighestScoreWins = request.IsHighestScoreWins; return(existingCompetition); }
public void RunSimpleAllocPerfTest() => Competition.Run(this);
public void RunCaseAggInlineNoEffect() => Competition.Run <CaseAggInlineNoEffect>();
public void SaveCompetition(Competition competition) { _bowlingRepository.SaveCompetition(competition); }
public ZherebExcelImportForm(Db dbContext, Competition competition) : this() { try { DbContext = dbContext; Competition = competition; DbContext.TeamSet.Load(); this.GridEX.RootTable.Columns["Team"].HasValueList = true; this.GridEX.RootTable.Columns["Team"].EditType = EditType.Combo; this.GridEX.RootTable.Columns["Team"].ColumnType = ColumnType.Text; this.GridEX.RootTable.Columns["Team"].ValueList.PopulateValueList(DbContext.TeamSet.Local.OrderBy(f => f.Name).ToList(), "Name"); using (var fs = new OpenFileDialog() { Filter = "Excel (*.xl*)|*.xl*" }) if (fs.ShowDialog(this) == DialogResult.OK) { var workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(fs.OpenFile()); var sheet = workbook.GetSheetAt(0); var nameIndex = ExcelService.GetNameColumnIndex(sheet); if (nameIndex < 0) { MessageBox.Show("Не могу найти столбец команд"); return; } ICell zherCell = null; foreach (var c in sheet.GetRow(0).Cells.Where(f => f.CellType == CellType.String).Reverse()) { switch ( MessageBox.Show(this, string.Format("Колонка '{0}' это номер жеребьевки?", c.StringCellValue), "выберите колонку", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)) { case System.Windows.Forms.DialogResult.Yes: zherCell = c; break; case System.Windows.Forms.DialogResult.Cancel: DialogResult = System.Windows.Forms.DialogResult.Cancel; return; break; } if (zherCell != null) { break; } } if (zherCell == null) { DialogResult = System.Windows.Forms.DialogResult.Cancel; return; } var names = new List <string>(); var data = new BindingList <ImportItem>(); foreach (var r in sheet) { var row = r as IRow; if (row == null || row.RowNum == 0 || row.GetCell(nameIndex) == null || row.GetCell(nameIndex).CellType != CellType.String) { continue; } var name = row.GetCell(nameIndex).StringCellValue.Trim(); if (string.IsNullOrEmpty(name)) { continue; } var alt = name + ";"; var team = DbContext.TeamSet.Local.FirstOrDefault(f => string.Compare(f.Name, name, true) == 0 || f.AlternativeNames.Contains(alt)); if (team == null) { MessageBox.Show(this, $"Файл содержит неизвестные команду '{name}'! Импорта не будет.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = System.Windows.Forms.DialogResult.Cancel; return; } if (!team.Used) { MessageBox.Show(this, "Файл содержит команды без аккредитации! Импорта не будет.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = System.Windows.Forms.DialogResult.Cancel; return; } data.Add(new ImportItem() { Team = team, Number = row.GetCell(zherCell.ColumnIndex) != null ? row.GetCell(zherCell.ColumnIndex).ToString().Trim() : "" }); } GridEX.DataSource = data; } else { DialogResult = System.Windows.Forms.DialogResult.Cancel; } } catch (Exception ex) { MessageBox.Show(this, "Ошибка при импорте жеребьевки " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = DialogResult.Abort; } }
public void RunRangeAlternativesIntCase() => Competition.Run <RangeAlternativesIntCase>();
public void RunCaseAggInlineEffective() => Competition.Run <CaseAggInlineEffective>();
public IEnumerable<Performance> GetPerformances(Competition competition) { var performance = GeneratePerformance("1"); yield return performance; performance = GeneratePerformance("2"); if (competition.NumberOfPerformances == 2 || IsWorldsTeam) yield return performance; }
public override CompetitionTeam CreateCompetitionTeamDetails(Competition playoff, Team parent) { return(new PlayoffTeam(playoff, parent, parent.Name, parent.NickName, parent.ShortName, parent.Skill, parent.Owner, playoff.Year, null)); }
protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { aqufitEntities entities = new aqufitEntities(); Competition comp = null; long compKey = 0; if (Request["c"] != null) { compKey = Convert.ToInt64(Request["c"]); comp = entities.Competitions.FirstOrDefault(c => c.Id == compKey); } if (compKey <= 0) { comp = entities.Competitions.FirstOrDefault(); } IQueryable <CompetitionAthlete> athleteQuery = entities.CompetitionAthletes.Include("CompetitionWODs").Where(a => a.Competition.Id == comp.Id); if (rblSex.SelectedValue != "A") { athleteQuery = athleteQuery.Where(a => a.Sex == rblSex.SelectedValue); } long rid = Convert.ToInt64(ddlRegion.SelectedValue); if (rid > 0) { athleteQuery = athleteQuery.Where(a => a.CompetitionRegion.Id == rid); } try { long aId = Convert.ToInt64(atiRadComboSearchAffiliates.SelectedValue); if (aId > 0) { athleteQuery = athleteQuery.Where(a => a.CompetitionAffiliate.Id == aId); } } catch (Exception) { } RadGrid1.DataSource = athleteQuery.Select(a => new { FlexId = (a.UserSetting != null ? a.UserSetting.UserName : ""), AffiliateName = a.AffiliateName, AthleteName = a.AthleteName, Country = a.Country, Height = a.Height, Age = (a.BirthYear.HasValue ? (DateTime.Today.Year - a.BirthYear.Value) : 0), Hometown = a.Hometown, Id = a.Id, ImgUrl = a.ImgUrl, OverallRank = a.OverallRank, OverallScore = a.OverallScore, RegionKey = (a.CompetitionRegion != null ? a.CompetitionRegion.Id : 0), Sex = a.Sex, RegionName = a.RegionName, Weight = a.Weight, UId = a.UId, W1Score = a.CompetitionWODs.Count > 0 ? a.CompetitionWODs.FirstOrDefault(w => w.Order == 0).Score : 0, W1Rank = a.CompetitionWODs.Count > 0 ? a.CompetitionWODs.FirstOrDefault(w => w.Order == 0).Rank : 0, W2Score = a.CompetitionWODs.Count > 1 ? a.CompetitionWODs.FirstOrDefault(w => w.Order == 1).Score : 0, W2Rank = a.CompetitionWODs.Count > 1 ? a.CompetitionWODs.FirstOrDefault(w => w.Order == 1).Rank : 0, W3Score = a.CompetitionWODs.Count > 2 ? a.CompetitionWODs.FirstOrDefault(w => w.Order == 2).Score : 0, W3Rank = a.CompetitionWODs.Count > 2 ? a.CompetitionWODs.FirstOrDefault(w => w.Order == 2).Rank : 0, W4Score = a.CompetitionWODs.Count > 3 ? a.CompetitionWODs.FirstOrDefault(w => w.Order == 3).Score : 0, W4Rank = a.CompetitionWODs.Count > 3 ? a.CompetitionWODs.FirstOrDefault(w => w.Order == 3).Rank : 0, W5Score = a.CompetitionWODs.Count > 4 ? a.CompetitionWODs.FirstOrDefault(w => w.Order == 4).Score : 0, W5Rank = a.CompetitionWODs.Count > 4 ? a.CompetitionWODs.FirstOrDefault(w => w.Order == 4).Rank : 0, W6Score = a.CompetitionWODs.Count > 5 ? a.CompetitionWODs.FirstOrDefault(w => w.Order == 5).Score : 0, W6Rank = a.CompetitionWODs.Count > 5 ? a.CompetitionWODs.FirstOrDefault(w => w.Order == 5).Rank : 0 } ).ToArray(); }
public IEnumerable <CompetitionTeam> GetByCompetition(Competition competition) { return(baseRepo.Where(t => t.Competition == competition).ToList()); }
private void competitionGames(Competition competition) { using (OddsContext context = new OddsContext()) { //generalMethods.setTimeOut(2); //! Go to Game URL (DYNAMIC) if (competition != default(Competition) && !string.IsNullOrWhiteSpace(competition.DynamicId)) { IWebElement liList = default(IWebElement); findElement(string.Format("//span[contains(@behavior.gotoleague.idfwbonavigation, '{0}')]", competition.DynamicId), 0); //WebDriverWait waitForElement = new WebDriverWait(driver1, TimeSpan.FromSeconds(5)); //waitForElement.Until(ExpectedConditions.ElementIsVisible(By.XPath(string.Format("//span[contains(@behavior.gotoleague.idfwbonavigation, '{0}')]", competition.DynamicId)))); while (liList == null) { liList = driver1.FindElement(By.XPath(string.Format("//span[contains(@behavior.gotoleague.idfwbonavigation, '{0}')]", competition.DynamicId))); } liList.Click(); htmlNodeCollection = null; int counter = 0; while (htmlNodeCollection == null) { string pgData = this.driver1.PageSource.Replace(System.Environment.NewLine, "").Replace("\t", ""); htmlNodeCollection = generalMethods.FindSpecificElements(generalMethods.ParseHtmlPageSource(pgData), "(//div[contains(@id,'DynamicContentComponent31-groups')])"); if (counter > 1000) { return; } } HtmlDocument pageDocumentTable = new HtmlDocument(); HtmlNodeCollection htmlNodeCollection1 = null; while (htmlNodeCollection1 == null) { pageDocumentTable = generalMethods.ParseHtmlPageSource(htmlNodeCollection[0].OuterHtml); htmlNodeCollection1 = generalMethods.FindSpecificElements(pageDocumentTable, "(//table)"); } foreach (HtmlNode collection in htmlNodeCollection1) { if (collection.ChildNodes.Count > 0) { foreach (HtmlNode childNode in collection.ChildNodes) { if (childNode.Name.Equals("tbody")) { if (childNode.ChildNodes.Count > 0) { foreach (HtmlNode tr in childNode.ChildNodes) { // For Every Tr in tbody if (tr.Name.Equals("tr") && tr.ChildNodes.Count > 0) { Game game = new Game(); game.CompetitionId = competition.Id; game.DateUpdated = DateTime.Now; foreach (HtmlNode td in tr.ChildNodes) { if (td.HasClass("eventname")) { string date = td.FirstChild.FirstChild.FirstChild.InnerText; string time = td.FirstChild.FirstChild.LastChild.InnerText; string MatchHomeTeam = td.LastChild.FirstChild.FirstChild.InnerText; string AwayTeam = td.LastChild.LastChild.LastChild.InnerText; game.Descr = string.Format("{0} - {1}", MatchHomeTeam, AwayTeam); game.HomeTeam = MatchHomeTeam; game.AwayTeam = AwayTeam; if (time.Contains("mins")) { game.MatchDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, (DateTime.Now.Hour + 1), 0, 0); } else { game.MatchDate = new DateTime(DateTime.Now.Year, Convert.ToInt32(date.Split('/')[1]), Convert.ToInt32(date.Split('/')[0]), Convert.ToInt32(time.Split(':')[0]), Convert.ToInt32(time.Split(':')[1]), 0); } } } string behaviorID = tr.LastChild.FirstChild.Attributes["behavior.more.id"].Value; string behaviorName = tr.LastChild.FirstChild.Attributes["behavior.more.id"].Name; game.DynamicId = behaviorID; //Game checkIfGameExists = context.Game.FirstOrDefault(x => x.CompetitionId == game.CompetitionId && x.MatchDate == game.MatchDate && x.HomeTeam.Equals(game.HomeTeam) && x.AwayTeam.Equals(game.AwayTeam)); Game checkIfGameExists = context.Game.FirstOrDefault(x => x.CompetitionId == game.CompetitionId && x.DynamicId == behaviorID); if (checkIfGameExists == default(Game)) { game.Id = _dataBase.X_getGID("Game"); context.Game.Add(game); } else { game.Id = checkIfGameExists.Id; } context.SaveChanges(); IWebElement moreBetsPage = driver1.FindElement(By.XPath(string.Format("//span[@{1}='{0}' and @behavior.id ='More' and @title='More bets']", behaviorID, behaviorName))); while (moreBetsPage == null) { moreBetsPage = driver1.FindElement(By.XPath(string.Format("//span[@{1}='{0}' and @behavior.id ='More' and @title='More bets']", behaviorID, behaviorName))); } moreBetsPage.Click(); generalMethods.setTimeOut(2); Fill_GamePick(moreBetsPage, game); driver1.Navigate().Back(); } } } } } } } context.SaveChanges(); driver1.Navigate().Back(); } } }
public void SetUp() { _competition = new Competition(); }
private void ParsePageData() { this.driver1.Navigate().GoToUrl(this.url); generalMethods.setTimeOut(2); TimeSpan tm = new TimeSpan(0, 0, 8); driver1.Manage().Timeouts().ImplicitWait = tm; //! Get HTML Code string pageSource = this.driver1.PageSource; pageSource = pageSource.Replace(Environment.NewLine, "").Replace("\t", ""); string getID = string.Empty; //! Parse HTML HttpClient client = new HttpClient(); HtmlDocument pageDocument = new HtmlDocument(); pageDocument = generalMethods.ParseHtmlPageSource(pageSource); while (htmlNodeCollection == null) { htmlNodeCollection = generalMethods.FindSpecificElements(pageDocument, "(//ul[contains(@class,'nodes')])"); } //! Find FootBall Tab From HomePage foreach (HtmlNode node in htmlNodeCollection) { if (node.ChildNodes.Count > 0) { foreach (HtmlNode childNode in node.ChildNodes) { if (childNode.Name.Equals("li") && childNode.InnerText.Equals("Football")) { foreach (HtmlNode aref in childNode.ChildNodes) { if (aref.Name == "a") { if (!string.IsNullOrWhiteSpace(aref.Attributes["behavior.node.id"].Value)) { using (OddsContext context = new OddsContext()) { Companies companyFootball = context.Companies.FirstOrDefault(x => x.Link.Equals(this.url)); if (companyFootball != default(Companies)) { companyFootball.DynamicParam = aref.Attributes["behavior.node.id"].Value; } context.SaveChanges(); } } } } //! Find Football Link and Get ID HtmlAttributeCollection nodeAttributeCollection = childNode.Attributes; foreach (HtmlAttribute attribute in nodeAttributeCollection) { if (attribute.Name.Equals("id") && attribute.Value.Contains("DynamicRootComponent")) { IWebElement li = driver1.FindElement(By.Id(attribute.Value)); IWebElement liList = li.FindElement(By.XPath(string.Format("//a[contains(@behavior.node.id, '{0}')]", attribute.Value.Split('-')[1]))); liList.Click(); break; } } } } } } //! Get Competition Page and Fill //generalMethods.setTimeOut(4); htmlNodeCollection = null; while (htmlNodeCollection == null) { pageSource = this.driver1.PageSource.Replace(System.Environment.NewLine, "").Replace("\t", ""); htmlNodeCollection = generalMethods.FindSpecificElements(generalMethods.ParseHtmlPageSource(pageSource), "(//div[contains(@id,'DynamicContentComponent31-menu')])"); } HtmlNode runningNode = null; foreach (HtmlNode node in htmlNodeCollection) { if (node.ChildNodes.Count > 0) { foreach (HtmlNode childNode in node.ChildNodes) { if (childNode.Name.Equals("div")) { HtmlNode ul = childNode.FirstChild; foreach (HtmlNode childNode2 in ul.ChildNodes) { if (childNode2.Name.Equals("li")) { //! Find Li Input and Spanm if (childNode2.ChildNodes.Count > 0) { foreach (HtmlNode childNode3 in childNode2.ChildNodes) { if (childNode3.Name.Equals("span")) { HtmlAttributeCollection nodeAttributeCollection = childNode3.Attributes; using (OddsContext context = new OddsContext()) { //Competition competition = context.Competition.FirstOrDefault(x => x.Descr.Equals(childNode3.InnerText)); Competition competition = context.Competition.FirstOrDefault(x => x.DynamicId.Equals(nodeAttributeCollection["behavior.gotoleague.idfwbonavigation"].Value)); if (competition == default(Competition)) { competition = new Competition(); context.Competition.Add(competition); context.Database.CloseConnection(); competition.Id = _dataBase.X_getGID("Competition"); context.Database.OpenConnection(); } competition.DateUpdated = DateTime.Now; competition.SportId = 1; competition.Descr = childNode3.InnerText; competition.DynamicId = nodeAttributeCollection["behavior.gotoleague.idfwbonavigation"].Value; context.SaveChanges(); competitionGames(competition); } } } } } } //IWebElement li = driver1.FindElement(By.Id(attribute.Value)); //Console.WriteLine(childNode.InnerHtml); } } } } //generalMethods.setTimeOut(2); //! Fill For Each Competition the Games }
public CompetitionChangedEvent(Competition competition) : base(competition.Id) { Competition = competition; }
public GCompetitions(Competition objectG) { Text = objectG.CompetitionName; GridObject = objectG; }
private String BuildInsertCompetitionCommand(Competition cmpt) { String command; StringBuilder sb = new StringBuilder(); // use a string builder to create the dynamic string String prefix = @"INSERT INTO [Competition] ([CompetitionDate] ,[OrgWin] ,[GrpWin] ,[PlatinumUser] ,[GoldUser] ,[SilverUser] ,[BronzeUser] ,[GrpOrgWin])"; sb.AppendFormat("Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')", cmpt.CompetitionDate, cmpt.OrgWin, cmpt.GrpWin, cmpt.PlatinumUser, cmpt.GoldUser, cmpt.SilverUser, cmpt.BronzeUser, cmpt.GrpOrgWin); command = prefix + sb.ToString(); return command; }
public void CreateMatch(Competition competition, List <Party> players, int laneid) { _bowlingRepository.CreateMatch(competition, players, laneid); }
public FrenoyMatchesApi(ITtcDbContext ttcDbContext, Competition comp) : base(ttcDbContext, comp) { }
protected override void Seed(SweatyTShirtContext context) { WebSecurity.InitializeDatabaseConnection("SweatyTShirtContext", "UserProfile", "UserId", "UserName", autoCreateTables: true); var roles = (SimpleRoleProvider)Roles.Provider; var membership = (SimpleMembershipProvider)Membership.Provider; #region create administrator roles.CreateRole(AccountRepository.AdminRole); Dictionary <string, object> values = new Dictionary <string, object>(); values.Add("Email", AdminEmail); values.Add("LastEmailSent", DateTime.Now.AddDays(-365)); membership.CreateUserAndAccount(AdminUserName, AccountRepository.AllUsersPassword, values); roles.AddUsersToRoles(new[] { AdminUserName }, new[] { AccountRepository.AdminRole }); #endregion #region create 4 users roles.CreateRole(AccountRepository.UserRole); UserProfile user1 = CreateUser(User1Email, FullName1, membership, roles, context); UserProfile user2 = CreateUser(User2Email, FullName2, membership, roles, context); UserProfile user3 = CreateUser(User3Email, FullName3, membership, roles, context); UserProfile user4 = CreateUser(User4Email, FullName4, membership, roles, context); roles.AddUsersToRoles(new[] { user1.UserName, user4.UserName }, new[] { AccountRepository.AdminRole }); #endregion #region create some competitions Competition competition = CreateCompetition( context, user1.UserId, "Iron Man", "Winner gets $10 from everyone", 25, null); Competition competition2 = CreateCompetition( context, user1.UserId, "Iron Man 2", "Winner gets $20 from everyone", 50, new DateTime(2013, 11, 1)); Competition competition3 = CreateCompetition( context, user2.UserId, "Iron Man 3", "Winner gets $10 from everyone", 25, null); Competition competition4 = CreateCompetition( context, user2.UserId, "Iron Man 4", "Winner gets $20 from everyone", 50, new DateTime(2013, 12, 1)); Competition competition5 = CreateCompetition( context, user3.UserId, "Iron Man 5", "Winner gets $10 from everyone", 25, null); Competition competition6 = CreateCompetition( context, user3.UserId, "Iron Man 6", "Winner gets $20 from everyone", 50, new DateTime(2014, 11, 30)); Competition competition7 = CreateCompetition( context, user4.UserId, "Iron Man 7", "Winner gets $10 from everyone", 25, null); Competition competition8 = CreateCompetition( context, user4.UserId, "Iron Man 8", "Winner gets $20 from everyone", 50, new DateTime(2014, 5, 1)); #endregion #region add users to competitions AddUserToCompetition(context, user1, competition); AddUserToCompetition(context, user2, competition); AddUserToCompetition(context, user3, competition); AddUserToCompetition(context, user1, competition2); AddUserToCompetition(context, user3, competition2); AddUserToCompetition(context, user4, competition2); AddUserToCompetition(context, user1, competition3); AddUserToCompetition(context, user2, competition3); AddUserToCompetition(context, user3, competition3); AddUserToCompetition(context, user1, competition4); AddUserToCompetition(context, user3, competition4); AddUserToCompetition(context, user4, competition4); AddUserToCompetition(context, user1, competition5); AddUserToCompetition(context, user2, competition5); AddUserToCompetition(context, user3, competition5); AddUserToCompetition(context, user1, competition6); AddUserToCompetition(context, user3, competition6); AddUserToCompetition(context, user4, competition6); AddUserToCompetition(context, user1, competition7); AddUserToCompetition(context, user2, competition7); AddUserToCompetition(context, user3, competition7); AddUserToCompetition(context, user1, competition8); AddUserToCompetition(context, user3, competition8); AddUserToCompetition(context, user4, competition8); #endregion #region add sweaty t-shirts AddSweatyTShirt(context, competition, user1, "Jogged", 1); AddSweatyTShirt(context, competition, user1, "Swam", 1); AddSweatyTShirt(context, competition, user1, "Lifted Weights", 2); AddSweatyTShirt(context, competition2, user1, "Jogged", 2); AddSweatyTShirt(context, competition2, user1, "Swam", 1); AddSweatyTShirt(context, competition2, user1, "Lifted Weights", 3); AddSweatyTShirt(context, competition, user2, "Jogged", 2); AddSweatyTShirt(context, competition, user2, "Swam", 3); AddSweatyTShirt(context, competition, user2, "Lifted Weights", 1); AddSweatyTShirt(context, competition, user3, "Jogged", 2); AddSweatyTShirt(context, competition, user3, "Swam", 1); AddSweatyTShirt(context, competition, user3, "Lifted Weights", 3); AddSweatyTShirt(context, competition2, user3, "Jogged", 3); AddSweatyTShirt(context, competition2, user3, "Swam", 2); AddSweatyTShirt(context, competition2, user3, "Lifted Weights", 1); AddSweatyTShirt(context, competition2, user4, "Jogged", 2); AddSweatyTShirt(context, competition2, user4, "Swam", 1); AddSweatyTShirt(context, competition2, user4, "Lifted Weights", 2); AddSweatyTShirt(context, competition3, user1, "Jogged", 1); AddSweatyTShirt(context, competition3, user1, "Swam", 1); AddSweatyTShirt(context, competition3, user1, "Lifted Weights", 2); AddSweatyTShirt(context, competition4, user1, "Jogged", 2); AddSweatyTShirt(context, competition4, user1, "Swam", 1); AddSweatyTShirt(context, competition4, user1, "Lifted Weights", 3); AddSweatyTShirt(context, competition3, user2, "Jogged", 2); AddSweatyTShirt(context, competition3, user2, "Swam", 3); AddSweatyTShirt(context, competition3, user2, "Lifted Weights", 1); AddSweatyTShirt(context, competition3, user3, "Jogged", 2); AddSweatyTShirt(context, competition3, user3, "Swam", 1); AddSweatyTShirt(context, competition3, user3, "Lifted Weights", 3); AddSweatyTShirt(context, competition4, user3, "Jogged", 3); AddSweatyTShirt(context, competition4, user3, "Swam", 2); AddSweatyTShirt(context, competition4, user3, "Lifted Weights", 1); AddSweatyTShirt(context, competition4, user4, "Jogged", 2); AddSweatyTShirt(context, competition4, user4, "Swam", 1); AddSweatyTShirt(context, competition4, user4, "Lifted Weights", 2); AddSweatyTShirt(context, competition5, user1, "Jogged", 1); AddSweatyTShirt(context, competition5, user1, "Swam", 1); AddSweatyTShirt(context, competition5, user1, "Lifted Weights", 2); AddSweatyTShirt(context, competition6, user1, "Jogged", 2); AddSweatyTShirt(context, competition6, user1, "Swam", 1); AddSweatyTShirt(context, competition6, user1, "Lifted Weights", 3); AddSweatyTShirt(context, competition5, user2, "Jogged", 2); AddSweatyTShirt(context, competition5, user2, "Swam", 3); AddSweatyTShirt(context, competition5, user2, "Lifted Weights", 1); AddSweatyTShirt(context, competition5, user3, "Jogged", 2); AddSweatyTShirt(context, competition5, user3, "Swam", 1); AddSweatyTShirt(context, competition5, user3, "Lifted Weights", 3); AddSweatyTShirt(context, competition6, user3, "Jogged", 3); AddSweatyTShirt(context, competition6, user3, "Swam", 2); AddSweatyTShirt(context, competition6, user3, "Lifted Weights", 1); AddSweatyTShirt(context, competition6, user4, "Jogged", 2); AddSweatyTShirt(context, competition6, user4, "Swam", 1); AddSweatyTShirt(context, competition6, user4, "Lifted Weights", 2); AddSweatyTShirt(context, competition7, user1, "Jogged", 1); AddSweatyTShirt(context, competition7, user1, "Swam", 1); AddSweatyTShirt(context, competition7, user1, "Lifted Weights", 2); AddSweatyTShirt(context, competition8, user1, "Jogged", 2); AddSweatyTShirt(context, competition8, user1, "Swam", 1); AddSweatyTShirt(context, competition8, user1, "Lifted Weights", 3); AddSweatyTShirt(context, competition7, user2, "Jogged", 2); AddSweatyTShirt(context, competition7, user2, "Swam", 3); AddSweatyTShirt(context, competition7, user2, "Lifted Weights", 1); AddSweatyTShirt(context, competition7, user3, "Jogged", 2); AddSweatyTShirt(context, competition7, user3, "Swam", 1); AddSweatyTShirt(context, competition7, user3, "Lifted Weights", 3); AddSweatyTShirt(context, competition8, user3, "Jogged", 3); AddSweatyTShirt(context, competition8, user3, "Swam", 2); AddSweatyTShirt(context, competition8, user3, "Lifted Weights", 1); AddSweatyTShirt(context, competition8, user4, "Jogged", 2); AddSweatyTShirt(context, competition8, user4, "Swam", 1); AddSweatyTShirt(context, competition8, user4, "Lifted Weights", 2); #endregion //create the error logging database //this needs be re-written into discreate batches with no GO statements //context.Database.ExecuteSqlCommand(SQLScripts.CreateElmah); }
public CupBuilder InCompetition(Competition competition) { this.competition = competition; return this; }
public async Task <ActionResult> CreateCompetition([Bind(Prefix = "Competition", Include = "CompetitionName,UntilYear,PlayerType,Facebook,Twitter,Instagram,YouTube,Website")] Competition competition) { if (competition is null) { throw new System.ArgumentNullException(nameof(competition)); } // get this from the unvalidated form instead of via modelbinding so that HTML can be allowed competition.Introduction = Request.Unvalidated.Form["Competition.Introduction"]; competition.PublicContactDetails = Request.Unvalidated.Form["Competition.PublicContactDetails"]; competition.PrivateContactDetails = Request.Unvalidated.Form["Competition.PrivateContactDetails"]; var isAuthorized = _authorizationPolicy.IsAuthorized(competition); if (isAuthorized[AuthorizedAction.CreateCompetition] && ModelState.IsValid) { // Create an owner group var groupName = _routeGenerator.GenerateRoute("competition", competition.CompetitionName, NoiseWords.CompetitionRoute); IMemberGroup group; do { group = Services.MemberGroupService.GetByName(groupName); if (group == null) { group = new MemberGroup { Name = groupName }; Services.MemberGroupService.Save(group); competition.MemberGroupKey = group.Key; competition.MemberGroupName = group.Name; break; } else { groupName = _routeGenerator.IncrementRoute(groupName); } }while (group != null); // Assign the current member to the group unless they're already admin var currentMember = Members.GetCurrentMember(); if (!Members.IsMemberAuthorized(null, new[] { Groups.Administrators }, null)) { Services.MemberService.AssignRole(currentMember.Id, group.Name); } // Create the competition var createdCompetition = await _competitionRepository.CreateCompetition(competition, currentMember.Key, currentMember.Name).ConfigureAwait(false); _cacheOverride.OverrideCacheForCurrentMember(CacheConstants.CompetitionsPolicyCacheKeyPrefix); // Redirect to the competition return(Redirect(createdCompetition.CompetitionRoute)); } var viewModel = new CompetitionViewModel(CurrentPage, Services.UserService) { Competition = competition, }; viewModel.IsAuthorized = isAuthorized; viewModel.Metadata.PageTitle = $"Add a competition"; viewModel.Breadcrumbs.Add(new Breadcrumb { Name = Constants.Pages.Competitions, Url = new Uri(Constants.Pages.CompetitionsUrl, UriKind.Relative) }); return(View("CreateCompetition", viewModel)); }
public TeamRankingKey(Competition competition, int divisionId) { _competition = competition; _divisionId = divisionId; _created = DateTime.Now; }
public ShowCompetitionModel(uint id) { competition = CompetitionRepository.GetCompetition(id); }
public RegistrationIndexViewModel(Competition competition, string gymid) { Competition = competition; GymId = gymid; }
protected override void Seed(LFCMVC.Models.LFCContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. E.g. // // context.People.AddOrUpdate( // p => p.FullName, // new Person { FullName = "Andrew Peters" }, // new Person { FullName = "Brice Lambson" }, // new Person { FullName = "Rowan Miller" } // ); // //create Competitions var competitions = new List<Competition>(); Competition epl = new Competition(); epl.CompetitionId = 1; epl.Image = "epl.png"; epl.Name = "English Premiership"; competitions.Add(epl); Competition fa = new Competition(); fa.CompetitionId = 2; fa.Image = "facup.png"; fa.Name = "FA Cup"; competitions.Add(fa); Competition capital = new Competition(); capital.Image = "capcup.png"; capital.CompetitionId = 3; capital.Name = "Capital One Cup"; competitions.Add(capital); Competition europa = new Competition(); europa.CompetitionId = 4; europa.Image = "uel.png"; europa.Name = "Europa League"; competitions.Add(europa); Competition friendly = new Competition(); friendly.CompetitionId = 5; friendly.Image = "friendly.png"; friendly.Name = "Friendly"; competitions.Add(friendly); context.SaveChanges(); //create Player Positions var positions = new List<PlayerPosition>(); PlayerPosition gk = new PlayerPosition(); gk.PlayerPositionId = 1; gk.Position = "GK"; gk.Description = "Goalkeeper"; positions.Add(gk); PlayerPosition rb = new PlayerPosition(); rb.PlayerPositionId = 2; rb.Position = "RB"; rb.Description = "Defender"; positions.Add(rb); PlayerPosition cb = new PlayerPosition(); cb.PlayerPositionId = 3; cb.Position = "CB"; cb.Description = "Defender"; positions.Add(cb); PlayerPosition lb = new PlayerPosition(); lb.PlayerPositionId = 4; lb.Position = "LB"; lb.Description = "Defender"; positions.Add(lb); PlayerPosition rm = new PlayerPosition(); rm.PlayerPositionId = 5; rm.Position = "RM"; rm.Description = "Midfielder"; positions.Add(rm); PlayerPosition ram = new PlayerPosition(); ram.PlayerPositionId = 6; ram.Position = "RAM"; ram.Description = "Midfielder"; positions.Add(ram); PlayerPosition cdm = new PlayerPosition(); cdm.PlayerPositionId = 7; cdm.Position = "CDM"; cdm.Description = "Midfielder"; positions.Add(cdm); PlayerPosition cm = new PlayerPosition(); cm.PlayerPositionId = 8; cm.Position = "CM"; cm.Description = "Midfielder"; positions.Add(cm); PlayerPosition cam = new PlayerPosition(); cam.PlayerPositionId = 9; cam.Position = "CAM"; cam.Description = "Midfielder"; positions.Add(cam); PlayerPosition lam = new PlayerPosition(); lam.PlayerPositionId = 10; lam.Position = "LAM"; lam.Description = "Midfielder"; positions.Add(lam); PlayerPosition lm = new PlayerPosition(); lm.PlayerPositionId = 11; lm.Position = "LM"; lm.Description = "Midfielder"; positions.Add(lm); PlayerPosition rw = new PlayerPosition(); rw.PlayerPositionId = 12; rw.Position = "RW"; rw.Description = "Forward"; positions.Add(rw); PlayerPosition lw = new PlayerPosition(); lw.PlayerPositionId = 13; lw.Position = "LW"; lw.Description = "Forward"; positions.Add(lw); PlayerPosition cf = new PlayerPosition(); cf.PlayerPositionId = 14; cf.Position = "CF"; cf.Description = "Forward"; positions.Add(cf); PlayerPosition st = new PlayerPosition(); st.PlayerPositionId = 15; st.Position = "ST"; st.Description = "Forward"; positions.Add(st); context.SaveChanges(); //create Teams var teams = new List<Team>(); Team lfc = new Team(); lfc.TeamId = 1; lfc.Name = "Liverpool FC"; teams.Add(lfc); Team lfc21 = new Team(); lfc21.TeamId = 2; lfc21.Name = "Liverpool FC U-21's"; teams.Add(lfc21); context.SaveChanges(); //create Players var players = new List<Player>(); Player player = new Player(); player.Image = "Mignolet.jpg"; player.FirstName = "Simon"; player.LastName = "Mignolet"; player.Age = 27; player.Nationality = "Belgium"; player.SquadNumber = 22; player.PlayerPositionId = 5; players.Add(player); Player playerTwo = new Player(); playerTwo.Image = "Bogdan.jpg"; playerTwo.FirstName = "Adam"; playerTwo.LastName = "Bogdan"; playerTwo.Age = 28; playerTwo.Nationality = "Hungary"; playerTwo.SquadNumber = 34; players.Add(playerTwo); Player playerThree = new Player(); playerThree.Image = "Fulton.jpg"; playerThree.FirstName = "Ryan"; playerThree.LastName = "Fulton"; playerThree.Age = 19; playerThree.Nationality = "England"; playerThree.SquadNumber = 39; players.Add(playerThree); Player playerFour = new Player(); playerFour.Image = "Clyne.jpg"; playerFour.FirstName = "Nathaniel"; playerFour.LastName = "Clyne"; playerFour.Age = 24; playerFour.Nationality = "England"; playerFour.SquadNumber = 2; players.Add(playerFour); Player playerFive = new Player(); playerFive.Image = "Flanagan.jpg"; playerFive.FirstName = "Jon"; playerFive.LastName = "Flanagan"; playerFive.Age = 22; playerFive.Nationality = "England"; playerFive.SquadNumber = 38; players.Add(playerFive); Player playerSix = new Player(); playerSix.Image = "Toure.jpg"; playerSix.FirstName = "Kolo"; playerSix.LastName = "Toure"; playerSix.Age = 34; playerSix.Nationality = "Ivory Coast"; playerSix.SquadNumber = 4; players.Add(playerSix); Player playerSeven = new Player(); playerSeven.Image = "Lovren.jpg"; playerSeven.FirstName = "Dejan"; playerSeven.LastName = "Lovren"; playerSeven.Age = 26; playerSeven.Nationality = "Croatia"; playerSeven.SquadNumber = 6; players.Add(playerSeven); Player playerEight = new Player(); playerEight.Image = "Skrtel.jpg"; playerEight.FirstName = "Martin"; playerEight.LastName = "Skrtel"; playerEight.Age = 30; playerEight.Nationality = "Slovenia"; playerEight.SquadNumber = 37; players.Add(playerEight); Player playerNine = new Player(); playerNine.Image = "Sakho.jpg"; playerNine.FirstName = "Mamadou"; playerNine.LastName = "Sakho"; playerNine.Age = 25; playerNine.Nationality = "France"; playerNine.SquadNumber = 17; players.Add(playerNine); Player playerTen = new Player(); playerTen.Image = "Gomez.jpg"; playerTen.FirstName = "Joe"; playerTen.LastName = "Gomez"; playerTen.Age = 18; playerTen.Nationality = "England"; playerTen.SquadNumber = 12; players.Add(playerTen); Player playerEleven = new Player(); playerEleven.Image = "Cleary.jpg"; playerEleven.FirstName = "Daniel"; playerEleven.LastName = "Cleary"; playerEleven.Age = 19; playerEleven.Nationality = "Ireland"; playerEleven.SquadNumber = 58; players.Add(playerEleven); Player playerTwelve = new Player(); playerTwelve.Image = "Moreno.jpg"; playerTwelve.FirstName = "Alberto"; playerTwelve.LastName = "Moreno"; playerTwelve.Age = 23; playerTwelve.Nationality = "Spain"; playerTwelve.SquadNumber = 18; players.Add(playerTwelve); Player playerThirtheen = new Player(); playerThirtheen.Image = "Enrique.jpg"; playerThirtheen.FirstName = "Jose"; playerThirtheen.LastName = "Enrique"; playerThirtheen.Age = 29; playerThirtheen.Nationality = "Spain"; playerThirtheen.SquadNumber = 3; players.Add(playerThirtheen); Player playerFourteen = new Player(); playerFourteen.Image = "Ibe.jpg"; playerFourteen.FirstName = "Jordan"; playerFourteen.LastName = "Ibe"; playerFourteen.Age = 19; playerFourteen.Nationality = "England"; playerFourteen.SquadNumber = 33; players.Add(playerFourteen); Player playerFiveteen = new Player(); playerFiveteen.Image = "Lucas.jpg"; playerFiveteen.FirstName = "Lucas"; playerFiveteen.LastName = "Leiva"; playerFiveteen.Age = 28; playerFiveteen.Nationality = "Brazil"; playerFiveteen.SquadNumber = 21; players.Add(playerFiveteen); Player playerSixteen = new Player(); playerSixteen.Image = "Can.jpg"; playerSixteen.FirstName = "Emre"; playerSixteen.LastName = "Can"; playerSixteen.Age = 21; playerSixteen.Nationality = "Germany"; playerSixteen.SquadNumber = 23; players.Add(playerSixteen); Player playerSeventeen = new Player(); playerSeventeen.Image = "Rossiter.jpg"; playerSeventeen.FirstName = "Jordan"; playerSeventeen.LastName = "Rossiter"; playerSeventeen.Age = 18; playerSeventeen.Nationality = "England"; playerSeventeen.SquadNumber = 46; players.Add(playerSeventeen); Player playerEighteen = new Player(); playerEighteen.Image = "Allen.jpg"; playerEighteen.FirstName = "Joe"; playerEighteen.LastName = "Allen"; playerEighteen.Age = 25; playerEighteen.Nationality = "Wales"; playerEighteen.SquadNumber = 24; players.Add(playerEighteen); Player playerNineteen = new Player(); playerNineteen.Image = "Henderson.jpg"; playerNineteen.FirstName = "Jordan"; playerNineteen.LastName = "Henderson"; playerNineteen.Age = 25; playerNineteen.Nationality = "England"; playerNineteen.SquadNumber = 14; players.Add(playerNineteen); Player playerTwenty = new Player(); playerTwenty.Image = "Milner.jpg"; playerTwenty.FirstName = "James"; playerTwenty.LastName = "Milner"; playerTwenty.Age = 29; playerTwenty.Nationality = "England"; playerTwenty.SquadNumber = 7; players.Add(playerTwenty); Player playerTwentyOne = new Player(); playerTwentyOne.Image = "Randall.jpg"; playerTwentyOne.FirstName = "Connor"; playerTwentyOne.LastName = "Randall"; playerTwentyOne.Age = 20; playerTwentyOne.Nationality = "England"; playerTwentyOne.SquadNumber = 56; players.Add(playerTwentyOne); Player playerTwentyTwo = new Player(); playerTwentyTwo.Image = "Chirivella.jpg"; playerTwentyTwo.FirstName = "Pedro"; playerTwentyTwo.LastName = "Chirivella"; playerTwentyTwo.Age = 18; playerTwentyTwo.Nationality = "Spain"; playerTwentyTwo.SquadNumber = 68; players.Add(playerTwentyTwo); Player playerTwentyThree = new Player(); playerTwentyThree.Image = "Dunn.jpg"; playerTwentyThree.FirstName = "Jack"; playerTwentyThree.LastName = "Dunn"; playerTwentyThree.Age = 21; playerTwentyThree.Nationality = "England"; playerTwentyThree.SquadNumber = 41; players.Add(playerTwentyThree); Player playerTwentyFour = new Player(); playerTwentyFour.Image = "Brannagan.jpg"; playerTwentyFour.FirstName = "Cameron"; playerTwentyFour.LastName = "Brannagan"; playerTwentyFour.Age = 19; playerTwentyFour.Nationality = "England"; playerTwentyFour.SquadNumber = 32; players.Add(playerTwentyFour); Player playerT = new Player(); playerT.Image = "Teixeira.jpg"; playerT.FirstName = "João Carlos"; playerT.LastName = "Teixeira"; playerT.Age = 22; playerT.Nationality = "Portugal"; playerT.SquadNumber = 53; players.Add(playerT); Player playerTwentyFive = new Player(); playerTwentyFive.Image = "Lallana.jpg"; playerTwentyFive.FirstName = "Adam"; playerTwentyFive.LastName = "Lallana"; playerTwentyFive.Age = 27; playerTwentyFive.Nationality = "England"; playerTwentyFive.SquadNumber = 20; players.Add(playerTwentyFive); Player playerTwentySix = new Player(); playerTwentySix.Image = "Coutinho.jpg"; playerTwentySix.FirstName = "Philippe"; playerTwentySix.LastName = "Coutinho"; playerTwentySix.Age = 23; playerTwentySix.Nationality = "Brazil"; playerTwentySix.SquadNumber = 10; players.Add(playerTwentySix); Player playerTwentySeven = new Player(); playerTwentySeven.Image = "Firmino.jpg"; playerTwentySeven.FirstName = "Roberto"; playerTwentySeven.LastName = "Firmino"; playerTwentySeven.Age = 24; playerTwentySeven.Nationality = "Brazil"; playerTwentySeven.SquadNumber = 11; players.Add(playerTwentySeven); Player playerTwentyEight = new Player(); playerTwentyEight.Image = "Origi.jpg"; playerTwentyEight.FirstName = "Divock"; playerTwentyEight.LastName = "Origi"; playerTwentyEight.Age = 20; playerTwentyEight.Nationality = "Belgium"; playerTwentyEight.SquadNumber = 27; players.Add(playerTwentyEight); Player playerTwentyNine = new Player(); playerTwentyNine.Image = "Ings.jpg"; playerTwentyNine.FirstName = "Danny"; playerTwentyNine.LastName = "Ings"; playerTwentyNine.Age = 23; playerTwentyNine.Nationality = "England"; playerTwentyNine.SquadNumber = 28; players.Add(playerTwentyNine); Player playerThirthy = new Player(); playerThirthy.Image = "Benteke.jpg"; playerThirthy.FirstName = "Christian"; playerThirthy.LastName = "Benteke"; playerThirthy.Age = 24; playerThirthy.Nationality = "Belgium"; playerThirthy.SquadNumber = 9; players.Add(playerThirthy); Player playerThirthyOne = new Player(); playerThirthyOne.Image = "Sturridge.jpg"; playerThirthyOne.FirstName = "Daniel"; playerThirthyOne.LastName = "Sturridge"; playerThirthyOne.Age = 26; playerThirthyOne.Nationality = "England"; playerThirthyOne.SquadNumber = 15; players.Add(playerThirthyOne); Player playerThirthyTwo = new Player(); playerThirthyTwo.Image = "Sinclair.jpg"; playerThirthyTwo.FirstName = "Jerome"; playerThirthyTwo.LastName = "Sinclair"; playerThirthyTwo.Age = 19; playerThirthyTwo.Nationality = "England"; playerThirthyTwo.SquadNumber = 48; players.Add(playerThirthyTwo); //create Fixtures var fixtures = new List<Fixture>(); Fixture fixture = new Fixture(); fixture.Date = DateTime.Parse("2015-07-14 14:00:00"); fixture.Stadium = "Rajamangala National Stadium"; fixture.HomeTeam = "Thailand All-Stars"; fixture.HomeScore = 0; fixture.AwayScore = 4; fixture.AwayTeam = "Liverpool"; fixtures.Add(fixture); Fixture fixtureTwo = new Fixture(); fixtureTwo.Date = DateTime.Parse("2015-07-17 09:45:00"); fixtureTwo.Stadium = "Suncorp Stadium"; fixtureTwo.HomeTeam = "Brisbane"; fixtureTwo.HomeScore = 1; fixtureTwo.AwayScore = 2; fixtureTwo.AwayTeam = "Liverpool"; fixtures.Add(fixtureTwo); Fixture fixtureThree = new Fixture(); fixtureThree.Date = DateTime.Parse("2015-07-20 10:30:00"); fixtureThree.Stadium = "Coopers Stadium"; fixtureThree.HomeTeam = "Adelaide United"; fixtureThree.HomeScore = 0; fixtureThree.AwayScore = 2; fixtureThree.AwayTeam = "Liverpool"; fixtures.Add(fixtureThree); Fixture fixtureFour = new Fixture(); fixtureFour.Date = DateTime.Parse("2015-07-24 13:45:00"); fixtureFour.Stadium = "Bukit Jalil National Stadium"; fixtureFour.HomeTeam = "Malaysia All-Stars XI"; fixtureFour.HomeScore = 1; fixtureFour.AwayScore = 1; fixtureFour.AwayTeam = "Liverpool"; fixtures.Add(fixtureFour); Fixture fixtureFive = new Fixture(); fixtureFive.Date = DateTime.Parse("2015-08-01 17:30:00"); fixtureFive.Stadium = "Sonera Stadium"; fixtureFive.HomeTeam = "HJK Helsinki"; fixtureFive.HomeScore = 0; fixtureFive.AwayScore = 2; fixtureFive.AwayTeam = "Liverpool"; fixtures.Add(fixtureFive); Fixture fixtureSix = new Fixture(); fixtureSix.Date = DateTime.Parse("2015-08-02 16:00:00"); fixtureSix.Stadium = "The County Ground"; fixtureSix.HomeTeam = "Swindon Town"; fixtureSix.HomeScore = 1; fixtureSix.AwayScore = 2; fixtureSix.AwayTeam = "Liverpool"; fixtures.Add(fixtureSix); //create Honours var honours = new List<Honour>(); Honour league = new Honour(); league.Image = "pl.png"; league.Award = "League Champions"; league.Amount = 18; league.Season = "1900-01, 1905-06, 1921-22, 1922-23, 1946-47, 1963-64, 1965-66, 1972-73, 1975-76, 1976-77, 1978-79, 1979-80, 1981-82, 1982-83, 1983-84, 1985-86, 1987-88, 1989-90"; league.Type = "Domestic"; honours.Add(league); Honour faCup = new Honour(); faCup.Image = "faTrophy.png"; faCup.Award = "FA Cup"; faCup.Amount = 7; faCup.Season = "1964-65, 1973-74, 1985-86, 1988-89, 1991-92, 2000-01, 2005-06"; faCup.Type = "Domestic"; honours.Add(faCup); Honour capCup = new Honour(); capCup.Image = "lc.png"; capCup.Award = "Capital One Cup"; capCup.Amount = 8; capCup.Season = "1980-81, 1981-82, 1982-83, 1983-84, 1994-95, 2000-01, 2002-03, 2011-12"; capCup.Type = "Domestic"; honours.Add(capCup); Honour charity = new Honour(); charity.Image = "cs.png"; charity.Award = "FA Community Shield Winner"; charity.Amount = 15; charity.Season = "1964, 1965, 1966, 1974, 1976, 1977, 1979, 1980, 1982, 1986, 1988, 1989, 1990, 2001, 2006"; charity.Type = "Domestic"; honours.Add(charity); Honour euro = new Honour(); euro.Image = "cl.png"; euro.Award = "UEFA Champions League"; euro.Amount = 5; euro.Season = "1976-77, 1977-78, 1980-81, 1983-84, 2004-05"; euro.Type = "International"; honours.Add(euro); Honour europaL = new Honour(); europaL.Image = "el.png"; europaL.Award = "UEFA Europa-League"; europaL.Amount = 3; europaL.Season = "1972-73, 1975-76, 2000-01"; europaL.Type = "International"; honours.Add(europaL); Honour superCap = new Honour(); superCap.Image = "sc.png"; superCap.Award = "European Super Cup Winners"; superCap.Amount = 3; superCap.Season = "1977, 2001, 2005"; superCap.Type = "International"; honours.Add(superCap); //create Managers var managers = new List<Manager>(); Manager john = new Manager(); john.Image = "McKenna.jpg"; john.FirstName = "John"; john.LastName = "McKenna"; john.DOB = DateTime.Parse("1855/01/03"); john.Nationality = "Ireland"; john.Period = "1892-1896"; managers.Add(john); Manager tom = new Manager(); tom.Image = "Watson.jpg"; tom.FirstName = "Tom"; tom.LastName = "Watson"; tom.DOB = DateTime.Parse("1859/04/09"); tom.Nationality = "England"; tom.Period = "1896-1915"; managers.Add(tom); Manager david = new Manager(); david.Image = "Ashworth.jpg"; david.FirstName = "David"; david.LastName = "Ashworth"; david.DOB = DateTime.Parse("1868/01/01"); david.Nationality = "Ireland"; david.Period = "1919-1922"; managers.Add(david); Manager matt = new Manager(); matt.Image = "McQueen.jpg"; matt.FirstName = "Matt"; matt.LastName = "McQueen"; matt.DOB = DateTime.Parse("1863/05/18"); matt.Nationality = "England"; matt.Period = "1923-1928"; managers.Add(matt); Manager george = new Manager(); george.Image = "Patterson.jpg"; george.FirstName = "George"; george.LastName = "Patterson"; george.DOB = DateTime.Parse("1887/01/01"); george.Nationality = "Scotland"; george.Period = "1928-1936"; managers.Add(george); Manager kay = new Manager(); kay.Image = "Kay.jpg"; kay.FirstName = "George"; kay.LastName = "Kay"; kay.DOB = DateTime.Parse("1891/09/21"); kay.Nationality = "England"; kay.Period = "1936-1951"; managers.Add(kay); Manager don = new Manager(); don.Image = "Welsh.jpg"; don.FirstName = "Don"; don.LastName = "Welsh"; don.DOB = DateTime.Parse("1911/02/25"); don.Nationality = "England"; don.Period = "1951-1956"; managers.Add(don); Manager phil = new Manager(); phil.Image = "Taylor.jpg"; phil.FirstName = "Phil"; phil.LastName = "Taylor"; phil.DOB = DateTime.Parse("1917/09/18"); phil.Nationality = "England"; phil.Period = "1956-1959"; managers.Add(phil); Manager bill = new Manager(); bill.Image = "Shankley.jpg"; bill.FirstName = "Bill"; bill.LastName = "Shankly"; bill.DOB = DateTime.Parse("1913/09/02"); bill.Nationality = "Scotland"; bill.Period = "1959-1974"; managers.Add(bill); Manager bob = new Manager(); bob.Image = "Paisley.jpg"; bob.FirstName = "Bob"; bob.LastName = "Paisley"; bob.DOB = DateTime.Parse("1919/01/23"); bob.Nationality = "England"; bob.Period = "1974-1983"; managers.Add(bob); Manager fagan = new Manager(); fagan.Image = "Fagan.jpg"; fagan.FirstName = "Joe"; fagan.LastName = "Fagan"; fagan.DOB = DateTime.Parse("1921/03/12"); fagan.Nationality = "England"; fagan.Period = "1983-1985"; managers.Add(fagan); Manager kenny = new Manager(); kenny.Image = "Dalglish.jpg"; kenny.FirstName = "Kenny"; kenny.LastName = "Dalglish"; kenny.DOB = DateTime.Parse("1951/03/04"); kenny.Nationality = "Scotland"; kenny.Period = "1985-1991"; managers.Add(kenny); Manager souness = new Manager(); souness.Image = "Souness.jpg"; souness.FirstName = "Graeme"; souness.LastName = "Souness"; souness.DOB = DateTime.Parse("1953/05/06"); souness.Nationality = "Scotland"; souness.Period = "1991-1994"; managers.Add(souness); Manager evans = new Manager(); evans.Image = "Evans.jpg"; evans.FirstName = "Roy"; evans.LastName = "Evans"; evans.DOB = DateTime.Parse("1948/10/04"); evans.Nationality = "England"; evans.Period = "1994-1998"; managers.Add(evans); Manager houllier = new Manager(); houllier.Image = "Houllier.jpg"; houllier.FirstName = "Gerard"; houllier.LastName = "Houllier"; houllier.DOB = DateTime.Parse("1947/09/03"); houllier.Nationality = "France"; houllier.Period = "1998-2004"; managers.Add(houllier); Manager rafa = new Manager(); rafa.Image = "Benitez.jpg"; rafa.FirstName = "Rafael"; rafa.LastName = "Benitez"; rafa.DOB = DateTime.Parse("1960/04/16"); rafa.Nationality = "Spain"; rafa.Period = "2004-2010"; managers.Add(rafa); Manager hodgson = new Manager(); hodgson.Image = "Hodgson.jpg"; hodgson.FirstName = "Roy"; hodgson.LastName = "Hodgson"; hodgson.DOB = DateTime.Parse("1947/08/09"); hodgson.Nationality = "England"; hodgson.Period = "2010-2011"; managers.Add(hodgson); Manager kennyTwo = new Manager(); kennyTwo.Image = "DalglishTwo.jpg"; kennyTwo.FirstName = "Kenny"; kennyTwo.LastName = "Dalglish"; kennyTwo.DOB = DateTime.Parse("1951/03/04"); kennyTwo.Nationality = "Scotland"; kennyTwo.Period = "2011-2012"; managers.Add(kennyTwo); Manager rodgers = new Manager(); rodgers.Image = "Rodgers.jpg"; rodgers.FirstName = "Brendan"; rodgers.LastName = "Rodgers"; rodgers.DOB = DateTime.Parse("1973/01/26"); rodgers.Nationality = "Northern Ireland"; rodgers.Period = "2012-2015"; managers.Add(rodgers); Manager klopp = new Manager(); klopp.Image = "Klopp.jpeg"; klopp.FirstName = "Jurgen"; klopp.LastName = "Klopp"; klopp.DOB = DateTime.Parse("1967/06/16"); klopp.Nationality = "Germany"; klopp.Period = "2015-Present"; managers.Add(klopp); epl.Fixtures = fixtures; /*fa.Fixtures = fixtures; capital.Fixtures = fixtures; europa.Fixtures = fixtures; friendly.Fixtures = fixtures;*/ player.Fixtures = fixtures; fixture.Players = players; fixtureTwo.Players = players; fixtureThree.Players = players; fixtureFour.Players = players; fixtureFive.Players = players; fixtureSix.Players = players; john.Honours = honours; league.Managers = managers; gk.Players = players; /*rb.Players = players; cb.Players = players; lb.Players = players; rm.Players = players; ram.Players = players; cdm.Players = players; cm.Players = players; cam.Players = players; lam.Players = players; lm.Players = players; rw.Players = players; lw.Players = players; cf.Players = players; st.Players = players;*/ lfc.Players = players; //lfc21.Players = players; foreach (var c in competitions) { context.Competitions.Add(c); } foreach (var po in positions) { context.PlayerPositions.Add(po); } foreach (var t in teams) { context.Teams.Add(t); } foreach (var p in players) { context.Players.Add(p); } foreach (var f in fixtures) { context.Fixtures.Add(f); } foreach (var h in honours) { context.Honours.Add(h); } foreach (var m in managers) { context.Managers.Add(m); } context.SaveChanges(); }
public void Setup() { var sqlDatabaseMigrator = new SqlDatabaseMigrator(); sqlDatabaseMigrator.MigrateToLatest(ConfigurationManager.ConnectionStrings["WinShooterConnection"].ConnectionString); using (var databaseSession = NHibernateHelper.OpenSession()) { // Make sure there is a test competition this.testCompetition = (from competition in databaseSession.Query<Competition>() where competition.Name == CompetitionName select competition).FirstOrDefault(); if (this.testCompetition == null) { // No test competition found this.testCompetition = new Competition { CompetitionType = CompetitionType.Field, Name = CompetitionName, StartDate = DateTime.Now }; using (var transaction = databaseSession.BeginTransaction()) { databaseSession.Save(this.testCompetition); transaction.Commit(); } } // Make sure there is a test club this.testClub = (from club in databaseSession.Query<Club>() where club.Name == ClubName select club).FirstOrDefault(); if (this.testClub == null) { // No test club found this.testClub = new Club { ClubId = "1-123", Country = "SE", Name = ClubName }; using (var transaction = databaseSession.BeginTransaction()) { databaseSession.Save(this.testClub); transaction.Commit(); } } // Clear out the current competitors var competitors = from competitor in databaseSession.Query<Competitor>() where competitor.Competition == this.testCompetition select competitor; using (var transaction = databaseSession.BeginTransaction()) { foreach (var competitor in competitors) { databaseSession.Delete(competitor); } transaction.Commit(); } } }
public Match FindMatch(Competition competition, int matchNo) { return(_bowlingRepository.FindMatch(competition, matchNo)); }
protected override TimeSpan OnProcess() { var competition = new Competition(); var offset = TimeSpan.FromDays(_settings.Offset); if (Competition.AllYears.Any(y => y.Year == _settings.StartFrom.Year) && (_settings.StartFrom + offset) < DateTime.Today) { this.AddInfoLog(LocalizedStrings.Str2306Params, _settings.StartFrom); foreach (var year in Competition.AllYears.Where(d => d.Year >= _settings.StartFrom.Year).ToArray()) { if (!CanProcess()) break; this.AddInfoLog(LocalizedStrings.Str2827Params, year); var yearCompetition = competition.Get(year); foreach (var date in yearCompetition.Days.Where(d => d >= _settings.StartFrom).ToArray()) { if (!CanProcess()) break; if (_settings.IgnoreWeekends && !ExchangeBoard.Forts.IsTradeDate(date.ApplyTimeZone(ExchangeBoard.Forts.TimeZone), true)) { this.AddDebugLog(LocalizedStrings.WeekEndDate, date); continue; } var canUpdateFrom = true; foreach (var member in yearCompetition.Members) { if (!CanProcess()) { canUpdateFrom = false; break; } var trades = yearCompetition.GetTrades(EntityRegistry.Securities, member, date); if (trades.Any()) { foreach (var group in trades.GroupBy(i => i.SecurityId)) SaveOrderLog(GetSecurity(group.Key), group.OrderBy(i => i.ServerTime)); } else this.AddDebugLog(LocalizedStrings.NoData); } if (canUpdateFrom) { _settings.StartFrom = date; SaveSettings(); } } } } else { this.AddInfoLog(LocalizedStrings.Str2828Params, _settings.StartFrom); } return base.OnProcess(); }
public void RunDecisionOperatorsPerfTest() => Competition.Run(this);