private static void EnsureDbReady() { SQLiteActionProvider sqlite = new SQLiteActionProvider(); sqlite.DoDb(conn => { conn.Execute(@"CREATE TABLE IF NOT EXISTS AppSetting (Id INTEGER, JiraLogin TEXT, JiraPassword TEXT, JiraUrl TEXT, TogglApiKey TEXT, PRIMARY KEY (Id))"); }); }
public AppSetting ReadSettings() { var sqlite = new SQLiteActionProvider(); AppSetting result = null; sqlite.DoDb(conn => { result = conn.Query<AppSetting>("select * from AppSetting").FirstOrDefault(); }); return result ?? new AppSetting(); }
public AppSetting ReadSettings() { var sqlite = new SQLiteActionProvider(); AppSetting result = null; sqlite.DoDb(conn => { result = conn.Query <AppSetting>("select * from AppSetting").FirstOrDefault(); }); return(result ?? new AppSetting()); }
public void SaveSettings(AppSetting settings) { if (settings == null) return; var sqlite = new SQLiteActionProvider(); sqlite.DoDb(conn => { conn.Execute("insert or replace into AppSetting (Id, JiraLogin, JiraPassword, JiraUrl, TogglApiKey) values(@Id, @jlogin, @jpwd, @jurl, @toggl)", new { Id = 1, jlogin = settings.JiraLogin, jpwd = settings.JiraPassword, jurl = settings.JiraUrl, toggl = settings.TogglApiKey }); }); }
public void SaveSettings(AppSetting settings) { if (settings == null) { return; } var sqlite = new SQLiteActionProvider(); sqlite.DoDb(conn => { conn.Execute("insert or replace into AppSetting (Id, JiraLogin, JiraPassword, JiraUrl, TogglApiKey) values(@Id, @jlogin, @jpwd, @jurl, @toggl)", new { Id = 1, jlogin = settings.JiraLogin, jpwd = settings.JiraPassword, jurl = settings.JiraUrl, toggl = settings.TogglApiKey }); }); }