Exemplo n.º 1
0
        public List <LastTrack> GetCurrentTracksList()
        {
            DbConnection     dbConnection = _MasterDB.MasterDBConnection;
            List <LastTrack> lastTracks   = null;

            using (var qry = dbConnection.CreateCommand())
            {
                qry.CommandText = Queries.QRY_ON_AIR;
                StringBuilder sb = new StringBuilder();

                using (DbDataReader edr = qry.ExecuteReader(CommandBehavior.SequentialAccess))
                {
                    lastTracks = new List <LastTrack>();
                    while (edr.Read())
                    {
                        int       i  = 0;
                        LastTrack lt = new LastTrack();
                        lt.ID         = edr.GetString(i++);
                        lt.created_at = edr.GetDateTime(i++);
                        lt.FolderPath = edr.GetString(i++).Replace('/', '\\');
                        lt.Title      = (edr.IsDBNull(i) ? string.Empty : edr.GetString(i));
                        i++;
                        lt.Artist = (edr.IsDBNull(i) ? string.Empty : edr.GetString(i));
                        i++;
                        lt.ImagePath = edr.GetString(i++).Replace('/', '\\');
                        lt.BPM       = (edr.IsDBNull(i) ? 0 : edr.GetInt32(i));
                        i++;
                        lt.Rating = (edr.IsDBNull(i) ? 0 : edr.GetInt32(i));
                        i++;
                        lt.ReleaseYear = (edr.IsDBNull(i) ? (int?)null : edr.GetInt32(i));
                        i++;
                        lt.ReleaseDate = (edr.IsDBNull(i) ? string.Empty : edr.GetString(i));
                        i++;
                        lt.Length  = edr.GetInt32(i++);
                        lt.ColorID = (edr.IsDBNull(i) ? (int?)null : edr.GetInt32(i));
                        i++;
                        lt.TrackComment = (edr.IsDBNull(i) ? string.Empty : edr.GetString(i));
                        i++;
                        lt.ColorName = (edr.IsDBNull(i) ? string.Empty : edr.GetString(i));
                        i++;
                        lt.AlbumName = (edr.IsDBNull(i) ? string.Empty : edr.GetString(i));
                        i++;
                        lt.LabelName = (edr.IsDBNull(i) ? string.Empty : edr.GetString(i));
                        i++;
                        lt.GenreName = (edr.IsDBNull(i) ? string.Empty : edr.GetString(i));
                        i++;
                        lt.KeyName = (edr.IsDBNull(i) ? string.Empty : edr.GetString(i));
                        i++;
                        lt.RemixerName = (edr.IsDBNull(i) ? string.Empty : edr.GetString(i));
                        i++;
                        lt.Message = (edr.IsDBNull(i) ? string.Empty : edr.GetString(i));

                        lastTracks.Add(lt);
                    }
                }
            }

            return(lastTracks);
        }
Exemplo n.º 2
0
        protected string LastTrackToString(LastTrack LastTrack)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(LastTrack.created_at.ToString())
            .Append(FIELD_SEPARATOR)
            .Append(LastTrack.FolderPath)
            .Append(FIELD_SEPARATOR)
            .Append(LastTrack.Artist)
            .Append(FIELD_SEPARATOR)
            .Append(LastTrack.Title);
            return(sb.ToString());
        }