Пример #1
0
 public static List <SearchHistory> Get(int start, int count)
 {
     var db = HohoemaLiteDb.GetLocalLiteRepository();
     {
         return(db.Query <SearchHistory>().Skip(start).Limit(count).ToList());
     }
 }
Пример #2
0
 public static bool Remove(string keyword, SearchTarget target)
 {
     var db = HohoemaLiteDb.GetLocalLiteRepository();
     {
         return(db.Delete <SearchHistory>(x => x.Keyword == keyword && x.Target == target) > 0);
     }
 }
Пример #3
0
        public static SearchHistory Searched(string keyword, SearchTarget target)
        {
            var db = HohoemaLiteDb.GetLocalLiteRepository();
            {
                var searchHistory = db.SingleOrDefault <SearchHistory>(x => x.Keyword == keyword && x.Target == target);
                if (searchHistory == null)
                {
                    searchHistory = new SearchHistory
                    {
                        Keyword     = keyword,
                        Target      = target,
                        LastUpdated = DateTime.Now,
                        SearchCount = 1
                    };
                }
                else
                {
                    searchHistory.LastUpdated = DateTime.Now;
                    searchHistory.SearchCount++;
                }

                db.Upsert <SearchHistory>(searchHistory);

                return(searchHistory);
            }
        }
Пример #4
0
 public static void Clear()
 {
     var db = HohoemaLiteDb.GetLocalLiteRepository();
     {
         db.Delete <SearchHistory>(Query.All());
     }
 }
Пример #5
0
 public static bool Remove(string videoId)
 {
     var db = HohoemaLiteDb.GetLocalLiteRepository();
     {
         return(db.Delete <NicoVideoComment>(x => x.VideoId == videoId) > 0);
     }
 }
Пример #6
0
 public static NicoVideoComment Get(string videoId)
 {
     var db = HohoemaLiteDb.GetLocalLiteRepository();
     {
         return(db.SingleOrDefault <NicoVideoComment>(x => x.VideoId == videoId));
     }
 }
Пример #7
0
 public static VideoPlayHistory Get(string videoId)
 {
     var db = HohoemaLiteDb.GetLocalLiteRepository();
     {
         return(db.SingleOrDefault <VideoPlayHistory>(x => x.VideoId == videoId));
     }
 }
Пример #8
0
 public static bool IsVideoPlayed(string videoId)
 {
     var db = HohoemaLiteDb.GetLocalLiteRepository();
     {
         return(db.SingleOrDefault <VideoPlayHistory>(x => x.VideoId == videoId)?.PlayCount > 0);
     }
 }
Пример #9
0
 public static List <SearchHistory> GetAll()
 {
     var db = HohoemaLiteDb.GetLocalLiteRepository();
     {
         return(db.Query <SearchHistory>().ToList());
     }
 }
Пример #10
0
 public static void ClearAllHistories()
 {
     var db = HohoemaLiteDb.GetLocalLiteRepository();
     {
         db.Delete <VideoPlayHistory>(Query.All());
     }
 }
Пример #11
0
        public static List <Feed> GetAll()
        {
            var db = HohoemaLiteDb.GetLocalLiteRepository();

            return(db.Query <Feed>()
                   .Include(x => x.Sources)
                   .ToList());
        }
Пример #12
0
 public static SearchTarget?LastSearchedTarget(string keyword)
 {
     var db = HohoemaLiteDb.GetLocalLiteRepository();
     {
         var searchHistory = db.Fetch <SearchHistory>(x => x.Keyword == keyword).OrderByDescending(x => x.LastUpdated).FirstOrDefault();
         return(searchHistory?.Target);
     }
 }
Пример #13
0
 public static int Count()
 {
     var db = HohoemaLiteDb.GetLocalLiteRepository();
     {
         return(db.Query <SearchHistory>()
                .Count());
     }
 }
Пример #14
0
        public static Feed Get(int id)
        {
            var db = HohoemaLiteDb.GetLocalLiteRepository();

            return(db.Query <Feed>()
                   .Include(x => x.Sources)
                   .Where(x => x.Id == id)
                   .SingleOrDefault());
        }
Пример #15
0
        public static bool AddOrUpdate(Feed feedGroup)
        {
            var db = HohoemaLiteDb.GetLocalLiteRepository();

            // 未登録のBookmarkをDbに登録
            var notExistItems = feedGroup.Sources
                                .Where(x => null == db.SingleOrDefault <Bookmark>(y => x.BookmarkType == y.BookmarkType && x.Content == y.Content));

            db.Upsert(notExistItems);

            return(db.Upsert(feedGroup));
        }
Пример #16
0
        public static bool Add(Bookmark bookmark)
        {
            // 重複チェック必要
            var db      = HohoemaLiteDb.GetLocalLiteRepository();
            var already = db.SingleOrDefault <Bookmark>(x => x.Content == bookmark.Content && x.BookmarkType == bookmark.BookmarkType);

            if (already != null)
            {
                bookmark.Id = already.Id;
                return(false);
            }

            db.Insert(bookmark);

            return(true);
        }
Пример #17
0
        public static void AddOrUpdate(string videoId, IEnumerable <Chat> chatItems)
        {
            var db = HohoemaLiteDb.GetLocalLiteRepository();
            {
                var comment = db.SingleOrDefault <NicoVideoComment>(x => x.VideoId == videoId);
                if (comment == null)
                {
                    comment = new NicoVideoComment
                    {
                        VideoId = videoId,
                    };
                }

                comment.ChatItems = chatItems.ToList();

                db.Upsert <NicoVideoComment>(comment);
            }
        }
Пример #18
0
        public static void VideoPlayed(string videoId)
        {
            var db = HohoemaLiteDb.GetLocalLiteRepository();
            {
                var history = db.SingleOrDefault <VideoPlayHistory>(x => x.VideoId == videoId);
                if (history != null)
                {
                    history.PlayCount++;
                }
                else
                {
                    history = new VideoPlayHistory
                    {
                        VideoId    = videoId,
                        PlayCount  = 1,
                        LastPlayed = DateTime.Now
                    };
                }

                db.Upsert(history);
            }
        }
Пример #19
0
        public static bool Remove(Bookmark bookmark)
        {
            var db = HohoemaLiteDb.GetLocalLiteRepository();

            return(db.Delete <Bookmark>(bookmark.Id));
        }
Пример #20
0
        public static bool Delete(Feed feedGroup)
        {
            var db = HohoemaLiteDb.GetLocalLiteRepository();

            return(db.Delete <Feed>(feedGroup.Id));
        }
Пример #21
0
        public static List <Bookmark> GetAll(BookmarkType bookmarkType)
        {
            var db = HohoemaLiteDb.GetLocalLiteRepository();

            return(db.Fetch <Bookmark>(x => x.BookmarkType == bookmarkType));
        }
Пример #22
0
        public static Bookmark Get(BookmarkType bookmarkType, string content)
        {
            var db = HohoemaLiteDb.GetLocalLiteRepository();

            return(db.SingleOrDefault <Bookmark>(x => x.BookmarkType == bookmarkType && x.Content == content));
        }
Пример #23
0
        public static List <Bookmark> GetAll()
        {
            var db = HohoemaLiteDb.GetLocalLiteRepository();

            return(db.Fetch <Bookmark>());
        }