Exemple #1
0
        //	[Guid("4531D5B6-268C-4AB3-81EB-57D0845E21DF")]

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (this.LoadData != null)
                {
                    var ex = new EventArgs();
                    LoadData(ex);
                }

                Label1.Text = "it works, yeah!!!!";


                string theat     = Session["TheaterID"].ToString();
                Guid   theaterId = new Guid();
                theaterId = Guid.Parse(theat);



                TheaterServices showTheater    = new TheaterServices();
                TheaterModelDTO currentTheater = new TheaterModelDTO();
                currentTheater = showTheater.GetTheater(theaterId);

                lblName.Text = currentTheater.Name;


                AddressServices showAddress    = new AddressServices();
                AddressModelDTO currentAddress = new AddressModelDTO();

                currentAddress = showAddress.GetAddress(theaterId);

                lblAddressLine1.Text = currentAddress.AddressLine1;
                lblCity.Text         = currentAddress.City;
                lblCountry.Text      = currentAddress.Country;
                lblEmail.Text        = currentAddress.Email;
                lblPhone.Text        = currentAddress.Phone;
                lblPostalCode.Text   = currentAddress.PostalCode;
                lblProvince.Text     = currentAddress.Province;

                PerformanceServices showAllPerformances = new PerformanceServices();

                GridViewPerformance.DataSource = showAllPerformances.GetPerformances(theaterId);
                GridViewPerformance.DataBind();
            }
        }
Exemple #2
0
        public List <PerformancesViewModel> BuildPerformanceViewModel(List <Match> matches, Player player)
        {
            List <PerformancesViewModel> lpvm = new List <PerformancesViewModel>();
            SoloQServices       sq            = new SoloQServices();
            PerformanceServices ps            = new PerformanceServices();

            List <Match> games         = ps.GetListMatchByRole(matches, player).OrderByDescending(x => x.gameId).ToList();
            List <int>   listChampions = games.Select(x => x.championId).Distinct().ToList();

            foreach (var championId in listChampions)
            {
                List <Match>      listMatch      = games.Where(x => x.championId == championId).ToList();
                List <MatchInfos> listMatchInfos = sq.GetListMatchInfos(listMatch);

                var lMatchupHistory = ps.GetListOpponentChampionIdWtihListMatch(listMatchInfos, player);
                foreach (var matchupHistory in lMatchupHistory)
                {
                    PerformancesViewModel pvm = new PerformancesViewModel();
                    pvm.championId         = championId;
                    pvm.timelines          = new List <TimelineViewModel>();
                    pvm.opponentChampionId = matchupHistory.opponentChampionId;
                    foreach (var matchInfos in matchupHistory.listMatch)
                    {
                        var timeline = BuildTimelineViewModel(matchInfos, player);

                        if (ps.DidPlayerWin(matchInfos, player))
                        {
                            pvm.nbVictory++;
                            timeline.win = true;
                        }
                        else
                        {
                            pvm.nbDefeat++;
                            timeline.win = false;
                        }

                        pvm.timelines.Add(timeline);
                    }
                    lpvm.Add(pvm);
                }
            }
            return(lpvm);
        }
Exemple #3
0
        //Method that extracts all data to populate the Labels and the table Performance
        private void LoadData(Guid theaterId)
        {
            //Data extraction from database

            IPerformance performanceServices = new PerformanceServices();
            IList <PerformanceModelDTO> ListOfPerformances = performanceServices.GetPerformances(theaterId);

            ITheater showTheater    = new TheaterServices();
            String   currentTheater = showTheater.GetTheater(theaterId);

            IAddress        showAddress    = new AddressServices();
            AddressModelDTO currentAddress = showAddress.GetAddress(theaterId);



            //Data transfer to Theater Model
            Myview.Model.ListOfPerformances = new List <PerformanceLine>();

            foreach (var item in ListOfPerformances)
            {
                PerformanceLine row = new PerformanceLine();
                row.PerformanceID = item.PerformanceID.ToString();
                row.Title         = item.Title;
                row.Date          = item.Date;
                row.StartingTime  = item.StartingTime;
                row.RoomNumber    = item.RoomNumber.ToString();
                row.Duration      = item.Duration;
                row.Price         = item.Price.ToString();
                Myview.Model.ListOfPerformances.Add(row);
            }

            Myview.Model.TheaterName  = currentTheater;
            Myview.Model.AddressLine1 = currentAddress.AddressLine1;
            Myview.Model.City         = currentAddress.City;
            Myview.Model.Country      = currentAddress.Country;
            Myview.Model.Province     = currentAddress.Province;
            Myview.Model.PostalCode   = currentAddress.PostalCode;
            Myview.Model.Phone        = currentAddress.Phone;
            Myview.Model.Email        = currentAddress.Email;
        }
