Пример #1
0
        public ChannelCollection GetChannels(EServerType serverType)
        {
            var col = new ChannelCollection();

            using (var con = GetConnection())
            {
                using (var cmd = con.CreateCommand())
                {
                    cmd.CommandText = "SELECT * FROM channels";
                    using (var r = cmd.ExecuteReader())
                    {
                        while (r.Read())
                        {
                            var channel = new Channel
                            {
                                ServerType = serverType,
                                ID         = r.GetUInt16("ID"),
                                Name       = r.GetString("Name")
                            };
                            col.TryAdd(channel.ID, channel);
                        }
                    }
                }
            }
            return(col);
        }
Пример #2
0
 public ChannelCollection GetChannels(EServerType serverType)
 {
     var col = new ChannelCollection();
     using (var con = GetConnection())
     {
         using (var cmd = con.CreateCommand())
         {
             cmd.CommandText = "SELECT * FROM channels";
             using (var r = cmd.ExecuteReader())
             {
                 while (r.Read())
                 {
                     var channel = new Channel
                     {
                         ServerType = serverType,
                         ID = r.GetUInt16("ID"),
                         Name = r.GetString("Name")
                     };
                     col.TryAdd(channel.ID, channel);
                 }
             }
         }
     }
     return col;
 }