Пример #1
0
        public TournamentChannelManager GetChannelManager(MySqlConnection conn, ulong tourn_id)
        {
            string q = string.Format("SELECT * from tournaments WHERE ID='{0}'", tourn_id);

            MySqlDataReader rdr = ExecuteQuery(conn, q);

            if (!rdr.HasRows)
            {
                return(null);
            }

            TournamentChannelManager mgr = new TournamentChannelManager();

            while (rdr.Read())
            {
                mgr.RoleID = rdr.GetUInt64(rdr.GetOrdinal("role_id"));
                mgr.AnnouncementChannelID = rdr.GetUInt64(rdr.GetOrdinal("announcement_channel_id"));
                mgr.CategoryChannelID     = rdr.GetUInt64(rdr.GetOrdinal("category_id"));
                mgr.RegistationChannelID  = rdr.GetUInt64(rdr.GetOrdinal("registration_channel_id"));
                mgr.ManagementChannelID   = rdr.GetUInt64(rdr.GetOrdinal("management_channel_id"));
                mgr.ScoreReportChannelID  = rdr.GetUInt64(rdr.GetOrdinal("scorereport_channel_id"));
            }
            rdr.Close();
            return(mgr);
        }
Пример #2
0
        public void ApplyChannelManagerChanges(MySqlConnection conn, TournamentChannelManager mgr, ulong guild_id, ulong tourn_id)
        {
            string q = string.Format("UPDATE tournaments SET announcement_channel_id = '{0}', registration_channel_id = '{1}', management_channel_id = '{2}', scorereport_channel_id = '{3}', role_id = '{4}' WHERE guild_id = '{5}' AND ID = '{6}'",
                                     mgr.AnnouncementChannelID, mgr.RegistationChannelID, mgr.ManagementChannelID, mgr.ScoreReportChannelID, mgr.RoleID, guild_id, tourn_id);
            MySqlDataReader rdr = ExecuteQuery(conn, q);

            rdr?.Close();
        }