Exemple #4
0
        public TimelineViewModel BuildTimelineViewModel(MatchInfos matchInfos, Player player)
        {
            TimelineViewModel   tvm = new TimelineViewModel();
            PerformanceServices ps  = new PerformanceServices();
            TimelineServices    ts  = new TimelineServices();
            SoloQServices       sq  = new SoloQServices();
            int participantId       = ps.GetParticipantId(matchInfos, player);
            var participant         = ps.GetParticipantById(matchInfos, participantId);

            var opponent = ps.GetOpponentNameByOpponentId(matchInfos, player);
            var oppponentParticipantId = opponent.Item2;
            var opponantParticipant    = ps.GetParticipantById(matchInfos, oppponentParticipantId);
            var frames = sq.GetTimeLinesMatchInfos(matchInfos.gameId.ToString());

            var timeline = matchInfos.participants.Where(x => x.participantId == participantId).FirstOrDefault().timeline;

            tvm.participantId = timeline.participantId;

            tvm.kills        = matchInfos.participants.Where(x => x.participantId == participantId).FirstOrDefault().stats.kills;
            tvm.deaths       = matchInfos.participants.Where(x => x.participantId == participantId).FirstOrDefault().stats.deaths;
            tvm.assists      = matchInfos.participants.Where(x => x.participantId == participantId).FirstOrDefault().stats.assists;
            tvm.opponentName = opponent.Item1;
            tvm.timestamp    = matchInfos.gameCreation;
            tvm.gameId       = matchInfos.gameId;

            var spell         = ps.GetSummonerSpellsByParticipantId(matchInfos, participantId);
            var opponentSpell = ps.GetSummonerSpellsByParticipantId(matchInfos, oppponentParticipantId);

            tvm.spell1Id         = spell.Item1;
            tvm.spell2Id         = spell.Item2;
            tvm.opponentSpell1Id = opponentSpell.Item1;
            tvm.opponentSpell2Id = opponentSpell.Item2;

            tvm.primaryKey              = ps.GetPrimaryRune(matchInfos, participantId);
            tvm.primaryKeyStyle         = ps.GetPrimaryStyleRune(matchInfos, participantId);
            tvm.opponentPrimaryKey      = ps.GetPrimaryRune(matchInfos, oppponentParticipantId);
            tvm.opponentPrimaryKeyStyle = ps.GetPrimaryStyleRune(matchInfos, oppponentParticipantId);


            tvm.creepsPerMinDeltas = new CreepsPerMinDeltasViewModel();
            tvm.creepsPerMinDeltas.firstPartTime  = timeline.creepsPerMinDeltas?.firstPartTime;
            tvm.creepsPerMinDeltas.secondPartTime = timeline.creepsPerMinDeltas?.secondPartTime;

            tvm.csDiffPerMinDeltas = new CsDiffPerMinDeltasViewModel();

            //results are not working well or bad calculated
            //tvm.csDiffPerMinDeltas.firstPartTime = timeline.csDiffPerMinDeltas?.firstPartTime;
            //tvm.csDiffPerMinDeltas.secondPartTime = timeline.csDiffPerMinDeltas?.secondPartTime;

            tvm.csDiffPerMinDeltas.fiveMin    = ts.getCsDiffByTimingMark(frames, participantId, oppponentParticipantId, 5);
            tvm.csDiffPerMinDeltas.tenMin     = ts.getCsDiffByTimingMark(frames, participantId, oppponentParticipantId, 10);
            tvm.csDiffPerMinDeltas.fifteenMin = ts.getCsDiffByTimingMark(frames, participantId, oppponentParticipantId, 15);
            tvm.csDiffPerMinDeltas.twentyMin  = ts.getCsDiffByTimingMark(frames, participantId, oppponentParticipantId, 20);

            tvm.goldPerMinDeltas = new GoldPerMinDeltasViewModel();
            tvm.goldPerMinDeltas.firstPartTime  = timeline.goldPerMinDeltas?.firstPartTime;
            tvm.goldPerMinDeltas.secondPartTime = timeline.goldPerMinDeltas?.secondPartTime;

            tvm.damageTakenDiffPerMinDeltas = new DamageTakenDiffPerMinDeltasViewModel();
            tvm.damageTakenDiffPerMinDeltas.firstPartTime  = timeline.damageTakenDiffPerMinDeltas?.firstPartTime;
            tvm.damageTakenDiffPerMinDeltas.secondPartTime = timeline.damageTakenDiffPerMinDeltas?.secondPartTime;

            tvm.damageTakenPerMinDeltas = new DamageTakenPerMinDeltasViewModel();
            tvm.damageTakenPerMinDeltas.firstPartTime  = timeline.damageTakenPerMinDeltas?.firstPartTime;
            tvm.damageTakenPerMinDeltas.secondPartTime = timeline.damageTakenPerMinDeltas?.secondPartTime;

            tvm.xpDiffPerMinDeltas = new XpDiffPerMinDeltasViewModel();
            //tvm.xpDiffPerMinDeltas.firstPartTime = timeline.xpDiffPerMinDeltas?.firstPartTime;
            //tvm.xpDiffPerMinDeltas.secondPartTime = timeline.xpDiffPerMinDeltas?.secondPartTime;

            tvm.xpDiffPerMinDeltas.fiveMin    = ts.getXpDiffByTimingMark(frames, participantId, oppponentParticipantId, 5);
            tvm.xpDiffPerMinDeltas.tenMin     = ts.getXpDiffByTimingMark(frames, participantId, oppponentParticipantId, 10);
            tvm.xpDiffPerMinDeltas.fifteenMin = ts.getXpDiffByTimingMark(frames, participantId, oppponentParticipantId, 15);
            tvm.xpDiffPerMinDeltas.twentyMin  = ts.getXpDiffByTimingMark(frames, participantId, oppponentParticipantId, 20);

            tvm.XpPerMinDeltas = new XpPerMinDeltasViewModel();
            tvm.XpPerMinDeltas.firstPartTime  = timeline.XpPerMinDeltas?.firstPartTime;
            tvm.XpPerMinDeltas.secondPartTime = timeline.XpPerMinDeltas?.secondPartTime;

            tvm.deathCount               = new DeathCountViewModel();
            tvm.deathCount.fiveMin       = ts.GetNbDeathBetweenTimingMark(frames, participantId, 0, 5);
            tvm.deathCount.tenMin        = ts.GetNbDeathBetweenTimingMark(frames, participantId, 5, 10);
            tvm.deathCount.fifteenMin    = ts.GetNbDeathBetweenTimingMark(frames, participantId, 10, 15);
            tvm.deathCount.twentyMin     = ts.GetNbDeathBetweenTimingMark(frames, participantId, 15, 20);
            tvm.deathCount.twentyFiveMin = ts.GetNbDeathBetweenTimingMark(frames, participantId, 20, 0);
            //tvm.deathCount.thirtyMin = ts.GetNbDeathBetweenTimingMark(frames, participantId, 25, 30);

            if (player.Role == 5)
            {
                tvm.wardDestroyedCount = new WardDestroyedCountViewModel();

                tvm.wardDestroyedCount.tenMin         = ts.GetNbWardDestroyedBetweenTimingMark(frames, participantId, 0, 10);
                tvm.wardDestroyedCount.fifteenMin     = ts.GetNbWardDestroyedBetweenTimingMark(frames, participantId, 10, 15);
                tvm.wardDestroyedCount.twentyMin      = ts.GetNbWardDestroyedBetweenTimingMark(frames, participantId, 15, 20);
                tvm.wardDestroyedCount.twentyTwoMin   = ts.GetNbWardDestroyedBetweenTimingMark(frames, participantId, 20, 22);
                tvm.wardDestroyedCount.twentyFourMin  = ts.GetNbWardDestroyedBetweenTimingMark(frames, participantId, 22, 24);
                tvm.wardDestroyedCount.twentySixMin   = ts.GetNbWardDestroyedBetweenTimingMark(frames, participantId, 24, 26);
                tvm.wardDestroyedCount.twentyEightMin = ts.GetNbWardDestroyedBetweenTimingMark(frames, participantId, 26, 28);
                tvm.wardDestroyedCount.thirtyrMin     = ts.GetNbWardDestroyedBetweenTimingMark(frames, participantId, 28, 30);

                tvm.wardPutCount = new WardPutCountViewModel();

                tvm.wardPutCount.tenMin         = ts.GetNbWardPutBetweenTimingMark(frames, participantId, 0, 10);
                tvm.wardPutCount.fifteenMin     = ts.GetNbWardPutBetweenTimingMark(frames, participantId, 10, 15);
                tvm.wardPutCount.twentyMin      = ts.GetNbWardPutBetweenTimingMark(frames, participantId, 15, 20);
                tvm.wardPutCount.twentyTwoMin   = ts.GetNbWardPutBetweenTimingMark(frames, participantId, 20, 22);
                tvm.wardPutCount.twentyFourMin  = ts.GetNbWardPutBetweenTimingMark(frames, participantId, 22, 24);
                tvm.wardPutCount.twentySixMin   = ts.GetNbWardPutBetweenTimingMark(frames, participantId, 24, 26);
                tvm.wardPutCount.twentyEightMin = ts.GetNbWardPutBetweenTimingMark(frames, participantId, 26, 28);
                tvm.wardPutCount.thirtyrMin     = ts.GetNbWardPutBetweenTimingMark(frames, participantId, 28, 30);

                tvm.pinkPutCount                = new PinkPutCountViewModel();
                tvm.pinkPutCount.tenMin         = ts.GetNbPinkPutBetweenTimingMark(frames, participantId, 0, 10);
                tvm.pinkPutCount.fifteenMin     = ts.GetNbPinkPutBetweenTimingMark(frames, participantId, 10, 15);
                tvm.pinkPutCount.twentyMin      = ts.GetNbPinkPutBetweenTimingMark(frames, participantId, 15, 20);
                tvm.pinkPutCount.twentyTwoMin   = ts.GetNbPinkPutBetweenTimingMark(frames, participantId, 20, 22);
                tvm.pinkPutCount.twentyFourMin  = ts.GetNbPinkPutBetweenTimingMark(frames, participantId, 22, 24);
                tvm.pinkPutCount.twentySixMin   = ts.GetNbPinkPutBetweenTimingMark(frames, participantId, 24, 26);
                tvm.pinkPutCount.twentyEightMin = ts.GetNbPinkPutBetweenTimingMark(frames, participantId, 26, 28);
                tvm.pinkPutCount.thirtyrMin     = ts.GetNbPinkPutBetweenTimingMark(frames, participantId, 28, 30);
            }

            tvm.lane          = timeline.lane;
            tvm.role          = timeline.role;
            tvm.participantId = timeline.participantId;


            return(tvm);
        }
