コード例 #1
0
        public void Insert_Player_Test()
        {
            Player player = new Player(44, "Football Guy");
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Insert(player);
        }
コード例 #2
0
        public void Delete_Fav_Team_Test()
        {
            Fav_Team             fav_team    = new Fav_Team(1, 1, 3);
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Delete(fav_team);
        }
コード例 #3
0
        public void Update_Player_Stat_Test()
        {
            Player_Stat          player_Stat = new Player_Stat(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Edit(player_Stat);
        }
コード例 #4
0
        public void Delete_User_Test()
        {
            User user = new User("User", "Password", 2);
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Delete(user);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        public void Update_Team_Test()
        {
            Team team = new Team("Football Team 2", 1);
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Edit(team);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        public void Delete_Team_Play_Test()
        {
            Team_Play            team_play   = new Team_Play(1, 1, 2);
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Delete(team_play);
        }
コード例 #9
0
        public void Insert_Fav_Team_Test()
        {
            Fav_Team             fav_team    = new Fav_Team(1, 1);
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Insert(fav_team);
        }
コード例 #10
0
        public void Insert_Player_Stat_Test()
        {
            Player_Stat          player_Stat = new Player_Stat(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Insert(player_Stat);
        }
コード例 #11
0
        public void Insert_Fav_Player_Test()
        {
            Fav_Player           fav_player  = new Fav_Player(1, 1);
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Insert(fav_player);
        }
コード例 #12
0
        public void Insert_User_Test()
        {
            User user = new User("User", "Password");
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Insert(user);
        }
コード例 #13
0
        public void Insert_Team_Test()
        {
            Team team = new Team("Football Team");
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Insert(team);
        }
コード例 #14
0
        public void Delete_Player_Stat_Test()
        {
            Player_Stat          player_Stat = new Player_Stat(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2);
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Delete(player_Stat);
        }
コード例 #15
0
        public void Insert_Team_Play_Test()
        {
            Team_Play            team_play   = new Team_Play(1, 1);
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Insert(team_play);
        }
コード例 #16
0
        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);
        }
コード例 #17
0
        public void Insert_Player_Play_Test()
        {
            Player_Play          player_play = new Player_Play(1, 1);
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Insert(player_play);
        }
コード例 #18
0
        public void Delete_Player_Play_Test()
        {
            Player_Play          player_play = new Player_Play(1, 1, 3);
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Delete(player_play);
        }
コード例 #19
0
        public void Delete_Player_Test()
        {
            Player player = new Player(44, "Football Guy", 2);
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Delete(player);
        }
コード例 #20
0
        public void Update_Player_Test()
        {
            Player player = new Player(43, "Football Guy", 1);
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Edit(player);
        }
コード例 #21
0
        public void Delete_Team_Test()
        {
            Team team = new Team("Football Team", 2);
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Delete(team);
        }
コード例 #22
0
        public void Update_User_Test()
        {
            User user = new User("User 2", "Password 2", 1);
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Edit(user);
        }
コード例 #23
0
        public void Delete_Fav_Player_Test()
        {
            Fav_Player           fav_player  = new Fav_Player(1, 1, 3);
            Database_Manipulator manipulator = new Database_Manipulator();

            manipulator.Delete(fav_player);
        }
コード例 #24
0
ファイル: LoadTeams.cs プロジェクト: mattmede/FootballStatsDB
    public static List <Team> GetTeams()
    {
        var dbManipulator = new Database_Manipulator();
        var teams         = new List <Team>();

        teams = dbManipulator.SelectAllTeams();

        return(teams);
    }
コード例 #25
0
ファイル: Program.cs プロジェクト: mattmede/FootballStatsDB
        static void InsertTeamStats(List <KeyValuePair <int, Team_Stat> > stats)
        {
            Database_Manipulator manipulator = new Database_Manipulator();

            foreach (KeyValuePair <int, Team_Stat> stat in stats)
            {
                int stat_id = manipulator.Insert(stat.Value);
                manipulator.Insert(new Team_Play(stat.Key, stat_id));
            }
        }
コード例 #26
0
    public static List <StatPlayer> GetPlayers()
    {
        var dbManipulator = new Database_Manipulator();
        var players       = new List <Player>();
        var statPlayers   = new List <StatPlayer>();

        SqlCommand command;

        players = dbManipulator.SelectAllEntries();

        foreach (Player p in players)
        {
            var    statIds     = new List <int>();
            var    stats       = new List <Player_Stat>();
            string stat_string = "SELECT Player_Stat_Id FROM Player_Plays WHERE Player_Id = " + p.Id;
            command = new SqlCommand(stat_string, connection);

            connection.Open();
            var reader = command.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    statIds.Add(reader.GetInt32(0));
                }
            }
            connection.Close();

            foreach (int stat in statIds)
            {
                string getStats = "SELECT * FROM Player_Stats WHERE Player_Stat_Id = " + stat;

                command = new SqlCommand(getStats, connection);
                connection.Open();
                reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        stats.Add(new Player_Stat(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), reader.GetInt32(10), reader.GetInt32(11),
                                                  reader.GetInt32(12), reader.GetInt32(0)));
                    }
                }
                connection.Close();
            }
            statPlayers.Add(new StatPlayer(p, stats));
        }

        return(statPlayers);
    }