Exemple #1
0
        public Tournament InsertTournament(Tournament t)
        {
            insertTournamentCmd.Parameters.AddWithValue("@name", t.Name);
            insertTournamentCmd.Parameters.AddWithValue("@rounds", t.Rounds);
            insertTournamentCmd.Parameters.AddWithValue("@typeof", t.Type.ToString());
            insertTournamentCmd.Parameters.AddWithValue("@date_begin", t.BeginOn.ToUniversalTime());
            insertTournamentCmd.Parameters.AddWithValue("@date_end", t.EndOn.ToUniversalTime());

            insertTournamentCmd.ExecuteNonQuery();

            return GetLatestTournament();
        }
Exemple #2
0
        public Tournament GetLatestTournament()
        {
            SQLiteDataReader dataReader = selectLatestTournamentCmd.ExecuteReader();
            Tournament t = null;
            while (dataReader.Read())
            {
                t = new Tournament(dataReader.GetInt64(0))
                {
                    Name = dataReader.GetString(1),
                    Rounds = dataReader.GetInt32(2),
                    Type = (GameType)Enum.Parse(typeof(GameType), dataReader.GetString(3)),
                    BeginOn = dataReader.GetDateTime(4),
                    EndOn = dataReader.GetDateTime(5),
                };

            }
            dataReader.Close();

            return t;
        }