Beispiel #1
0
        // 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());
        }
Beispiel #2
0
 private void usersBindingSource_ListChanged(object sender, ListChangedEventArgs e)
 {
     if (e.ListChangedType == ListChangedType.ItemAdded ||
         e.ListChangedType == ListChangedType.ItemChanged)
     {
         DBUser changedObj = (DBUser)userBindingSource[e.NewIndex];
         changedObj.Commit();
     }
 }