public Attack[] GetFullAttackForGame(Guid gameId) { List <Attack> attacks = new List <Attack>(); DbAttack[] dbAttacks = GetAttacksForGame(gameId); foreach (DbAttack a in dbAttacks) { EZoneFunction function = a.IsOpponentAttack ? EZoneFunction.Defence : EZoneFunction.Attack; Attack attack = new Attack(function, a.ZoneStartFunction, gameId, a.IsFirstHalf); // get shots attack.Shots = myDbConnection.Table <DbAttackShot>().Where(s => s.AttackId == a.Id).ToList(); // get rebounds attack.Rebounds = myDbConnection.Table <DbAttackRebound>().Where(r => r.AttackId == a.Id).ToList(); // if (a.GoalId != Guid.Empty) { attack.Goal = myDbConnection.Table <DbAttackGoal>().FirstOrDefault(g => g.Id == a.GoalId); } attack.DbAttack = a; attacks.Add(attack); } return(attacks.ToArray()); }
private void Init(EZoneFunction function, string startingZoneFunction, Guid gameId, bool isFirstHalf) { DbAttack.IsOpponentAttack = function == EZoneFunction.Defence ? true : false; DbAttack.ZoneStartFunction = startingZoneFunction; DbAttack.Id = Guid.NewGuid(); DbAttack.GameId = gameId; DbAttack.IsFirstHalf = isFirstHalf; }
public List <Attack> GetAttacksByGameId(Guid gameId, EZoneFunction zoneFilter) { List <Attack> attacks = new List <Attack>(myGameDbManager.GetFullAttackForGame(gameId)); if (zoneFilter == EZoneFunction.None) { return(attacks); } string zoneStartFunctionFilter = zoneFilter == EZoneFunction.Attack ? "A" : "D"; return(attacks.Where(a => a.DbAttack.ZoneStartFunction.Equals(zoneStartFunctionFilter)).ToList()); }
public Attack(EZoneFunction function, EZoneFunction startingZoneFunction, Guid gameId, bool isFirstHalf) { string startingFunction = startingZoneFunction == EZoneFunction.Attack ? "A" : "D"; Init(function, startingFunction, gameId, isFirstHalf); }
public Attack(EZoneFunction function, string startingZoneFunction, Guid gameId, bool isFirstHalf) { Init(function, startingZoneFunction, gameId, isFirstHalf); }