public void Update_Team_Stat_Test() { Team_Stat team_Stat = new Team_Stat(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); Database_Manipulator manipulator = new Database_Manipulator(); manipulator.Edit(team_Stat); }
public void Delete_Team_Stat_Test() { Team_Stat team_Stat = new Team_Stat(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2); Database_Manipulator manipulator = new Database_Manipulator(); manipulator.Delete(team_Stat); }
public void Insert_Team_Stat_Test() { Team_Stat team_Stat = new Team_Stat(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); Database_Manipulator manipulator = new Database_Manipulator(); manipulator.Insert(team_Stat); }
private Team_Stat GetTeamStat(int id) { string get_stats_command = "SELECT Rush_Yards, Pass_Yards, First_Downs, Total_Yards, Penalty_Count, Penalty_Yards, Turnovers, Punt_Count, Punt_Yards, Punt_Average FROM Team_Stats WHERE Team_Stat_Id = " + id; SqlCommand command = new SqlCommand(get_stats_command, connection); connection.Open(); var reader = command.ExecuteReader(); reader.Read(); Team_Stat stat = new Team_Stat(0, 2016, reader.GetInt32(0), reader.GetInt32(1), reader.GetInt32(2), reader.GetInt32(3), reader.GetInt32(4), reader.GetInt32(5), reader.GetInt32(6), reader.GetInt32(7), reader.GetInt32(8), reader.GetInt32(9)); connection.Close(); return(stat); }
private Team_Stat ProjectTeamStats(List <int> stat_ids) { int rush_yards = 0, pass_yards = 0, first_downs = 0, total_yards = 0, penalty_count = 0, penalty_yards = 0, turnovers = 0, punt_count = 0, punt_yards = 0, punt_average = 0; foreach (int id in stat_ids) { Team_Stat stat = new Team_Stat(); stat = GetTeamStat(id); rush_yards += stat.Rush_Yards; pass_yards += stat.Pass_Yards; //first_downs += stat.First_Downs; //total_yards += stat.Total_Yards; //penalty_count += stat.Penalty_Count; //penalty_yards += stat.Penalty_Yards; //turnovers += stat.Turnovers; //punt_count += stat.Punt_Count; //punt_yards += stat.Punt_Yards; //punt_average += stat.Punt_Average; } rush_yards /= stat_ids.Count; pass_yards /= stat_ids.Count; first_downs /= stat_ids.Count; total_yards /= stat_ids.Count; penalty_count /= stat_ids.Count; penalty_yards /= stat_ids.Count; turnovers /= stat_ids.Count; punt_count /= stat_ids.Count; punt_yards /= stat_ids.Count; punt_average /= stat_ids.Count; var teamstat = new Team_Stat(0, 2016, rush_yards, pass_yards, first_downs, total_yards, penalty_count, penalty_yards, turnovers, punt_count, punt_yards, punt_average); return(teamstat); }