コード例 #1
0
        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;
                }
            }
        }
コード例 #2
0
        public WebFormModel.FootballPrediction GetFootballPrediction([RouteData] int fixtureID)
        {
            //TODO FixtureDetail 버전으로 바꾸기..
            var predictions = Singleton.Get <RedisCacheManager>()
                              .Get <IList <WebFormModel.FootballPrediction> >
                              (
                () => RequestLoader.FootballPredictionByFixtureId(fixtureID),
                RequestLoader.Locker_FootballPredictionByFixtureId,
                DateTime.Now.AddDays(1),
                RedisKeyMaker.FootballPredictionByFixtureId(fixtureID)
                              );

            return(predictions.FirstOrDefault());
        }
コード例 #3
0
        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;
                    }
                }
            }
        }