示例#1
0
 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);
     }
 }
示例#2
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);
        }
示例#3
0
        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);
        }
示例#4
0
 public int GetMatchesPlayed(DateTime startDate, DateTime endDate, List <MatchType> matchType, Venue venue)
 {
     return(FilterData(_battingStatsData, startDate, endDate, matchType, venue).Count());
 }
示例#5
0
 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);
     }
 }
示例#6
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);
        }
示例#7
0
        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);
        }
示例#8
0
 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);
     }
 }
示例#9
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);
     }
 }
示例#10
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);
        }
示例#11
0
        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);
        }
示例#12
0
 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);
 }
示例#13
0
        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);
        }
示例#14
0
        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);
        }
示例#15
0
        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);
        }
示例#16
0
 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);
     }
 }
示例#17
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);
        }
示例#18
0
        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);
        }
示例#19
0
        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);
        }
示例#20
0
        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);
        }
示例#21
0
 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);
     }
 }
示例#22
0
        public static Venue GetByName(string Name)
        {
            Venue venue = (from a in Venue.GetAll() where a.Name == Name select a).FirstOrDefault();

            return(venue);
        }
示例#23
0
        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());
        }