public MapServiceSQLite() { using (SQLiteConnection connection = new SQLiteConnection(SQLiteConfiguration.ConnectionString)) { connection.CreateTable<MapModel>(); if (connection.ExecuteScalar<int>("SELECT COUNT(*) FROM Maps") == 0) connection.RunInTransaction(() => { connection.Insert(new MapModel(Guid.NewGuid(), "Default Map", @"ms-appx:///MetroExplorer.Components.Maps/DesignAssets/MapBackground.bmp")); }); connection.CreateTable<MapLocationModel>(); connection.CreateTable<MapLocationFolderModel>(); } }
private string CreateDatabase() { try { using (var connection = new SQLite.SQLiteConnection(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "bancoteste.db3"))) { connection.CreateTable <Categoria>(SQLite.CreateFlags.ImplicitPK | SQLite.CreateFlags.AutoIncPK); connection.CreateTable <Policies>(SQLite.CreateFlags.ImplicitPK | SQLite.CreateFlags.AutoIncPK); connection.CreateTable <Product>(SQLite.CreateFlags.ImplicitPK | SQLite.CreateFlags.AutoIncPK); connection.CreateTable <Promotion>(SQLite.CreateFlags.ImplicitPK | SQLite.CreateFlags.AutoIncPK); connection.CreateTable <Sessao>(SQLite.CreateFlags.ImplicitPK | SQLite.CreateFlags.AutoIncPK); connection.Execute("DELETE FROM Categoria"); connection.Execute("DELETE FROM Policies"); connection.Execute("DELETE FROM Product"); connection.Execute("DELETE FROM Promotion"); connection.Execute("DELETE FROM Sessao"); } return("Database created"); } catch (SQLiteException ex) { return(ex.Message); } }
/// <summary> /// Initializes a new instance of the <see cref="Tasky.DL.TaskDatabase"/> TaskDatabase. /// if the database doesn't exist, it will create the database and all the tables. /// </summary> /// <param name='path'> /// Path. /// </param> public POCDB() { database = DependencyService.Get<ISQLite> ().GetConnection (); // create the tables database.CreateTable<TodoItem>(); database.CreateTable<UserProfile>(); }
public void Connect() { sqlConnection = new SQLiteConnection(DB_PATH); if (!ApplicationData.Current.LocalSettings.Values.ContainsKey(DB_VERSION_KEY)) { ApplicationData.Current.LocalSettings.Values.Add(DB_VERSION_KEY, 0); } int currentDatabaseVersion = DebugHelper.CastAndAssert<int>(ApplicationData.Current.LocalSettings.Values[DB_VERSION_KEY]); if (currentDatabaseVersion < 1) { sqlConnection.CreateTable<ArtistTable>(); sqlConnection.CreateTable<AlbumTable>(); sqlConnection.CreateTable<SongTable>(); sqlConnection.CreateTable<PlayQueueEntryTable>(); sqlConnection.CreateTable<PlaylistTable>(); sqlConnection.CreateTable<PlaylistEntryTable>(); sqlConnection.CreateTable<HistoryTable>(); sqlConnection.CreateTable<MixTable>(); sqlConnection.CreateTable<MixEntryTable>(); sqlConnection.CreateTable<BackgroundTable>(); } if (currentDatabaseVersion < DB_VERSION) { ApplicationData.Current.LocalSettings.Values[DB_VERSION_KEY] = DB_VERSION; } }
static public void createNewsItemTable() { db.DropTable <NewsItem>(); db.CreateTable <NewsItem>(); //db.DropTable //return true; }
/** * Inserts a golf course in the database from an xml string describing the golf course * xmlGolfCourse : the xml string describing the golf course */ private void InsertGolfCourseBdd(String xmlGolfCourse) { GolfCourse gc; try { gc = GolfXMLReader.getSingleGolfCourseFromText(xmlGolfCourse); SQLite.SQLiteConnection connection = DependencyService.Get <ISQLiteDb>().GetConnection(); try { connection.CreateTable <Hole>(); connection.CreateTable <MyPosition>(); connection.CreateTable <GolfCourse>(); connection.BeginTransaction(); SQLiteNetExtensions.Extensions.WriteOperations.InsertWithChildren(connection, gc, true); connection.Commit(); this.DisplayAlert("Succès", "Le " + this.pins.Count + " trous : " + golfNameEntry.Text + " a été créé avec succès", "Continuer"); this.ManageAllPinsDelete(); } catch (SQLiteException bddException) { this.DisplayAlert("Erreur avec la base de donnée", bddException.Source + " : Ce nom de golf existe déjà ou une autre erreur inattendu s'est produite", "Ok"); connection.Rollback(); } } catch (Exception xmlConversionException) { this.DisplayAlert("Erreur lors de la conversion XML -> GolfCourse", xmlConversionException.StackTrace, "Ok"); } }
public Model() { // prepare model state/data m_data = new PersistentModelData (); // prepare DB // Log.Debug ("Ruly", "ext sd: " + Android.OS.Environment.ExternalStorageDirectory); // string folder = Environment.GetFolderPath (Environment.SpecialFolder.Personal); string folder = Android.OS.Environment.ExternalStorageDirectory + "/ruly/ruly.db"; Util.EnsureDirectory (System.IO.Path.GetDirectoryName (folder)); m_db = new SQLiteConnection (folder); m_db.CreateTable<TaskData>(); m_db.CreateTable<TaskHistory>(); m_db.CreateTable<TaskAlarm> (); m_unknown_task = new TaskData () { Id = -1, Title = "休憩" }; // create ViewModel I/F datasets Tasks = new ObservableCollection<TaskData>(); TaskHistories = new ObservableCollection<CombinedTaskHistory> (); RawTaskHistories = new ObservableCollection<CombinedTaskHistory> (); UpdateTaskList (); // show today task at default // this result in call UpdateTaskHistoryList(); ShowDate = DateTime.Today; }
async void Login_Loaded() { try { await ApplicationData.Current.LocalFolder.CreateFileAsync("Shopping.db3"); var path = Path.Combine(ApplicationData.Current.LocalFolder.Path, "Shopping.db3"); using (var db = new SQLite.SQLiteConnection(path)) { // Create the tables if they don't exist db.CreateTable<ShopLists>(); db.CreateTable<ShopAdmins>(); db.Commit(); db.Dispose(); db.Close(); } ServiceReference1.SoapServiceSoapClient sc=new SoapServiceSoapClient(); sc.AllCouponsCompleted += (a, b) => MessageBox.Show(b.Result); sc.AllCouponsAsync("hacking"); } catch (Exception ex) { FaultHandling(ex.StackTrace); } }
/// <summary> /// Initializes a new instance of the <see cref="Tasky.DL.TaskDatabase"/> TaskDatabase. /// if the database doesn't exist, it will create the database and all the tables. /// </summary> /// <param name='path'> /// Path. /// </param> public TodoDatabase() { database = DependencyService.Get<ISQLite>().GetConnection(); // create the tables database.CreateTable<TODOItem>(); database.CreateTable<EventItem>(); }
public App(string rutaBD) { InitializeComponent(); //Linea para obtener permisos //Task.Run(async() => await ObtenerPermisos()).GetAwaiter().GetResult(); RutaBD = rutaBD; VersionTracking.Track(); bool firsttime = VersionTracking.IsFirstLaunchForCurrentVersion; using (SQLite.SQLiteConnection conexion = new SQLite.SQLiteConnection(RutaBD)) { conexion.CreateTable <GenericDataConfig>(); conexion.CreateTable <TbRequest>(); //Debug.WriteLine($"{"LOCALIDADES: " + conexion.Table<ERP_LOCALIDADES>().Count().ToString()}"); //Debug.WriteLine($"{"LOCALIDADES: " + countLocalidades.ToString()}"); } //DROP DE TABLAS /*using (SQLite.SQLiteConnection conexion = new SQLite.SQLiteConnection(RutaBD)) * { * //conexion.DropTable<_ARTICULOS>(); * }*/ MainPage = new NavigationPage(new Login()) { BarBackgroundColor = Color.FromHex("#aed4ff"), BarTextColor = Color.Gray }; }
public MainModel() { // This forces the instantiation mDictionarySearcher = ServiceContainer.Resolve<SearchModel> (); mSuggestionModel = ServiceContainer.Resolve<SuggestionModel> (); mPlaySoundModel = ServiceContainer.Resolve<PlaySoundModel> (); mDictionarySearcher.SearchCompleted += OnSearchCompleted; var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); mDatabasePath = Path.Combine(documentsPath, "..", "Library", "db_sqlite-net.db"); bool isFirstLoad = false; using (var conn = new SQLite.SQLiteConnection(mDatabasePath)) { // https://github.com/praeclarum/sqlite-net/wiki // In general, it will execute an automatic migration conn.CreateTable<WordModel>(); conn.CreateTable<WaveModel>(); InitialRefresh(conn); LoadNextWord(conn); RefreshWordsList(conn); isFirstLoad = conn.Table<WordModel>().Count() == 0; } if (isFirstLoad) { AddWord("Thanks"); AddWord("For"); AddWord("Downloading"); } }
/** * This method is called when the button to delete all stats is clicked */ private async void dropStats(object sender, EventArgs e) { bool delete = await DisplayAlert("Avertissement", "Attention, supprimer les statistiques est une manoeuvre irréversible !", "Continuer", "Annuler"); if (!delete) { return; } try { SQLite.SQLiteConnection connection = DependencyService.Get <ISQLiteDb>().GetConnection(); connection.DropTable <MyPosition>(); connection.DropTable <Shot>(); connection.DropTable <ScoreHole>(); connection.DropTable <ScorePartie>(); connection.CreateTable <MyPosition>(); connection.CreateTable <Shot>(); connection.CreateTable <ScoreHole>(); connection.CreateTable <ScorePartie>(); } catch (Exception) { } }
//constructor private BookKeeperManager () { string dbPath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal); db = new SQLiteConnection ( dbPath + @"\database.db"); try{ db.Table<Entry>().Count(); } catch(SQLiteException e){ db.CreateTable<Entry> (); } try{ db.Table<TaxRate>().Count(); } catch(SQLiteException e){ db.CreateTable<TaxRate> (); db.Insert (new TaxRate(){ Tax = 6.0}); db.Insert (new TaxRate(){ Tax = 12.0}); db.Insert (new TaxRate(){ Tax = 25.0}); } try{ db.Table<Account>().Count(); } catch(SQLiteException e){ db.CreateTable<Account> (); db.Insert (new Account(){ Name = "Försäljning inom Sverige", Number = 3000}); db.Insert (new Account(){ Name = "Fakturerade frakter", Number = 3520}); db.Insert (new Account(){ Name = "Försäljning av övrigt material", Number = 3619}); db.Insert (new Account(){ Name = "Lokalhyra", Number = 5010}); db.Insert (new Account(){ Name = "Programvaror", Number = 5420}); db.Insert (new Account(){ Name = "Energikostnader", Number = 5300}); db.Insert (new Account(){ Name = "Kassa", Number = 1910}); db.Insert (new Account(){ Name = "PlusGiro", Number = 1920}); db.Insert (new Account(){ Name = "Bankcertifikat", Number = 1950}); } }
public TextSecurePreKeyStore(SQLiteConnection conn) { this.conn = conn; conn.CreateTable<PreKeyRecordI>(); conn.CreateTable<PreKeyIndex>(); conn.CreateTable<SignedPreKeyRecordI>(); conn.CreateTable<SignedPreKeyIndex>(); }
void createNewTable(string pathToDatabase) { using (var conn = new SQLite.SQLiteConnection(pathToDatabase)) { conn.CreateTable <GeoLocation>(); conn.CreateTable <ItemStock>(); } }
/// <summary> /// Initializes a new instance of the <see cref="Tasky.DL.TaskDatabase"/> TaskDatabase. /// if the database doesn't exist, it will create the database and all the tables. /// </summary> /// <param name='path'> /// Path. /// </param> public ItemDetailsDatabase() { database = DependencyService.Get<ISQLite> ().GetConnection (); // create the tables database.CreateTable<ItemDetails>(); database.CreateTable<ShoppingList>(); database.CreateTable<ShoppingCartItem>(); }
public void CreateTables() { using (var connection = new SQLiteConnection(_dbPath) { Trace = true }) { connection.CreateTable<Recording>(); connection.CreateTable<Offender>(); connection.CreateTable<Log>(); } }
/// <summary> /// Initializes a new instance of the <see cref="Tasky.DL.TaskDatabase"/> TaskDatabase. /// if the database doesn't exist, it will create the database and all the tables. /// </summary> /// <param name='path'> /// Path. /// </param> public EvolveDatabase(SQLiteConnection conn) { database = conn; // create the tables database.CreateTable<Speaker>(); database.CreateTable<Session>(); database.CreateTable<SessionSpeaker>(); database.CreateTable<Favorite>(); }
/// <summary> /// Initializes a new instance of the <see cref="Tasky.DL.TaskDatabase"/> TaskDatabase. /// if the database doesn't exist, it will create the database and all the tables. /// </summary> /// <param name='path'> /// Path. /// </param> public ArticoliDatabase() { var db = DependencyService.Get<IDatabase> (); database = db.GetConnection (); // create the tables database.CreateTable<Articolo>(); database.CreateTable<Categoria> (); }
private BookService() { dbPath = Path.Combine(Path.Combine(ApplicationData.Current.LocalFolder.Path, "jadeface.sqlite")); dbConn = new SQLiteConnection(dbPath); dbConn.CreateTable<BookListItem>(); dbConn.CreateTable<ReadingRecord>(); dbConn.CreateTable<ReadingPlan>(); dbConn.CreateTable<ReadingNote>(); }
public EventRepository() { string dbPath = Path.Combine ( Environment.GetFolderPath (Environment.SpecialFolder.Personal), "signin.db3"); db = new SQLiteConnection (dbPath); db.CreateTable<ProjectEvent> (); db.CreateTable<EventPerson> (); }
private void CreateIncomes() { Connection.CreateTable <Income>(); var c1 = new Income() { Name = "Maaş", Amounth = 150, Continious = true, Time = new DateTime() }; //Connection.Insert(c1); }
//creating tables in database public void CreateTable() { var path = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal); dbConn = new SQLiteConnection (System.IO.Path.Combine (path, DB_NAME)); dbConn.CreateTable<VehicleInfo> (); dbConn.CreateTable<TripInfo> (); dbConn.CreateTable<ExpenseInfo> (); dbConn.CreateTable<SettingsInfo> (); }
/// <summary> /// Initializes a new instance of the <see cref="Tasky.DL.TaskDatabase"/> TaskDatabase. /// if the database doesn't exist, it will create the database and all the tables. /// </summary> /// <param name='path'> /// Path. /// </param> public InventoryDatabase() { database = new SQLiteConnection(DatabasePath); // Create the tables database.CreateTable<InventoryItem>(); database.CreateTable<InventoryMedia>(); database.CreateTable<ActivityLog>(); database.CreateTable<ListData>(); }
public void init() { SQLiteConnection conn = new SQLite.SQLiteConnection(DB_PATH); conn.CreateTable <LocationDB>(); conn.CreateTable <CallLogDB>(); conn.CreateTable <FavoriteDB>(); conn.CreateTable <LMLocationDB>(); //conn.CreateTable<LMDoNotTrackLocationDB>(); }
public void CreateTables() { Connection = GetConnection(); Connection.CreateTable <AppConfig>(); Connection.CreateTable <AppUser>(); Connection.CreateTable <ScanData>(); Connection.CreateTable <ScanTypeV2>(); Connection.CreateTable <AdditionalService>(); }
private static SQLiteConnection InitDb() { var dbPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments), "OneToMany.db"); var db = new SQLiteConnection (dbPath); db.SetForeignKeysPermissions(true); db.CreateTable<Customer>(); db.CreateTable<Order>(); return db; }
public static void CreateDatabase(string dbPath) { _dbPath = dbPath; using (var connection = new SQLiteConnection(dbPath, SQLiteOpenFlags.Create|SQLiteOpenFlags.ReadWrite)) { connection.CreateTable<Counter>(); connection.CreateTable<CounterIncrementHistory>(); } }
public static void InitTables() { using (var db = new SQLite.SQLiteConnection(Constants.DbPath)) { db.CreateTable<Pet>(); db.CreateTable<Stage>(); db.CreateTable<SayText>(); db.CreateTable<GraveYard>(); db.CreateTable<GameObject>(); } }
public static void Riempi() { string folder = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var databasePath = Path.Combine(folder, "UmbrellaSQLite.db3"); var database = new SQLite.SQLiteConnection(databasePath); database = DependencyService.Get <IDatabase>().DBConnect(); //Creazione tabella database.CreateTable <Item>(); database.CreateTable <Recensione>(); }
private void Seed() { connection.DropTable <Beer>(); connection.DropTable <Pub>(); connection.CreateTable <Beer>(); connection.CreateTable <Pub>(); Beers = connection.Table <Beer>(); Pubs = connection.Table <Pub>(); }
public KspMods(string a_InstallationDirectory, string a_ModPath ) { InstallationDirectory = a_InstallationDirectory; ModDirectory = a_ModPath; db = new SQLiteConnection("kmm.sqlite"); // make sure the table exists if (db.GetTableInfo("KMMInfo").Count == 0) { db.CreateTable<KMMInfo>(); } var tables = new Type[] { typeof(InstalledMods), typeof(ModFiles), typeof(InstalledFiles) }; foreach (var table in tables) { var info = db.GetTableInfo(table.Name); if (info.Count == 0) db.CreateTable(table); } // oh noez it does not match if (db.Table<KMMInfo>().Count() == 0 || db.Table<KMMInfo>().First().Version != GetAssemblyVersion()) { // salvage data var installed_mods = db.Table<InstalledMods>().ToList(); db.DropTable<InstalledMods>(); db.CreateTable<InstalledMods>(); db.InsertAll(installed_mods); var mod_files = db.Table<ModFiles>().ToList(); db.DropTable<ModFiles>(); db.CreateTable<ModFiles>(); db.InsertAll(mod_files); var installed_files = db.Table<InstalledFiles>().ToList(); db.DropTable<InstalledFiles>(); db.CreateTable<InstalledFiles>(); db.InsertAll(installed_files); } // make sure the table is filled if (db.Table<KMMInfo>().Count() == 0) { var nfo = new KMMInfo() { Version = GetAssemblyVersion() }; db.Insert(nfo); } }
// Constructor public MainPage() { InitializeComponent(); db = new SQLiteConnection("naturapp.db"); db.CreateTable<tablaClientes>(); db.CreateTable<tablaPedidos>(); db.CreateTable<tablaPagos>(); // Establecer el contexto de datos del control ListBox control en los datos de ejemplo DataContext = App.ViewModel; this.Loaded += new RoutedEventHandler(MainPage_Loaded); }
public ScorecardDatabase() { database = DependencyService.Get<ISQLite> ().GetConnection (); // create the tables database.CreateTable<Task>(); database.CreateTable<Period> (); database.CreateTable<Settings> (); if (database.Table<Period> ().Count() == 0) { // only insert the data if it doesn't already exist var newPeriod = new Period (); database.Insert (newPeriod); } }
/// <summary> /// Creates the database tables /// </summary> /// <param name="connection">The database connection</param> private static void CreateDatabaseTables(sqlitenet.SQLiteConnection connection) { connection.CreateTable <FileData>(sqlitenet.CreateFlags.AllImplicit); connection.CreateTable <FileEntry>(sqlitenet.CreateFlags.AllImplicit); connection.Insert( new FileEntry() { Id = string.Empty, IsCollection = true, Name = string.Empty, Path = string.Empty, }, " or ignore"); }
public Database() { var pathToDb = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "sessions.db"); if(!File.Exists(pathToDb)) { File.Copy("sessions.db", pathToDb); } conn = new SQLiteConnection(pathToDb); conn.CreateTable<TimeSlot>(); conn.CreateTable<Session>(); conn.CreateTable<LastUpdate>(); }
private void NewGameState() { state.Money = 50; state.ResidingMarketName = SelectedMarket.Name; using (SQLite.SQLiteConnection connection = new SQLite.SQLiteConnection(App.databasePath)) { connection.CreateTable <State>(); connection.CreateTable <ItemName>(); merchantState = connection.Table <State>().ToList(); inventoryState = connection.Table <ItemName>().ToList(); connection.Insert(state); } }
public static void Main(string[] args) { File.Delete("pegasus.db"); Console.WriteLine("Creating new database"); db = new SQLiteConnection("pegasus.db"); Console.WriteLine("Filling database"); db.CreateTable<Account>(); AccountDummy(); db.CreateTable<DbfCard>(); DbfCardDummy(); db.CreateTable<DbfCardBack>(); DbfCardBackDummy(); db.CreateTable<Deck>(); db.CreateTable<DeckCard>(); DeckDummy(); db.CreateTable<FavoriteHero>(); FavoriteHeroDummy(); db.CreateTable<DbfAchieve>(); db.CreateTable<AchieveProgress>(); AchieveDummy(); Console.WriteLine("Done"); Console.ReadKey(); }
protected UnitAPIShell(string login, string pass) : base(login, pass, "UN1T") { using (var dbConnection = new SQLiteConnection(_dbUnitAndroidPrinterApp)) using(var dbConnectionCurrent = new SQLiteConnection(_dbUnitAndroidPrinterAppCurrent)) { dbConnection.CreateTable<AccountDB>(); dbConnection.CreateTable<PrinterEntryDB>(); dbConnection.CreateTable<TypeWorkDB>(); dbConnection.CreateTable<LastModifyDateDB>(); dbConnectionCurrent.CreateTable<DispatchDB>(); dbConnectionCurrent.CreateTable<AccountDB>(); } }
private SQLiteConnection _sqliteConnection; // https://github.com/praeclarum/sqlite-net #endregion Fields #region Constructors public ShoppingService(SQLiteConnection sqliteConnection) { _sqliteConnection = sqliteConnection; _sqliteConnection.CreateTable<Item>(); _sqliteConnection.CreateTable<BoughtItem>(); var items = _sqliteConnection.Table<Item>().ToList(); var boughtItems = _sqliteConnection.Table<BoughtItem>().ToList(); Items = new ObservableCollection<Item>(items); BoughtItems = new ObservableCollection<BoughtItem>(boughtItems); Items.CollectionChanged += Items_CollectionChanged; BoughtItems.CollectionChanged += BoughtItems_CollectionChanged; }
public override void PrepareDb() { // clean if(File.Exists(PathToDb)) { File.Delete(PathToDb); } // create db & tables using(SQLiteConnection db = new SQLiteConnection(PathToDb)) { db.CreateTable<Main>(); db.CreateTable<Comments>(); db.CreateTable<Tags>(); } }
public static void CreateTables(SQLiteConnection db) { db.BeginTransaction(); db.CreateTable<DriveInformation>(); db.CreateTable<DirectoryInformation>(); db.CreateTable<FileInformation>(); db.CreateTable<FileAttributeInformation>(); db.CreateTable<FileAttribute>(); db.Execute("CREATE INDEX if not exists \"main\".\"ix_DirectoryInformation_driveid_path\" ON \"DirectoryInformation\" (\"DriveId\" ASC, \"Path\" ASC)"); db.Execute("CREATE INDEX if not exists \"main\".\"ix_FileInformation_driveid_directoryid\" ON \"FileInformation\" (\"DirectoryId\" ASC, \"DriveId\" ASC)"); db.Commit(); }
protected override void OnAppearing() { base.OnAppearing(); using (var con = new SQLite.SQLiteConnection(App.FilePath)) { // create a table if it doesnt exist con.CreateTable <TrainingData>(); var myTest = new TrainingData() { Date = "03/01/2020", Rating = 7, Goals = 2, Assists = 1, Tackles = 4, Dribbles = 2, KeyPasses = 0, Stamina = 8 }; // int rowsAdded = con.Insert(myTest); var training = con.Table <TrainingData>().ToList(); TrainingViews.ItemsSource = training; // con.DropTable<TrainingData>(); // var dummyFromDB = con.Table<TrainingData>().ToList(); //Age.Text = dummyFromDB.First().Age.ToString(); //Name.Text = dummyFromDB.First().Name; } }
//public System.Collections.ObjectModel.ObservableCollection<Scoreboard> Scores { get; set; } //Represents a dynamic data collection that provides notifications when items get added, removed, or when the whole list is refreshed. public ScoreboardDataAccess() { database = Xamarin.Forms.DependencyService.Get <ISQL>().GetConnection(); database.CreateTable <Scoreboard>(); //this.Scores = new System.Collections.ObjectModel.ObservableCollection<Scoreboard>(database.Table<Scoreboard>()); }
public void SaveNote() { Note note = new Note { CourseId = course.Id, Content = noteEntry.Text }; try { using (SQLite.SQLiteConnection connection = new SQLite.SQLiteConnection(App.DBPath)) { connection.CreateTable <Note>(); var successfulUpdate = connection.Insert(note); if (successfulUpdate > 0) { DisplayAlert("SUCCESS", "The Note has been added successfully.", "OK"); } } } catch (Exception e) { DisplayAlert("ERROR", "The Note was not added to the database. " + e.Message, "OK"); } Navigation.PopAsync(); }
public bool LoadFromDB(IList <FreeDiscItemDownload> freeDiscDownloader) { if (freeDiscDownloader == null) { #if DEBUG Debug.Write("LoadFromDB: freeDiscDownloader == null"); #endif return(false); } freeDiscDownloader.Clear(); try { using (var conn = new SQLite.SQLiteConnection(App.AppSetting.DBDownloadPath)) { conn.CreateTable <FreeDiscItemDownload>(); var list = conn.Table <FreeDiscItemDownload>().OrderByDescending(x => x.DBID); bool rowEven = false; foreach (var item in list) { // download pending on load from db? if (item.ItemStatus == DownloadStatus.DownloadInProgress) { item.ItemStatus = DownloadStatus.DownloadInterrupted; conn.Update(item); } item.RowEven = !rowEven; rowEven = !rowEven; freeDiscDownloader.Add(item); } } } catch (Exception e) { return(false); } return(true); }
private void Button_Click(object sender, RoutedEventArgs e) { Informacje newInfo = new Informacje() { Id = 1, Wlasciciel = Owner.Text, Adres = Address.Text, Telefon = PhoneNumber.Text, Fax = Fax.Text, Kasjerzy = Cashiers.Text, Myjnia = Wash_Stuff.Text, Monitoring = Monitoring_Stuff.Text, ObslugaLPG = LPG_Stuff.Text }; using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(App.databasePath)) { conn.CreateTable <Informacje>(); conn.InsertOrReplace(newInfo); } MessageBox.Show("Zaktualizowano."); MainWindow mainWindow = new MainWindow(_loggedInAccount); this.Close(); mainWindow.Show(); }
private void A1_button_Click(object sender, RoutedEventArgs e) { Konto newCustomer = new Konto() { Role = "Customer", Nazwa_firmy = Company_name.Text, Imie = Name.Text, Nazwisko = Surname.Text, Pesel = PESEL.Text, Regon = REGON.Text, Nip = NIP.Text, Ulica = Street.Text, Numer = Number.Text, Kod_pocztowy = ZIP_code.Text, Miasto = City.Text, Email = E_mail.Text, Login = Login.Text, Haslo = Haslo.Text, Points = 0 }; using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(App.databasePath)) { conn.CreateTable <Konto>(); conn.Insert(newCustomer); } Customers_Window custWindow = new Customers_Window(_loggedInAccount); custWindow.Show(); this.Close(); }
public SQLiteConnection GetConnection() { try { string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, Constants.csDataBaseName); var isShouldGenerateTables = false; if (!System.IO.File.Exists(path)) { isShouldGenerateTables = true; } var conn = new SQLite.SQLiteConnection(path); if (isShouldGenerateTables) { conn.CreateTable <InfoItem>(); } return(conn); } catch (Exception ex) { Console.WriteLine(ex); } finally { } return(null); }
public override void SaveSetting() { if (!AutoSave) { return; } using (var conn = new SQLite.SQLiteConnection(DBSettingPath)) { conn.CreateTable <AppSettings>(); AppSettings save = new AppSettings(); foreach (PropertyInfo property in typeof(AppSettings).GetProperties()) { if (property.CanWrite) { property.SetValue(save, property.GetValue(this, null), null); } } int count; if (conn.Table <AppSettings>().Count() == 0) { count = conn.Insert(save); } else { count = conn.Update(save); } Debug.WriteLine("SaveSetting: " + DBSettingPath); Debug.WriteLine("SaveSettingCount : " + count); } }
public void Create(string dbname) { using (var conn = new SQLite.SQLiteConnection(dbname)) { conn.CreateTable <Person>(); } }
async private void save_Click(object sender, RoutedEventArgs e) { MainPage mp = new MainPage(); if (firstname_box.Text != "" && lastname_box.Text != "" && zipcode_box.Text != "" && place_box.Text != "") { int i = 1; var conn = new SQLite.SQLiteConnection(Class1.dbPath); //creates db if does not exist //if db exists continues with that db conn.CreateTable <userdata>(); //creates table if does not exists //if table exists continues with that table by adding new data with out deleting old data. conn.Insert(new userdata() { id = i, firstname = firstname_box.Text, lastname = lastname_box.Text, zipcode = zipcode_box.Text, place = place_box.Text, dateandtime = DateTime.Now.ToString() }); MessageDialog msg = new MessageDialog("Updated Successfully", "Success!"); await msg.ShowAsync(); // this.Frame.Navigate(typeof(MainPage)); } else { MessageDialog msg = new MessageDialog("Missed some fields,please enter them to update profile sucessfully", "Error"); await msg.ShowAsync(); } }
private void filteredSearch_Click(object sender, RoutedEventArgs e) { string categoryfilter = categoryFilter.Text; string titlefilter = titleFilter.Text; using (SQLite.SQLiteConnection connection = new SQLite.SQLiteConnection(App.databasePath)) { connection.CreateTable <Recipe>(); if (string.IsNullOrEmpty(titlefilter)) { recipeListView.Visibility = Visibility.Visible; recipeList = (connection.Table <Recipe>().ToList()).OrderBy(t => t.Name).Where (c => c.Category == categoryfilter).ToList(); } else { recipeListView.Visibility = Visibility.Visible; recipeList = (connection.Table <Recipe>().ToList()).OrderBy(t => t.Name).Where (c => c.Category == categoryfilter).Where(x => x.Name.Contains(titlefilter)).ToList(); } } if (recipeList != null) { recipeListView.ItemsSource = recipeList; } }
private void BtnAddText_Click(object sender, EventArgs e) { if (Check()) { if (cbSqLite.Checked == true) { var databasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "MyNote.csv"); var db = new SQLiteConnection(databasePath); db.CreateTable <Note>(); var notes = new Note() { Title = txtTitle.Text, Text = txtText.Text, Date = DateTime.Now }; db.Insert(notes); dgvShowTexts.DataSource = db.Table <Note>().ToList(); txtTitle.Text = ""; txtText.Text = ""; } else { MessageBox.Show("ابتدا باید دیتابیس مورد نظر خود را انتخاب کنید"); } } }
public async void Initialize() { using (var db = new SQLite.SQLiteConnection(_dbPath)) { db.CreateTable <Customer>(); //Note: This is a simplistic initialization scenario if (db.ExecuteScalar <int>("select count(1) from Customer") == 0) { db.RunInTransaction(() => { db.Insert(new Customer() { FirstName = "Phil", LastName = "Japikse" }); db.Insert(new Customer() { FirstName = "Jon", LastName = "Galloway" }); db.Insert(new Customer() { FirstName = "Jesse", LastName = "Liberty" }); }); } else { await Load(); } } }
private void createTb_Click(object sender, RoutedEventArgs e) { // list available table // create table using (var m_dbConnection = new SQLite.SQLiteConnection(dbPath)) { try { m_dbConnection.CreateTable <highscore>(); Logger.Info("Table created"); } catch (System.Exception ex) { Logger.Error(ex.Message); } } // check table exist /* * var db = new SQLiteConnection("sqllite.db") * db.CreateTable<SyncRecord> (); * db.Insert (new SyncRecord () { SyncDate = DateTime.UtcNow }); * var query = db.Table<SyncRecord> ().Where(your lambda to filter); */ }
public void Initialize() { using (var db = new SQLiteConnection(DbPath)) { db.CreateTable<TracklistItem>(); } }
public void Initialize() { using (var db = new SQLite.SQLiteConnection(_dbPath)) { db.CreateTable <MusicLibraryViewModel.AlbumItem>(); } }
private async void Button_Clicked(object sender, EventArgs e) { Product product = new Product() { Image = Image.Text, Title = Title.Text, Price = Price.Text, Description = Description.Text }; Console.WriteLine("THIS IS PRE INSERT USER OBJECT: " + product.Title); using (conn) { conn.CreateTable <Product>(); var numberOfRows = conn.Insert(product); if (numberOfRows > 0) { await DisplayAlert("sucess", "Product has been added", "okay!"); await Navigation.PushAsync(new Products()); } else { await DisplayAlert("Failure", "Something went wrong, the product wasn't added", "Return"); } } }
// singleton Instance and Creating Database private SQLiteDBHelper() { using (var dataBase = new SQLite.SQLiteConnection(dataBasePath)) { dataBase.CreateTable <UserObject>(); } }