public static Batter Create(ESPNProjections.IPlayer batter) { Batter b = new Batter(); b.AuctionPrice = 0; b.FantasyTeam = string.Empty; b.Update(batter); return(b); }
public static Pitcher Create(ESPNProjections.IPlayer pitcher) { Pitcher p = new Pitcher(); p.AuctionPrice = 0; p.FantasyTeam = string.Empty; p.Update(pitcher); return(p); }
public void Update(ESPNProjections.IPlayer batter) { this.Name = batter.FullName; this.ESPNId = batter.Id; this.IsC |= batter.Positions.Contains(ESPNProjections.ESPNConstants.Positions.C); this.Is1B |= batter.Positions.Contains(ESPNProjections.ESPNConstants.Positions.B1); this.Is2B |= batter.Positions.Contains(ESPNProjections.ESPNConstants.Positions.B2); this.IsSS |= batter.Positions.Contains(ESPNProjections.ESPNConstants.Positions.SS); this.Is3B |= batter.Positions.Contains(ESPNProjections.ESPNConstants.Positions.B3); this.IsOF |= batter.Positions.Contains(ESPNProjections.ESPNConstants.Positions.OF); this.ProjectedAB = GetStat(batter.Stats[ESPNProjections.ESPNConstants.Stats.Batters.AB], 0); this.ProjectedR = GetStat(batter.Stats[ESPNProjections.ESPNConstants.Stats.Batters.R], 0); this.ProjectedH = GetStat(batter.Stats[ESPNProjections.ESPNConstants.Stats.Batters.H], 0); this.ProjectedBB = GetStat(batter.Stats[ESPNProjections.ESPNConstants.Stats.Batters.BB], 0); this.ProjectedHR = GetStat(batter.Stats[ESPNProjections.ESPNConstants.Stats.Batters.HR], 0); this.ProjectedRBI = GetStat(batter.Stats[ESPNProjections.ESPNConstants.Stats.Batters.RBI], 0); this.ProjectedSB = GetStat(batter.Stats[ESPNProjections.ESPNConstants.Stats.Batters.SB], 0); this.SeasonOutlook = batter.SeasonOutlook; this.ProjectionsLastUpdated = DateTime.Now; }
public void Update(ESPNProjections.IPlayer pitcher) { this.Name = pitcher.FullName; this.ESPNId = pitcher.Id; this.IsSP = pitcher.Positions.Contains(ESPNProjections.ESPNConstants.Positions.SP); this.IsRP = pitcher.Positions.Contains(ESPNProjections.ESPNConstants.Positions.RP); this.ProjectedOutsRecorded = GetStat(pitcher.Stats[ESPNProjections.ESPNConstants.Stats.Pitchers.OutsRecorded], 0); this.ProjectedW = GetStat(pitcher.Stats[ESPNProjections.ESPNConstants.Stats.Pitchers.W], 0); this.ProjectedL = GetStat(pitcher.Stats[ESPNProjections.ESPNConstants.Stats.Pitchers.L], 0); this.ProjectedSV = GetStat(pitcher.Stats[ESPNProjections.ESPNConstants.Stats.Pitchers.SV], 0); this.ProjectedHld = GetStat(pitcher.Stats[ESPNProjections.ESPNConstants.Stats.Pitchers.Hld], 0); this.ProjectedK = GetStat(pitcher.Stats[ESPNProjections.ESPNConstants.Stats.Pitchers.K], 0); this.ProjectedHits = GetStat(pitcher.Stats[ESPNProjections.ESPNConstants.Stats.Pitchers.H], 0); this.ProjectedWalks = GetStat(pitcher.Stats[ESPNProjections.ESPNConstants.Stats.Pitchers.BB], 0); this.ProjectedER = GetStat(pitcher.Stats[ESPNProjections.ESPNConstants.Stats.Pitchers.ER], 0); this.ProjectedIP = ((int)this.ProjectedOutsRecorded / 3) + (this.ProjectedOutsRecorded % 3) / 10; this.ProjectedERA = this.ProjectedER / ((float)this.ProjectedOutsRecorded / 27); this.ProjectedWHIP = (this.ProjectedHits + this.ProjectedWalks) / ((float)this.ProjectedOutsRecorded / 3); this.SeasonOutlook = pitcher.SeasonOutlook; this.ProjectionsLastUpdated = DateTime.Now; }