Пример #1
0
        public static async Task <bool> Admin_DeletePick(FootballVIPMatchInfo matchInfo)
        {
            var actions = matchInfo.PredictionPicks.Select(elem => elem.Title).ToArray();

            int intResult = await MaterialDialog.Instance.SelectActionAsync("추천픽 관리", actions, DialogConfiguration.DefaultSimpleDialogConfiguration);

            if (intResult == -1)
            {
                return(false);
            }

            var selectedPick = matchInfo.PredictionPicks[intResult];

            // Server Request
            var webApiService = ShinyHost.Resolve <IWebApiService>();

            var server_result = await webApiService.RequestAsyncWithToken <O_DELETE_VIP_PICK>(new WebRequestContext
            {
                SerializeType = SerializeType.MessagePack,
                MethodType    = WebMethodType.POST,
                BaseUrl       = AppConfig.PoseWebBaseUrl,
                ServiceUrl    = FootballProxy.ServiceUrl,
                SegmentGroup  = FootballProxy.P_DELETE_VIP_PICK,
                PostData      = new I_DELETE_VIP_PICK
                {
                    FixtureId = matchInfo.Id,
                    MainLabel = selectedPick.MainLabel,
                    SubLabel  = selectedPick.SubLabel,
                }
            });

            if (server_result == null)
            {
                return(false);
            }

            if (server_result.IsSuccess)
            {
                matchInfo.PredictionPicks.RemoveAt(intResult);
            }

            return(server_result.IsSuccess);
        }
Пример #2
0
        public FootballMatchInfo Convert(FootballVIPMatchInfo vipMatchInfo)
        {
            var return_value = new FootballMatchInfo
            {
                Id = vipMatchInfo.Id,
                League_CountryName = vipMatchInfo.League_CountryName,
                League_CountryLogo = vipMatchInfo.League_CountryLogo,
                LeagueName         = vipMatchInfo.LeagueName,
                LeagueLogo         = vipMatchInfo.LeagueLogo,
                LeagueType         = vipMatchInfo.LeagueType,

                HomeTeamId       = vipMatchInfo.HomeTeamId,
                HomeName         = vipMatchInfo.HomeName,
                HomeLogo         = vipMatchInfo.HomeLogo,
                Home_CountryName = vipMatchInfo.Home_CountryName,
                HomeScore        = vipMatchInfo.HomeScore,

                AwayTeamId       = vipMatchInfo.AwayTeamId,
                AwayName         = vipMatchInfo.AwayName,
                AwayLogo         = vipMatchInfo.AwayLogo,
                Away_CountryName = vipMatchInfo.Away_CountryName,
                AwayScore        = vipMatchInfo.AwayScore,

                MatchStatus = vipMatchInfo.MatchStatus,
                MatchTime   = vipMatchInfo.MatchTime,
                Round       = vipMatchInfo.Round,

                IsAlarmed    = vipMatchInfo.IsAlarmed,
                IsBookmarked = vipMatchInfo.IsBookmarked,

                IsPredicted   = vipMatchInfo.IsPredicted,
                IsRecommended = vipMatchInfo.IsRecommended,
                MaxRating     = vipMatchInfo.MaxRating,
                HasOdds       = vipMatchInfo.HasOdds,
            };

            return(return_value);
        }
Пример #3
0
        public FootballVIPMatchInfo Convert(FootballVIPFixtureDetail[] vipFixtureDetails)
        {
            if (vipFixtureDetails == null ||
                vipFixtureDetails.Length == 0)
            {
                return(null);
            }

            var matchInfo = ShinyHost.Resolve <FixtureDetailToMatchInfo>().Convert(vipFixtureDetails.First());

            var returnValue = new FootballVIPMatchInfo()
            {
                Id = matchInfo.Id,
                League_CountryName = matchInfo.League_CountryName,
                League_CountryLogo = matchInfo.League_CountryLogo,
                LeagueName         = matchInfo.LeagueName,
                LeagueLogo         = matchInfo.LeagueLogo,
                LeagueType         = matchInfo.LeagueType,

                HomeTeamId       = matchInfo.HomeTeamId,
                HomeName         = matchInfo.HomeName,
                HomeLogo         = matchInfo.HomeLogo,
                Home_CountryName = matchInfo.Home_CountryName,
                HomeScore        = matchInfo.HomeScore,

                AwayTeamId       = matchInfo.AwayTeamId,
                AwayName         = matchInfo.AwayName,
                AwayLogo         = matchInfo.AwayLogo,
                Away_CountryName = matchInfo.Away_CountryName,
                AwayScore        = matchInfo.AwayScore,

                MatchStatus = matchInfo.MatchStatus,
                MatchTime   = matchInfo.MatchTime,
                Round       = matchInfo.Round,

                IsAlarmed    = matchInfo.IsAlarmed,
                IsBookmarked = matchInfo.IsBookmarked,

                IsPredicted   = matchInfo.IsPredicted,
                IsRecommended = matchInfo.IsRecommended,
                MaxRating     = matchInfo.MaxRating,
                HasOdds       = matchInfo.HasOdds,
            };

            // parsing prediction
            var predTitleConverter = ShinyHost.Resolve <PredictionLabelToString>();

            returnValue.PredictionPicks = new List <FootballPredictionPickInfo>();
            foreach (var vipFixtureDetail in vipFixtureDetails)
            {
                var prediction = new FootballPredictionPickInfo
                {
                    Title     = predTitleConverter.Convert(vipFixtureDetail.MainLabel, vipFixtureDetail.SubLabel),
                    Rate      = vipFixtureDetail.Grade / 2.0,
                    IsHit     = vipFixtureDetail.IsHit,
                    MainLabel = vipFixtureDetail.MainLabel,
                    SubLabel  = vipFixtureDetail.SubLabel,
                };

                returnValue.PredictionPicks.Add(prediction);
            }

            returnValue.PredictionPicks = returnValue.PredictionPicks.OrderByDescending(elem => elem.Rate).ToList();

            return(returnValue);
        }