Exemple #1
0
 public static void CreateDatabaseIfNotExist()
 {
     if (!System.IO.File.Exists(IOVariables.databaseFile))
     {
         DLDatabase.CreateDatabase();
     }
     else
     {
         //great! the .db file exists. Now lets check if the user's .db file is up-to-date. let's see if the reminder table has all the required columns.
         if (DLDatabase.HasAllTables())
         {
             if (!DLDatabase.HasAllColumns())
             {
                 DLDatabase.InsertNewColumns(); //not up to date. insert !
             }
         }
         else
         {
             DLDatabase.InsertMissingTables();
             //re-run the method, since the .db file **should** now have all the tables.
             CreateDatabaseIfNotExist();
         }
     }
 }
Exemple #2
0
 public static bool HasAllTables()
 {
     return(DLDatabase.HasAllTables());
 }
Exemple #3
0
 /// <summary>
 /// This method will insert missing columns into the table reminder. Will only be called if HasallColumns() returns false. This means the user has an outdated .db file
 /// </summary>
 public static void InsertNewColumns()
 {
     DLDatabase.InsertNewColumns();
 }
Exemple #4
0
 /// <summary>
 /// Checks if the user's .db file has all the columns from the database model.
 /// </summary>
 /// <returns></returns>
 public static bool HasAllColumns()
 {
     return(DLDatabase.HasAllColumns());
 }
Exemple #5
0
 /// <summary>
 /// Checks wether the table x has column x
 /// </summary>
 /// <param name="columnName">The column you want to check on</param>
 /// <param name="table">The table you want to check on</param>
 /// <returns></returns>
 public static bool HasColumn(string columnName, string table)
 {
     return(DLDatabase.HasColumn(columnName, table));
 }
Exemple #6
0
 /// <summary>
 /// Creates the database with associated tables
 /// </summary>
 public static void CreateDatabase()
 {
     DLDatabase.CreateDatabase();
 }