Esempio n. 1
0
 /// <summary>
 /// Update name of slideshow
 /// </summary>
 /// <param name="id"></param>
 /// <param name="name"></param>
 public static void UpdateName(int id, string name)
 {
     try {
         SlideShowMapper slideShowMapper;
         using (var db = new MediaPlayerContext()) {
             // Get data and update field
             slideShowMapper      = db.SlideShowMapper.Single(x => x.Id == id);
             slideShowMapper.Name = name;
             db.SaveChanges();
         }
         AlbumQuery.UpdateLastUsed(slideShowMapper.AlbumMapper.Id);
     } catch {
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Remove mediadata
 /// </summary>
 /// <param name="id"></param>
 /// <param name="mediaDataId"></param>
 public static void RemoveMediaData(int id, int mediaDataId)
 {
     try {
         int albumId = 0;
         using (var db = new MediaPlayerContext()) {
             // Get data and update field
             MediaDataMapper mediaDataMapper = db.MediaDataMapper.Single(x => x.Id == mediaDataId);
             SlideShowMapper slideShowMapper = db.SlideShowMapper.Single(x => x.Id == id);
             slideShowMapper.MediaDataMappers.Remove(mediaDataMapper);
             albumId = slideShowMapper.AlbumMapper.Id;
             db.SaveChanges();
         }
         AlbumQuery.UpdateLastUsed(albumId);
     } catch {
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Change order field
        /// </summary>
        /// <param name="id"></param>
        /// <param name="order"></param>
        public static void UpdateOrder(int id, int order)
        {
            int albumId = 0;

            try {
                using (var db = new MediaPlayerContext()) {
                    // Get data and update field
                    MediaDataMapper mediaDataMapper = db.MediaDataMapper.Single(x => x.Id == id);
                    mediaDataMapper.Order = order;
                    SlideShowMapper slideShowMapper = mediaDataMapper.SlideShowMapper;
                    if (slideShowMapper != null)
                    {
                        albumId = slideShowMapper.AlbumMapper.Id;
                    }
                    db.SaveChanges();
                }
                if (albumId >= 0)
                {
                    AlbumQuery.UpdateLastUsed(albumId);
                }
            } catch {
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Update thumbnail image
        /// </summary>
        /// <param name="id"></param>
        /// <param name="thumbNailImage"></param>
        public static void UpdateThumbNail(int id, byte[] thumbNailImage)
        {
            int albumId = -1;

            try {
                using (var db = new MediaPlayerContext()) {
                    // Get data and update field
                    MediaDataMapper mediaDataMapper = db.MediaDataMapper.Single(x => x.Id == id);
                    mediaDataMapper.ThumbNailImage = thumbNailImage;
                    SlideShowMapper slideShowMapper = mediaDataMapper.SlideShowMapper;
                    if (slideShowMapper != null)
                    {
                        albumId = slideShowMapper.AlbumMapper.Id;
                    }
                    db.SaveChanges();
                }
                if (albumId >= 0)
                {
                    AlbumQuery.UpdateLastUsed(albumId);
                }
            } catch {
            }
        }