private void PlayerDump(
     PlayerGameLogViewModel totalLog,
     string p)
 {
     _weekReport.Player       = p;
     _weekReport.PlayerSlug   = string.Empty;
     _weekReport.WeekStarts   = WeekStarts;
     _weekReport.Hitters      = Hitters;
     _weekReport.JerseyNumber = _rosterMaster.JerseyNumber(
         FantasyTeam,
         p,
         Hitters);
     totalLog.Add(_weekReport.DumpWeek(0));
 }
        public PlayerGameLogViewModel DumpSeason()
        {
            SetFantasyTeam();
            var totalLog = new PlayerGameLogViewModel
            {
                HasGame = true
            };
            var playerSlug = Utility.PlayerSlug(Player);

            for (int d = 0; d < (6 * 30); d++)
            {
                var queryDate = SeasonStarts.AddDays(d);
                if (queryDate.Equals(DateTime.Now.Date.AddDays(-1)))
                {
                    break;
                }

                var logResult = _gameLogRepository.Submit(
                    queryDate: queryDate,
                    playerSlug: playerSlug);

                if (logResult.IsSuccess)
                {
                    var log = logResult.Value;
                    totalLog.Add(log);
                    if (log.HasGame)
                    {
                        totalLog.IsPitcher = log.IsPitcher;
                        totalLog.IsBatter  = log.IsBatter;
                    }
                    if (d == 0)
                    {
                        DisplayHeading(log, _rosterMaster);
                    }
                    if (log.HasGame)
                    {
                        Console.WriteLine(log.DateLine());
                    }
                }
            }
            DisplayTotals(totalLog);
            return(totalLog);
        }
        public PlayerGameLogViewModel DumpSeason()
        {
            var totalLog = new PlayerGameLogViewModel
            {
                HasGame = true
            };

            System.Collections.Generic.List <string> roster = GetRoster(
                _rosterMaster,
                FantasyTeam,
                SeasonStarts);
            foreach (var p in roster)
            {
                _seasonReport.Player       = p;
                _seasonReport.SeasonStarts = SeasonStarts;
//				_seasonReport.JerseyNumber = _rosterMaster.BatterNumber(FantasyTeam, p);
                totalLog.Add(_seasonReport.DumpSeason());
            }
            DisplayTotals(totalLog);
            return(totalLog);
        }
        private decimal TallyLogs(
            DateTime startDate,
            DateTime endDate,
            PlayerGameLogViewModel totalLog,
            string playerSlug)
        {
            decimal stat;
            var     daysToReport = DaysInRange(
                endDate,
                startDate);
            var queryDate = startDate;

            for (int d = 0; d < daysToReport; d++)
            {
                var result = _gameLogRepository.Submit(
                    queryDate: queryDate,
                    playerSlug: playerSlug);

                if (result.IsSuccess)
                {
                    var log = result.Value;
                    totalLog.Add(log);
                    if (log.HasGame)
                    {
                        totalLog.IsPitcher = log.IsPitcher;
                        totalLog.IsBatter  = log.IsBatter;
                    }
                }
                queryDate = queryDate.AddDays(1);
                if (queryDate.Equals(DateTime.Now.Date.AddDays(-1)) &&
                    Utility.ItsBeforeFour())
                {
                    break;
                }
            }
            ;
            totalLog.WOBA = totalLog.Woba();
            stat          = totalLog.WOBA;
            return(stat);
        }
Exemple #5
0
        public PlayerGameLogViewModel DumpWeek(int playerNo)
        {
            SetOutput();
            if (IncludePriorWeek)
            {
                WeekStarts = WeekStarts.AddDays(-7);
            }

            var totalLog = new PlayerGameLogViewModel
            {
                HasGame   = true,
                IsBatter  = Hitters,
                IsPitcher = !Hitters
            };

            if (string.IsNullOrEmpty(PlayerSlug))
            {
                PlayerSlug = Utility.PlayerSlug(Player);
            }
            FantasyTeam = _rosterMaster.GetOwnerOf(Player);
            if (playerNo > 0)
            {
                JerseyNumber = playerNo;
            }
            var daysToReport = 7;

            if (IncludePriorWeek)
            {
                daysToReport += 7;
            }
            for (int d = 0; d < daysToReport; d++)
            {
                var queryDate = WeekStarts.AddDays(d);
                if (queryDate.Equals(DateTime.Now.Date.AddDays(-1)) &&
                    Utility.ItsBeforeFour())
                {
                    break;
                }

                var result = _gameLogRepository.Submit(
                    queryDate: queryDate,
                    playerSlug: PlayerSlug);

                if (result.IsSuccess)
                {
                    var log = result.Value;
                    log.IsBatter  = Hitters;
                    log.IsPitcher = !Hitters;
                    totalLog.Add(log);
                    if (log.HasGame)
                    {
                        totalLog.IsPitcher = log.IsPitcher;
                        totalLog.IsBatter  = log.IsBatter;
                    }
                    if (d == 0)
                    {
                        DisplayHeading(log, _rosterMaster);
                    }
                    Console.WriteLine(log.DateLine());
                }
            }
            DisplayTotals(totalLog);
            CloseOutput();
            return(totalLog);
        }