private void CreateFixtureListView() { if (_searchTeamIDs == null || _searchTeamNames == null || _searchTeamIDs.Length != _searchTeamNames.Length) { return; } // 텝 셋팅 for (int i = 0; i < _searchTeamIDs.Length; i++) { tabContainer.Items.Add(new MenuItem($" {_searchTeamNames[i].ToString()} ", i.ToString())); } // set standing _leagueStanding = Singleton.Get <RedisCacheManager>() .Get <IList <WebFormModel.FootballStandings> > ( () => RequestLoader.FootballStandingsByLeagueId(_searchLeagueID), RequestLoader.Locker_FootballStandingsByLeagueId, DateTime.Now.AddHours(1), RedisKeyMaker.FootballStandingsByLeagueId(_searchLeagueID) ); // 그리드 아이템 셋팅 BindData(_searchTeamIDs); }
protected void GV_FootballFixtures_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var dataItem = e.Row.DataItem as WebFormModel.FootballFixture; var chk_interestedFixture = e.Row.FindControl("chk_interestedFixture") as CheckBox; var homeHyperLink = e.Row.FindControl("hl_homeTeamLink") as HyperLink; var awayHyperLink = e.Row.FindControl("hl_awayTeamLink") as HyperLink; homeHyperLink.NavigateUrl = GetRouteUrl("FootballTeamById", new { TeamId = dataItem.AwayTeam.TeamId }); awayHyperLink.NavigateUrl = GetRouteUrl("FootballTeamById", new { TeamId = dataItem.AwayTeam.TeamId }); if (dataItem != null) { chk_interestedFixture.Checked = true; // 리그 5위 이상 팀 Bold체 var leaugeStandings = Singleton.Get <RedisCacheManager>() .Get <IList <WebFormModel.FootballStandings> > ( () => RequestLoader.FootballStandingsByLeagueId(dataItem.LeagueId), RequestLoader.Locker_FootballStandingsByLeagueId, DateTime.Now.AddHours(4), RedisKeyMaker.FootballStandingsByLeagueId(dataItem.LeagueId) ); var homeStandingInfo = leaugeStandings.Where(elem => elem.TeamId == dataItem.HomeTeam.TeamId).FirstOrDefault(); var awayStandingInfo = leaugeStandings.Where(elem => elem.TeamId == dataItem.AwayTeam.TeamId).FirstOrDefault(); if (homeStandingInfo?.Rank <= 5) { homeHyperLink.Font.Bold = true; } if (awayStandingInfo?.Rank <= 5) { awayHyperLink.Font.Bold = true; } } // 단폴픽 체크 var prediction = Singleton.Get <RedisCacheManager>() .Get <IList <WebFormModel.FootballPrediction> > ( () => RequestLoader.FootballPredictionByFixtureId(dataItem.FixtureId), RequestLoader.Locker_FootballPredictionByFixtureId, DateTime.Now.AddDays(1), RedisKeyMaker.FootballPredictionByFixtureId(dataItem.FixtureId) ).FirstOrDefault(); if (prediction?.MatchWinner?.Trim(' ').Length == 1) { e.Row.BackColor = Color.LightGreen; } } }
public IEnumerable <WebFormModel.FootballStandings> GetStandings() { if (_searchLeagueID == 0 || _searchTeamIDs == null || _searchTeamIDs.Length < 2) { return(null); } var standings = Singleton.Get <RedisCacheManager>() .Get <IList <WebFormModel.FootballStandings> > ( () => RequestLoader.FootballStandingsByLeagueId(_searchLeagueID), RequestLoader.Locker_FootballStandingsByLeagueId, DateTime.Now.AddHours(1), RedisKeyMaker.FootballStandingsByLeagueId(_searchLeagueID) ); return(standings); }
protected void Form_fixture_DataBound(object sender, EventArgs e) { if (form_fixture.Row != null) { var dataItem = this.form_fixture.DataItem as WebFormModel.FootballFixture; // Load data var standings = Singleton.Get <RedisCacheManager>() .Get <IList <WebFormModel.FootballStandings> > ( () => RequestLoader.FootballStandingsByLeagueId(dataItem.LeagueId), RequestLoader.Locker_FootballStandingsByLeagueId, DateTime.Now.AddHours(1), RedisKeyMaker.FootballStandingsByLeagueId(dataItem.LeagueId) ); var homeTeamStatistics = Singleton.Get <RedisCacheManager>() .Get <WebFormModel.FootballTeamStatistics> ( () => RequestLoader.FootballTeamStatisticsByLeagueIDAndTeamId(dataItem.LeagueId, dataItem.HomeTeam.TeamId), RequestLoader.Locker_FootballTeamStatisticsByLeagueIDAndTeamId, DateTime.Now.AddHours(12), RedisKeyMaker.FootballTeamStatisticsByLeagueIdAndTeamId(dataItem.LeagueId, dataItem.HomeTeam.TeamId) ); var awayTeamStatistics = Singleton.Get <RedisCacheManager>() .Get <WebFormModel.FootballTeamStatistics> ( () => RequestLoader.FootballTeamStatisticsByLeagueIDAndTeamId(dataItem.LeagueId, dataItem.AwayTeam.TeamId), RequestLoader.Locker_FootballTeamStatisticsByLeagueIDAndTeamId, DateTime.Now.AddHours(12), RedisKeyMaker.FootballTeamStatisticsByLeagueIdAndTeamId(dataItem.LeagueId, dataItem.AwayTeam.TeamId) ); // page process var homeStandingInfo = standings.Where(elem => elem.TeamId == dataItem.HomeTeam.TeamId).FirstOrDefault(); var awayStandingInfo = standings.Where(elem => elem.TeamId == dataItem.AwayTeam.TeamId).FirstOrDefault(); // 홈 순위, 최근 결과 if (homeStandingInfo != null) { var lbl_homeRank = this.form_fixture.Row.FindControl("lbl_homeRank") as Label; lbl_homeRank.Text = homeStandingInfo.Rank.ToString(); if (homeStandingInfo.Forme != null) { for (int i = 0; i < homeStandingInfo.Forme.Length; i++) { var label = this.form_fixture.Row.FindControl($"home_form_{i}") as Label; label.Text = homeStandingInfo.Forme[homeStandingInfo.Forme.Length - 1 - i].ToString(); if (label.Text.Equals("W")) { label.ForeColor = Color.Green; } else if (label.Text.Equals("L")) { label.ForeColor = Color.Red; } else { label.ForeColor = Color.Orange; } } } var lbl_homePoint = this.form_fixture.Row.FindControl("lbl_homePoint") as Label; lbl_homePoint.Text = homeStandingInfo.Points.ToString(); } // 원정 순위, 최근 결과 if (awayStandingInfo != null) { var lbl_awayRank = this.form_fixture.Row.FindControl("lbl_awyaRank") as Label; lbl_awayRank.Text = awayStandingInfo.Rank.ToString(); if (awayStandingInfo.Forme != null) { for (int i = 0; i < awayStandingInfo.Forme.Length; i++) { var label = this.form_fixture.Row.FindControl($"away_form_{i}") as Label; label.Text = awayStandingInfo.Forme[awayStandingInfo.Forme.Length - 1 - i].ToString(); if (label.Text.Equals("W")) { label.ForeColor = Color.Green; } else if (label.Text.Equals("L")) { label.ForeColor = Color.Red; } else { label.ForeColor = Color.Orange; } } } var lbl_awayPoint = this.form_fixture.Row.FindControl("lbl_awayPoint") as Label; lbl_awayPoint.Text = awayStandingInfo.Points.ToString(); } // 전적 var lbl_homeTotalRecord = this.form_fixture.Row.FindControl("lbl_homeTotalRecord") as Label; lbl_homeTotalRecord.Text = $"{homeTeamStatistics.Matchs.Wins.Total}/{homeTeamStatistics.Matchs.Draws.Total}/{homeTeamStatistics.Matchs.Loses.Total} " + $"({homeTeamStatistics.Matchs.Wins.Home}/{homeTeamStatistics.Matchs.Draws.Home}/{homeTeamStatistics.Matchs.Loses.Home})"; var lbl_awayTotalRecord = this.form_fixture.Row.FindControl("lbl_awayTotalRecord") as Label; lbl_awayTotalRecord.Text = $"({awayTeamStatistics.Matchs.Wins.Away}/{awayTeamStatistics.Matchs.Draws.Away}/{awayTeamStatistics.Matchs.Loses.Away}) " + $"{awayTeamStatistics.Matchs.Wins.Total}/{awayTeamStatistics.Matchs.Draws.Total}/{awayTeamStatistics.Matchs.Loses.Total}"; // 평균 득점 var lbl_homeGoalsAvg = this.form_fixture.Row.FindControl("lbl_homeGoalsAvg") as Label; lbl_homeGoalsAvg.Text = $"{homeTeamStatistics.GoalsAvg.GoalsFor.Total} ({homeTeamStatistics.GoalsAvg.GoalsFor.Home})"; var lbl_awayGoalsAvg = this.form_fixture.Row.FindControl("lbl_awayGoalsAvg") as Label; lbl_awayGoalsAvg.Text = $"({awayTeamStatistics.GoalsAvg.GoalsFor.Away}) {awayTeamStatistics.GoalsAvg.GoalsFor.Total}"; // 평균 실점 var lbl_homeGoalAgainst = this.form_fixture.Row.FindControl("lbl_homeGoalAgainst") as Label; lbl_homeGoalAgainst.Text = $"{homeTeamStatistics.GoalsAvg.GoalsAgainst.Total} ({homeTeamStatistics.GoalsAvg.GoalsAgainst.Home})"; var lbl_awayGoalAgainst = this.form_fixture.Row.FindControl("lbl_awayGoalAgainst") as Label; lbl_awayGoalAgainst.Text = $"({awayTeamStatistics.GoalsAvg.GoalsAgainst.Away}) {awayTeamStatistics.GoalsAvg.GoalsAgainst.Total}"; // 최근 6경기 득실점 var lbl_homeLastSixPoints = this.form_fixture.Row.FindControl("lbl_homeLastSixPoints") as Label; lbl_homeLastSixPoints.Text = dataItem.HomeLateSixGoalPoints; var lbl_awayLastSixPoints = this.form_fixture.Row.FindControl("lbl_awayLastSixPoints") as Label; lbl_awayLastSixPoints.Text = dataItem.AwayLateSixGoalPoints; // 홈/원정 각 3경기 득실점 var lbl_homeLastThreePoints = this.form_fixture.Row.FindControl("lbl_homeLastThreePoints") as Label; lbl_homeLastThreePoints.Text = dataItem.HomeLateThreeGoalPoints; var lbl_awayLastThreePoints = this.form_fixture.Row.FindControl("lbl_awayLastThreePoints") as Label; lbl_awayLastThreePoints.Text = dataItem.AwayLateThreeGoalPoints; // 회복기간 var lbl_homeRecoveryDays = this.form_fixture.Row.FindControl("lbl_homeRecoveryDays") as Label; lbl_homeRecoveryDays.Text = dataItem.HomeRecoveryDays; var lbl_awayRecoveryDays = this.form_fixture.Row.FindControl("lbl_awayRecoveryDays") as Label; lbl_awayRecoveryDays.Text = dataItem.AwayRecoveryDays; } }
protected void GV_FootballFixtures_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var dataItem = e.Row.DataItem as WebFormModel.FootballFixture; var chk_interestedFixture = e.Row.FindControl("chk_interestedFixture") as CheckBox; var homeHyperLink = e.Row.FindControl("hl_homeTeamLink") as HyperLink; var awayHyperLink = e.Row.FindControl("hl_awayTeamLink") as HyperLink; homeHyperLink.NavigateUrl = GetRouteUrl("FootballTeamById", new { TeamId = dataItem.AwayTeam.TeamId }); awayHyperLink.NavigateUrl = GetRouteUrl("FootballTeamById", new { TeamId = dataItem.AwayTeam.TeamId }); if (dataItem != null) { // 관심경기 선택 여부 // 관심 경기 데이터 가져오기 var interestedFixtures = Singleton.Get <RedisCacheManager>() .GetNullable <IList <WebFormModel.FootballFixture> > ( RedisKeyMaker.FootballInterestedFixture() ); bool isInterestedFixture = interestedFixtures?.Where(elem => elem.FixtureId == dataItem.FixtureId).FirstOrDefault() != null; chk_interestedFixture.Checked = isInterestedFixture; // 리그 5위 이상 팀 Bold체 var leaugeStandings = Singleton.Get <RedisCacheManager>() .Get <IList <WebFormModel.FootballStandings> > ( () => RequestLoader.FootballStandingsByLeagueId(dataItem.LeagueId), RequestLoader.Locker_FootballStandingsByLeagueId, DateTime.Now.AddHours(4), RedisKeyMaker.FootballStandingsByLeagueId(dataItem.LeagueId) ); var homeStandingInfo = leaugeStandings.Where(elem => elem.TeamId == dataItem.HomeTeam.TeamId).FirstOrDefault(); var awayStandingInfo = leaugeStandings.Where(elem => elem.TeamId == dataItem.AwayTeam.TeamId).FirstOrDefault(); if (homeStandingInfo?.Rank <= 5) { homeHyperLink.Font.Bold = true; } if (awayStandingInfo?.Rank <= 5) { awayHyperLink.Font.Bold = true; } // 팀 통계에 따른 폰트 색상 //var homeTeamStatistics = Singleton.Get<RedisCacheManager>() //.Get<WebFormModel.FootballTeamStatistics> //( // () => RequestLoader.FootballTeamStatisticsByLeagueIDAndTeamID(dataItem.LeagueID, dataItem.HomeTeam.TeamID), // RequestLoader.Locker_FootballTeamStatisticsByLeagueIDAndTeamID, // DateTime.Now.AddHours(12), // RedisKeyMaker.FootballTeamStatisticsByLeagueIDAndTeamID(dataItem.LeagueID, dataItem.HomeTeam.TeamID) //); //var awayTeamStatistics = Singleton.Get<RedisCacheManager>() //.Get<WebFormModel.FootballTeamStatistics> //( // () => RequestLoader.FootballTeamStatisticsByLeagueIDAndTeamID(dataItem.LeagueID, dataItem.AwayTeam.TeamID), // RequestLoader.Locker_FootballTeamStatisticsByLeagueIDAndTeamID, // DateTime.Now.AddHours(12), // RedisKeyMaker.FootballTeamStatisticsByLeagueIDAndTeamID(dataItem.LeagueID, dataItem.AwayTeam.TeamID) //); //CheckTeamStaticAndApplyColor(homeTeamStatistics, homeHyperLink); //CheckTeamStaticAndApplyColor(awayTeamStatistics, awayHyperLink); // 팀 최근 6경기 득실점에 따른 폰트 색상 //var homefixtures = Singleton.Get<RedisCacheManager>() // .Get<IList<WebFormModel.FootballFixture>> // ( // () => RequestLoader.FootballFixtureByTeamID(dataItem.HomeTeam.TeamID), // RequestLoader.Locker_FootballFixtureByTeamID, // DateTime.Now.AddHours(12), // RedisKeyMaker.FootballFixtureByTeamID(dataItem.HomeTeam.TeamID) // ).Where(elem => elem.EventDate < DateTime.Now) // .OrderByDescending(elem => elem.EventDate); //// 홈팀 최근 6경기 득실점 //int fixtureCnt = 0; //int goalCnt = 0; //int goalAgainst = 0; //foreach (var selectedfixture in homefixtures) //{ // if (string.IsNullOrEmpty(selectedfixture.Score.FullTime) // || selectedfixture.LeagueID != dataItem.LeagueID) // continue; // // 최근 5경기만.. // if (fixtureCnt >= 6) // break; // bool isHomeTeam = selectedfixture.HomeTeam.TeamID == dataItem.HomeTeam.TeamID; // string[] scoreSplit = selectedfixture.Score.FullTime.Split('-'); // goalCnt += int.Parse(scoreSplit[isHomeTeam ? 0 : 1]); // goalAgainst += int.Parse(scoreSplit[isHomeTeam ? 1 : 0]); // fixtureCnt++; //} //CheckTeamGoalAgainstAndApplyColor(goalCnt, goalAgainst, homeHyperLink); //var awayfixtures = Singleton.Get<RedisCacheManager>() // .Get<IList<WebFormModel.FootballFixture>> // ( // () => RequestLoader.FootballFixtureByTeamID(dataItem.AwayTeam.TeamID), // RequestLoader.Locker_FootballFixtureByTeamID, // DateTime.Now.AddHours(12), // RedisKeyMaker.FootballFixtureByTeamID(dataItem.AwayTeam.TeamID) // ).Where(elem => elem.EventDate < DateTime.Now) // .OrderByDescending(elem => elem.EventDate); //// 어웨이팀 최근 6경기 득실점 //fixtureCnt = 0; //goalCnt = 0; //goalAgainst = 0; //foreach (var selectedfixture in awayfixtures) //{ // if (string.IsNullOrEmpty(selectedfixture.Score.FullTime) // || selectedfixture.LeagueID != dataItem.LeagueID) // continue; // // 최근 6경기만.. // if (fixtureCnt >= 6) // break; // bool isHomeTeam = selectedfixture.HomeTeam.TeamID == dataItem.AwayTeam.TeamID; // string[] scoreSplit = selectedfixture.Score.FullTime.Split('-'); // goalCnt += int.Parse(scoreSplit[isHomeTeam ? 0 : 1]); // goalAgainst += int.Parse(scoreSplit[isHomeTeam ? 1 : 0]); // fixtureCnt++; //} //CheckTeamGoalAgainstAndApplyColor(goalCnt, goalAgainst, awayHyperLink); //경기 예측(단폴픽 체크) var prediction = Singleton.Get <RedisCacheManager>() .Get <IList <WebFormModel.FootballPrediction> > ( () => RequestLoader.FootballPredictionByFixtureId(dataItem.FixtureId), RequestLoader.Locker_FootballPredictionByFixtureId, DateTime.Now.AddDays(1), RedisKeyMaker.FootballPredictionByFixtureId(dataItem.FixtureId) ).FirstOrDefault(); if (prediction?.MatchWinner?.Trim(' ').Length == 1) { e.Row.BackColor = Color.LightGreen; } } } }