Exemple #1
0
        internal int SaveLeague(League newLeague)
        {
            GetData GD = new GetData();
            ObservableCollection <IID> LeagueList = new ObservableCollection <IID>();

            LeagueList         = GD.GetLeagueID();
            newLeague.LeagueId = GetID(LeagueList);


            SqlConnection DBcon = new SqlConnection("Server = ealdb1.eal.local; database=ejl44_db; User Id=ejl44_usr; Password=Baz1nga44");

            try
            {
                DBcon.Open();
                SqlCommand cmd = new SqlCommand("InsertLeague", DBcon);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@LeagueID", newLeague.LeagueId);
                cmd.Parameters.AddWithValue("@LeagueName", newLeague.LeagueName);
                cmd.Parameters.AddWithValue("@Reward", newLeague.Reward);
                cmd.Parameters.AddWithValue("@GameName", newLeague.GameName);
                cmd.Parameters.AddWithValue("@LeagueStatus", newLeague.LeagueStatus);

                cmd.ExecuteNonQuery();
            }
            catch (SqlException e)
            {
                throw e;
            }
            finally
            {
                DBcon.Close();
                DBcon.Dispose();
            }
            return(newLeague.LeagueId);
        }
Exemple #2
0
        public static Player GetPlayerById(int playerId)
        {
            GetData GD = new GetData();

            return(GD.GetPlayerById(playerId));
        }
Exemple #3
0
        public static ObservableCollection <Player> GetPlayerData()
        {
            GetData GD = new GetData();

            return(GD.GetPlayers());
        }
Exemple #4
0
        public static ObservableCollection <League> GetLeagueData()
        {
            GetData GD = new GetData();

            return(GD.GetLeagues());
        }