public int GetHighScore(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { try { var highScore = (from a in FilterData(_battingStatsData, startDate, endDate, matchType, venue) select a.Score).Max(); return(highScore); } catch { return(0); } }
public int Get6s(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { var sixes = (from a in FilterData(_battingStatsData, startDate, endDate, matchType, venue) select a.Sixes).Sum(); return(sixes); }
public int GetCatchesTaken(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { var ct = (from a in FilterData(_fieldingStatsData, startDate, endDate, matchType, venue) where ( ((ModesOfDismissal)a.ModeOfDismissal == ModesOfDismissal.Caught && a.FielderID == this.ID) || ((ModesOfDismissal)a.ModeOfDismissal == ModesOfDismissal.CaughtAndBowled && a.BowlerID == this.ID) ) select a).Count(); return(ct); }
public int GetMatchesPlayed(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { return(FilterData(_battingStatsData, startDate, endDate, matchType, venue).Count()); }
public decimal GetStrikeRate(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { try { decimal fraction = (GetOversBowled(startDate, endDate, matchType, venue) * 6 / GetWicketsTaken(startDate, endDate, matchType, venue)); return(Math.Round(fraction, 2)); } catch { return(0); } }
public int GetRunsConceeded(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { var rc = (from a in FilterBowlingData(_bowlingStatsData, startDate, endDate, matchType, venue) select a.Runs).Sum(); return(rc); }
public int GetDucks(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { var ducks = (from a in FilterData(_battingStatsData, startDate, endDate, matchType, venue) where a.Score == 0 where ( (ModesOfDismissal)a.ModeOfDismissal != ModesOfDismissal.DidNotBat && (ModesOfDismissal)a.ModeOfDismissal != ModesOfDismissal.NotOut && (ModesOfDismissal)a.ModeOfDismissal != ModesOfDismissal.Retired ) select a).Count(); return(ducks); }
public decimal GetEconomy(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { try { decimal fraction = (GetRunsConceeded(startDate, endDate, matchType, venue) / GetOversBowled(startDate, endDate, matchType, venue)); return(Math.Round(fraction, 2)); } catch { return(0); } }
public decimal GetBattingAverage(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { try { decimal average = ((decimal)this.GetRunsScored(startDate, endDate, matchType, venue) / (this.GetInnings(startDate, endDate, matchType, venue) - this.GetNotOuts(startDate, endDate, matchType, venue))); return(Math.Round(average, 2)); } catch { return(0); } }
public int GetRunsScored(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { var runsScored = (from a in FilterData(_battingStatsData, startDate, endDate, matchType, venue) select a.Score).Sum(); return(runsScored); }
public int GetNumberOfMatchesPlayedIn(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { var matches = (from a in FilterData(_battingStatsData, startDate, endDate, matchType, venue) select a).Count(); return(matches); }
private static IEnumerable <BowlingStatsEntryData> FilterBowlingData(List <BowlingStatsEntryData> data, DateTime startDate, DateTime endDate, List <MatchType> matchTypes, Venue venue) { return(from a in data where (a.MatchDate >= startDate || startDate == null) where (a.MatchDate <= endDate || endDate == null) where (matchTypes.Any(b => (int)b == a.MatchTypeID) || matchTypes.Contains(MatchType.All)) where (venue == null || a.VenueID == venue.ID) select a); }
public int GetRunOuts(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { var stmp = (from a in FilterData(_fieldingStatsData, startDate, endDate, matchType, venue) where a.FielderID == this.ID where (ModesOfDismissal)a.ModeOfDismissal == ModesOfDismissal.RunOut select a).Count(); return(stmp); }
public int GetWicketsTaken(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { var wt = (from a in FilterBowlingData(_bowlingStatsData, startDate, endDate, matchType, venue) select a.Wickets).Sum(); return(wt); }
public int Get50sScored(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { var fifties = (from a in FilterData(_battingStatsData, startDate, endDate, matchType, venue) where a.Score >= 50 where a.Score < 100 select a).Count(); return(fifties); }
public decimal GetBowlingAverage(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { try { decimal fraction = (GetRunsConceeded(startDate, endDate, matchType, venue) / GetWicketsTaken(startDate, endDate, matchType, venue)); return(Math.Round(fraction, 2)); } catch { return(0); } }
public int GetNotOuts(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { var notouts = (from a in FilterData(_battingStatsData, startDate, endDate, matchType, venue) where (ModesOfDismissal)a.ModeOfDismissal == ModesOfDismissal.NotOut || (ModesOfDismissal)a.ModeOfDismissal == ModesOfDismissal.RetiredHurt select a).Count(); return(notouts); }
public int GetTenFers(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { var tenfers = (from a in FilterBowlingData(_bowlingStatsData, startDate, endDate, matchType, venue) where a.Wickets >= 10 select a).Count(); return(tenfers); }
public int GetInnings(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { var knocks = (from a in FilterData(_battingStatsData, startDate, endDate, matchType, venue) where (ModesOfDismissal)a.ModeOfDismissal != ModesOfDismissal.DidNotBat select a).Count(); return(knocks); }
public decimal GetOversBowled(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { var ob = (from a in FilterBowlingData(_bowlingStatsData, startDate, endDate, matchType, venue) select a.Overs).Sum(); return(ob); }
public int GetBattingPosition(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { try { var x = (from a in FilterData(_battingStatsData, startDate, endDate, matchType, venue) select a.BattingAt).Average(); return((int)Math.Round(x, 0) + 1); } catch { return(11); } }
public static Venue GetByName(string Name) { Venue venue = (from a in Venue.GetAll() where a.Name == Name select a).FirstOrDefault(); return(venue); }
public string GetBestMatchFigures(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue) { int mostwickets; try { mostwickets = (from a in FilterBowlingData(_bowlingStatsData, startDate, endDate, matchType, venue) select a.Wickets).Max(); } catch { return("0/0"); } var runs = (from a in FilterBowlingData(_bowlingStatsData, startDate, endDate, matchType, venue) where a.Wickets == mostwickets select a.Runs).Min(); return(mostwickets.ToString() + "/" + runs.ToString()); }