/// <summary> /// Increments the specified statitic for the contestant with the specified Delta value; /// </summary> /// <param name="Item"></param> /// <param name="Contestant"></param> /// <param name="Delta"></param> private void SetItem(Statistics Item, int Value, String MatchID, TennisMatch.MatchType MatchType) { Boolean Found; Found = false; foreach (TotalStatistic item in Items) { if (item.Item == Item && item.MatchID == MatchID) { item.Value = Value; Found = true; } } if (!Found) { TotalStatistic newItem = new TotalStatistic(); newItem.Item = Item; newItem.Value = Value; newItem.MatchID = MatchID; newItem.MatchType = MatchType; Items.Add(newItem); } OnUpdatedItem(EventArgs.Empty); }
/// <summary> /// Get the requested statistic from the collection /// </summary> /// <param name="Item"></param> /// <returns></returns> public int GetItem(Statistics Item, String MatchID, TennisMatch.MatchType MatchType) { int Result; Result = 0; foreach (TotalStatistic item in Items) { if (item.Item == Item) { Result += item.Value; } } return(Result); }
/// <summary> /// Decrement the specified statistic with 1 /// </summary> /// <param name="Item"></param> /// <param name="Contestant"></param> public void DecrementItem(Statistics Item, int Value, String MatchID, TennisMatch.MatchType MatchType) { ProcessIncrementItem(Item, -Value, MatchID, MatchType); }