Inheritance: MovingPicturesDBTable
        public static void AddWatchedHistory(DBMovieInfo movie, DBUser user)
        {
            DBWatchedHistory history = new DBWatchedHistory();
            history.DateWatched = DateTime.Now;
            history.Movie = movie;
            history.User = user;

            movie.WatchedHistory.Add(history);
            history.Commit();
            movie.Commit();
        }
Example #2
0
        public static void AddWatchedHistory(DBMovieInfo movie, DBUser user)
        {
            DBWatchedHistory history = new DBWatchedHistory();

            history.DateWatched = DateTime.Now;
            history.Movie       = movie;
            history.User        = user;

            movie.WatchedHistory.Add(history);
            history.Commit();
            movie.Commit();
        }
        // Initializes the database connection to the Movies Plugin database
        private static void initDB()
        {
            if (_databaseManager != null)
                return;

            string fullDBBackupPath = Config.GetSubFolder(Config.Dir.Database, dbBackupPath);
            string fullDBFileName = Config.GetFile(Config.Dir.Database, dbFileName);
            _databaseManager = new DatabaseManager(fullDBFileName, fullDBBackupPath);

            // check that we at least have a default user
            List<DBUser> users = DBUser.GetAll();
            if (users.Count == 0) {
                DBUser defaultUser = new DBUser();
                defaultUser.Name = "Default User";
                defaultUser.Commit();
            }

            // add all filter helpers
            _databaseManager.AddFilterHelper<DBMovieInfo>(new FilterHelperDBMovieInfo());
        }