Exemple #5
0
        public WinratesViewModel BuildWinratesViewModel(int nbGames, Player player)
        {
            SoloQServices     sq  = new SoloQServices();
            WinratesViewModel wrm = null;
            var ps      = new PerformanceServices();
            var matches = sq.GetSoloQHistories(player.AccountId, nbGames).OrderByDescending(x => x.timestamp).ToList();

            if (matches != null)
            {
                if (player.Role != 0)
                {
                    matches = ps.GetListMatchByRole(matches, player);
                }
                wrm            = new WinratesViewModel();
                wrm.nickname   = player.Nickname;
                wrm.blueSide   = new WinratesViewModel.Side();
                wrm.redSide    = new WinratesViewModel.Side();
                wrm.totalGames = nbGames;
                wrm.role       = GlobalVar.getRoleById(player.Role);

                foreach (var match in matches)
                {
                    var matchInfos = sq.GetMatchInfo(match.gameId.ToString());
                    //savoir dans quel side il était et si il a win
                    var  team          = ps.GetPlayerTeam(matchInfos, player);
                    var  isWin         = matchInfos.teams.Where(x => x.teamId == team).FirstOrDefault()?.win;
                    bool isBlueSideWin = false;
                    if (team == 100)
                    {
                        if (isWin.ToLower() == "win")
                        {
                            wrm.blueSide.totalGames++;
                            wrm.blueSide.nbWin++;
                            wrm.totalGamesOnlyMainRole++;
                            isBlueSideWin = true;
                        }
                        else if (isWin.ToLower() == "fail")
                        {
                            wrm.blueSide.totalGames++;
                            wrm.blueSide.nbLoss++;
                            wrm.totalGamesOnlyMainRole++;
                        }
                    }
                    else if (team == 200)
                    {
                        if (isWin.ToLower() == "win")
                        {
                            wrm.redSide.totalGames++;
                            wrm.redSide.nbWin++;
                            wrm.totalGamesOnlyMainRole++;
                        }
                        else if (isWin.ToLower() == "fail")
                        {
                            wrm.redSide.totalGames++;
                            wrm.redSide.nbLoss++;
                            wrm.totalGamesOnlyMainRole++;
                            isBlueSideWin = true;
                        }
                    }
                    int participantId = ps.GetParticipantId(matchInfos, player);
                    if (participantId != 0)
                    {
                        CalculateDraftPosition(wrm, matchInfos, participantId, isBlueSideWin);
                    }
                }
            }

            return(wrm);
        }