private void SetBowlingStat(Bowling lastBowlingStat) { if (lastBowlingStat.Wickets == 0) { lastBowlingStat.EconomyDec = Convert.ToDecimal(lastBowlingStat.Runs); lastBowlingStat.StrikeDec = Convert.ToDecimal(lastBowlingStat.Runs); } else { if (lastBowlingStat.OversDec > 0) { lastBowlingStat.EconomyDec = lastBowlingStat.Runs/Convert.ToDecimal(lastBowlingStat.OversDec); } if (lastBowlingStat.Wickets > 0) { lastBowlingStat.StrikeDec = lastBowlingStat.Runs/Convert.ToDecimal(lastBowlingStat.Wickets); } } }
private void CalculateBowlingStat(Bowling lastBowlingStat, BowlingStat bowlingStat) { lastBowlingStat.Runs += bowlingStat.Runs; lastBowlingStat.Wickets += bowlingStat.Wickets; lastBowlingStat.Maidens += bowlingStat.Maidens; lastBowlingStat.OversDec += bowlingStat.Overs; SetBowlingStat(lastBowlingStat); }