コード例 #1
0
 /// <summary>
 /// Remove slideshow
 /// </summary>
 /// <param name="id"></param>
 public static void RemoveSlideShow(int id)
 {
     try {
         using (var db = new MediaPlayerContext()) {
             SlideShowMapper slideShowMapper = db.SlideShowMapper.Single(x => x.Id == id);
             db.SlideShowMapper.Remove(slideShowMapper);
             db.SaveChanges();
         }
     } catch {
     }
 }
コード例 #2
0
 /// <summary>
 /// Remove slideshow from album
 /// </summary>
 /// <param name="id"></param>
 /// <param name="slideShowId"></param>
 public static void RemoveSlideShow(int id, int slideShowId)
 {
     try {
         using (var db = new MediaPlayerContext()) {
             // Get data and update field
             SlideShowMapper slideShowMapper = db.SlideShowMapper.Single(x => x.Id == slideShowId);
             AlbumMapper     albumMapper     = db.AlbumMapper.Single(x => x.Id == id);
             albumMapper.SlideShowMappers.Remove(slideShowMapper);
             albumMapper.LastUsed = DateTime.Now;
             db.SaveChanges();
         }
     } catch {
     }
 }
コード例 #3
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 {
     }
 }
コード例 #4
0
        /// <summary>
        /// Add slideshow to table
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static int NewSlideShow(string name)
        {
            SlideShowMapper slideShowMapper = new SlideShowMapper(name);
            int             id = -1;

            try {
                using (var db = new MediaPlayerContext()) {
                    // Get id (max+1) and add to table
                    id = db.SlideShowMapper.Select(x => x.Id).DefaultIfEmpty(0).Max() + 1;
                    slideShowMapper.Id = id;
                    db.SlideShowMapper.Add(slideShowMapper);
                    db.SaveChanges();
                }
            } catch {
            }
            return(id);
        }
コード例 #5
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 {
            }
        }
コード例 #6
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 {
            }
        }