예제 #1
0
        public TeamPlayerPage(int idTeam)
        {
            InitializeComponent();

            PlayersVM playerVM = new PlayersVM(idTeam);

            BindingContext = playerVM;
        }
예제 #2
0
        void UpdateViewModel(string tipo)
        {
            PlayersVM playersVM = new PlayersVM(tipo);

            BindingContext = playersVM;

            jugadoresListView.Header = tipo;
        }
        public async Task <IActionResult> Index()
        {
            (List <PlayerRespM> playerRespMs, ModelStateDictionary modelStateDictionary) = await playersServiceManager.GetAllAsync(ModelState);

            if (modelStateDictionary.IsValid)
            {
                List <PlayerVM> playerVMs = mapper.Map <List <PlayerRespM>, List <PlayerVM> >(playerRespMs);

                int ranking = 1;
                playerVMs.OrderByDescending(o => o.Winnings)
                .Select(s => { s.Rank = ranking++; return(s); })
                .ToList();

                PlayersVM playersVM = new PlayersVM()
                {
                    Players = playerVMs
                };

                return(View(playersVM));
            }

            return(View());
        }
예제 #4
0
        public StatsYearWeek UpdateStat(PlayersVM fromPlay, StatsYearWeek fromSYWList, string note) {
            //Take fromPlayer statID and find stat
            //Add in fumbles later, confusing, 
            //whenever a pass, 4 with no playerId comes up, 7 with no playerID -> these will get screened out because no playerID   figure out later
            //Penalties could f**k up yardage

            switch (fromPlay.StatId) {
                case 10:
                    //rush yds
                    fromSYWList.RushingStats.RushAtt += 1;
                    fromSYWList.RushingStats.RushYds += fromPlay.Yards;

                    fromSYWList.currentPts += Convert.ToDecimal((fromPlay.Yards / 10.00));
                    //RushLng Don't add in right now

                    break;
                case 11:
                    //rushTDyds
                    fromSYWList.RushingStats.RushAtt += 1;
                    fromSYWList.RushingStats.RushYds += fromPlay.Yards;

                    fromSYWList.currentPts += Convert.ToDecimal((fromPlay.Yards / 10.00));
                    //RushLngTD Don't add in right now
                    if (note == "TD") {
                        fromSYWList.RushingStats.RushTds += 1;
                        fromSYWList.currentPts += 6;
                    }
                    else
                        throw new Exception("Has RushingTDYards but note is not TD <- check play");
                    break;
                case 14:
                    //passInc
                    fromSYWList.PassingStats.PassAtt += 1;
                    break;
                case 15:
                    //PassYrds
                    fromSYWList.PassingStats.PassYds += fromPlay.Yards;
                    fromSYWList.currentPts += Convert.ToDecimal((fromPlay.Yards / 10.00));
                    break;
                case 16:
                    //PassYrdsTD
                    fromSYWList.PassingStats.PassYds += fromPlay.Yards;
                    fromSYWList.currentPts += Convert.ToDecimal((fromPlay.Yards / 10.00));

                    if (note == "TD") {
                        fromSYWList.PassingStats.PassTds += 1;
                        fromSYWList.currentPts += 6;
                    }
                    else
                        throw new Exception("Has PassTDYards but note is not TD <- check play");
                    break;
                case 19:
                    //PassINT
                    if (note == "INT") {
                        fromSYWList.PassingStats.PassInts += 1;
                        fromSYWList.currentPts += -2;
                    }
                    //add int Exception it triggers on chargersvssteelers

                    break;
                case 20:
                    //QBSack
                    fromSYWList.PassingStats.PassAtt += 1;
                    //sack yardage goes in to team total but qb indv stats do not change

                    break;
                case 21:
                    //RecYds
                    fromSYWList.ReceivingStats.Rec += 1;
                    fromSYWList.ReceivingStats.RecYds += fromPlay.Yards;

                    fromSYWList.currentPts += Convert.ToDecimal((fromPlay.Yards / 10.00));
                    //add in RecLng Later
                    break;
                case 22:
                    //RecYrdsTD
                    fromSYWList.ReceivingStats.Rec += 1;
                    fromSYWList.ReceivingStats.RecYds += fromPlay.Yards;
                    fromSYWList.ReceivingStats.RecTds += 1;

                    fromSYWList.currentPts += Convert.ToDecimal((fromPlay.Yards / 10.00));
                    fromSYWList.currentPts += 6;
                    //add in RecLngTD later
                    break;
                case 69:
                    //FGMiss
                    if (note == "FGM") {
                        fromSYWList.KickingStats.Fga += 1;
                        fromSYWList.KickingStats.Fgyds += fromPlay.Yards;
                    }
                    else
                        throw new Exception("statID says FGM, but note doesn't <- check play");
                    break;
                case 70:
                    //FG
                    if (note == "FG") {
                        fromSYWList.KickingStats.Fga += 1;
                        fromSYWList.KickingStats.Fgm += 1;
                        fromSYWList.KickingStats.Fgyds += fromPlay.Yards;

                        fromSYWList.currentPts += Convert.ToDecimal(Math.Floor(fromPlay.Yards / 10.00));
                    }
                    else
                        throw new Exception("statID says FG, but note doesn't <- check play");
                    break;
                case 71:
                    //Guessing this is XPMISS
                    if (note == "XPM")
                        throw new Exception("THIS IS XPMISSED");
                    break;
                case 72:
                    //XP
                    if (note == "XP") {
                        fromSYWList.KickingStats.Xpa += 1;
                        fromSYWList.KickingStats.Xpmade += 1;
                        fromSYWList.KickingStats.Xptot += 1;

                        fromSYWList.currentPts += 1;
                    }
                    else
                        throw new Exception("statID says XP, but note doesn't <- check play");
                    break;
                case 111:
                    //yrds thrown cmp
                    fromSYWList.PassingStats.PassAtt += 1;
                    fromSYWList.PassingStats.PassCmp += 1;
                    break;
                case 112:
                    //yrds thrown inc
                    fromSYWList.PassingStats.PassAtt += 1;
                    break;
                case 113:
                    //YAC (For AdvStats)
                    break;
                case 115:
                    //PassTarget
                    fromSYWList.ReceivingStats.RecTrg += 1;
                    break;
                default:
                    //write out to file with plays that don't get flagged later after adding in fumbles, ko's, penalty, etc.
                    break;
            }

            return fromSYWList;
        }