public void SetUp() { helper = new SQLiteDatabaseHelper(); helper.CreateTestDatabase(); context = new SQLiteStoreContext(helper.DatabaseFile); viewModel = new BatchOperatorViewModel(new SQLiteBatchOperatorSource(context)); }
public override void SetUp() { databaseHelper = new SQLiteDatabaseHelper(); databaseHelper.CreateTestDatabase(); operatorSource = new SQLiteBatchOperatorSource(new SQLiteStoreContext(databaseHelper.DatabaseFile)); base.SetUp(); }
public override void SetUp() { sqliteHelper = new SQLiteDatabaseHelper(); sqliteHelper.CreateTestDatabase(); SQLiteStoreContext context = new SQLiteStoreContext(sqliteHelper.DatabaseFile); operatorSource = new SQLiteBatchOperatorSource(context); base.SetUp(); }
public override void SetUp() { databaseHelper = new SQLiteDatabaseHelper(); databaseHelper.CreateTestDatabase(); context = new SQLiteStoreContext(databaseHelper.DatabaseFile); inventorySource = new SQLiteActiveInventorySource(context); operatorSource = new SQLiteBatchOperatorSource(context); receivedBatchSource = new SQLiteReceivedBatchSource(context, inventorySource); base.SetUp(); }
public void SetUp() { dbHelper = new SQLiteDatabaseHelper(); dbHelper.CreateTestDatabase(); sqliteStore = new SQLiteStoreContext(dbHelper.DatabaseFile); operatorSource = new SQLiteBatchOperatorSource(sqliteStore); inventorySource = new SQLiteActiveInventorySource(sqliteStore); receivedBatchSource = new SQLiteReceivedBatchSource(sqliteStore, inventorySource); implementedBatchSource = new SQLiteImplementedBatchSource(sqliteStore, inventorySource); operatorHelper = new BatchOperatorTestHelper(operatorSource); viewModel = new MainWindowViewModel(inventorySource, receivedBatchSource, implementedBatchSource, operatorSource); batchOperator = operatorHelper.GetJaneDoeOperator(); }
public async Task UpdateStockEntries() { List <StockListEntries> stockItems = SQLiteDatabaseHelper <StockListEntries> .ReadRecordToList(); if (stockItems.Count == 0) { return; } var chartData = await ChartRow.ConvertStockEntriesToChartData(stockItems); CorrectListEntriesWhichUpdated(chartData); }
public override void SetUp() { sqliteHelper = new SQLiteDatabaseHelper(); sqliteHelper.CreateTestDatabase(); SQLiteStoreContext context = new SQLiteStoreContext(sqliteHelper.DatabaseFile); inventorySource = new SQLiteActiveInventorySource(context); receivedBatchSource = new SQLiteReceivedBatchSource(context, inventorySource); implementedBatchSource = new SQLiteImplementedBatchSource(context, inventorySource); operatorSource = new SQLiteBatchOperatorSource(context); viewModel = new ReceivingHistoryViewModel(receivedBatchSource, inventorySource, operatorSource, implementedBatchSource, GetReceivingManagementViewModel()); command = new OpenPurchaseOrderEditorCommand(viewModel); base.SetUp(); }
public override void SetUp() { sqliteHelper = new SQLiteDatabaseHelper(); sqliteHelper.CreateTestDatabase(); SQLiteStoreContext context = new SQLiteStoreContext(sqliteHelper.DatabaseFile); inventorySource = new SQLiteActiveInventorySource(context); receivedBatchSource = new SQLiteReceivedBatchSource(context, inventorySource); implementedBatchSource = new SQLiteImplementedBatchSource(context, inventorySource); operatorSource = new SQLiteBatchOperatorSource(context); viewModel = new MainWindowViewModel(inventorySource, receivedBatchSource, implementedBatchSource, operatorSource); command = new CommitBatchToImplementationLedgerCommand(viewModel); base.SetUp(); }
public override void SetUp() { sqliteHelper = new SQLiteDatabaseHelper(); sqliteHelper.CreateTestDatabase(); SQLiteStoreContext context = new SQLiteStoreContext(sqliteHelper.DatabaseFile); operatorSource = new SQLiteBatchOperatorSource(context); inventorySource = new SQLiteActiveInventorySource(context); receivedBatchSource = new SQLiteReceivedBatchSource(context, inventorySource); implementedBatchSource = new SQLiteImplementedBatchSource(context, inventorySource); viewModel = new ImplementationInquiryViewModel(implementedBatchSource); command = new ListLatestImplementedBatchesByDateCommand(viewModel); base.SetUp(); }
public void SetUp() { helper = new SQLiteDatabaseHelper(); helper.CreateTestDatabase(); SQLiteStoreContext context = new SQLiteStoreContext(helper.DatabaseFile); IActiveInventorySource inventorySource = new SQLiteActiveInventorySource(context); viewModel = new ReceivingManagementViewModel( new DuracolorIntermixBatchNumberValidator(), new DuracolorIntermixColorList(), new SQLiteReceivedBatchSource(context, inventorySource), new SQLiteBatchOperatorSource(context), inventorySource ); }
public override void SetUp() { validator = new DuracolorIntermixBatchNumberValidator(); sqliteHelper = new SQLiteDatabaseHelper(); sqliteHelper.CreateTestDatabase(); SQLiteStoreContext context = new SQLiteStoreContext(sqliteHelper.DatabaseFile); inventorySource = new SQLiteActiveInventorySource(context); receivedBatchSource = new SQLiteReceivedBatchSource(context, inventorySource); implementedBatchSource = new SQLiteImplementedBatchSource(context, inventorySource); operatorSource = new SQLiteBatchOperatorSource(context); viewModel = new BatchHistoryViewModel(validator, inventorySource, receivedBatchSource, implementedBatchSource); command = new DisplayBatchHistoryFromBatchNumberCommand(viewModel); base.SetUp(); }
public async void DeleteChartRow(ChartRow chartRow) { var stockName = chartRow.StockName; var stockCode = chartRow.StockCode; var deleted = await SQLiteDatabaseHelper <StockListEntries> .DeleteRecord(row => row.StockCode == stockCode); if (!deleted.IsValid) { var error = deleted.GetErrorResponse(); await App.Current.MainPage.DisplayAlert("Error Deleting", "Error in deleting row", "OK"); return; } ChartListData.Remove(chartRow); }
public void SetUp() { sqliteHelper = new SQLiteDatabaseHelper(); sqliteHelper.CreateTestDatabase(); SQLiteStoreContext context = new SQLiteStoreContext(sqliteHelper.DatabaseFile); inventorySource = new SQLiteActiveInventorySource(context); receivedBatchSource = new SQLiteReceivedBatchSource(context, inventorySource); implementedBatchSource = new SQLiteImplementedBatchSource(context, inventorySource); operatorSource = new SQLiteBatchOperatorSource(context); viewModel = new ReceivingHistoryViewModel( receivedBatchSource, inventorySource, operatorSource, implementedBatchSource, GetReceivingManagementViewModel() ); command = new ChangeSearchCriteriaPanelVisibilityCommand(viewModel); }
public BusinessObject GetFirstObject( ) { StringBuilder strBuilder = new StringBuilder(); strBuilder.Append(String.Format("Select Top(1) * From [{0}] ", TableName)); if (DataStructureProvider.IsExistABCStatus(TableName)) { strBuilder.Append(" WHERE "); strBuilder.Append(String.Format("[{0}]='{1}'", ABCCommon.ABCConstString.colABCStatus, ABCCommon.ABCConstString.ABCStatusAlive)); } String strQuery = strBuilder.ToString(); if (DatabaseHelper.IsSQLConnection() == false) { strQuery = SQLiteDatabaseHelper.RepairSelectSQLite(strQuery); } DataSet ds = DatabaseHelper.RunQuery(strQuery); return(BusinessObjectHelper.GetBusinessObject(ds, TableName)); }
public override void SetUp() { sqliteHelper = new SQLiteDatabaseHelper(); sqliteHelper.CreateTestDatabase(); SQLiteStoreContext context = new SQLiteStoreContext(sqliteHelper.DatabaseFile); inventorySource = new SQLiteActiveInventorySource(context); receivedBatchSource = new SQLiteReceivedBatchSource(context, inventorySource); implementedBatchSource = new SQLiteImplementedBatchSource(context, inventorySource); operatorSource = new SQLiteBatchOperatorSource(context); base.SetUp(); viewModel = new ReceivedPurchaseOrderEditorViewModel( receivedBatchSource.GetPurchaseOrderForEditing(originalPONumber), new DuracolorIntermixColorList(), new DuracolorIntermixBatchNumberValidator(), operatorSource, inventorySource, receivedBatchSource, implementedBatchSource ); command = new UpdatePurchaseOrderReceivingRecordCommand(viewModel); }
public static void Main(string[] args) { try { SQLitePCL.Batteries.Init(); // initialize the helper for SQLite databases SQLiteDatabaseHelper databaseHelper = (SQLiteDatabaseHelper)DatabaseHelperFactory.CreateDatabaseHelper(DatabaseType.SQLite); databaseHelper.WithoutRowIdEnabled = true; using (IDbConnection connection = InitDatabase()) { // simple migrations (SQLDemoSimpleMigrationController.cs) // 1. create database and insert persons with a name // 2. append Name = Name + " " + ToUpper(Name) // 3. set the age to 20 SQLDemoSimpleMigrationController simpleMigrationController = new SQLDemoSimpleMigrationController( new SQLUnitOfWorkFactory(connection), databaseHelper ); simpleMigrationController.ApplyMigrations(); Console.WriteLine("simple migrations result:"); PrintPersons(connection); // class migrations (Migration.cs) // 1. Age = Age + 2 using code // 2. Age = Age + 10 using a SQL statement out of a stream SQLClassMigrationController classMigrationController = new SQLClassMigrationController( new SQLUnitOfWorkFactory(connection), databaseHelper ); classMigrationController.ApplyMigrations(); Console.WriteLine("\nclass migrations result:"); PrintPersons(connection); // SQL file migrations (files inside the 'migrations' directory) string assemblyLocation = Assembly.GetExecutingAssembly().Location; int index = assemblyLocation.LastIndexOf(Path.DirectorySeparatorChar); string assemblyDirectory = assemblyLocation.Substring(0, index); SQLFileMigrationController sqlFileMigrationController = new SQLFileMigrationController( new SQLUnitOfWorkFactory(connection), databaseHelper, Path.Combine(assemblyDirectory, "migrations") ) { SkipInitInstalledVersions = true }; sqlFileMigrationController.ApplyMigrations(); Console.WriteLine("\nSQL file migrations result:"); PrintPersons(connection); } } catch (Exception exc) { Console.WriteLine(exc); } Console.WriteLine("\nPress enter to exit..."); Console.Read(); }
private static void EnsureDb() { if (db == null) { if (!File.Exists(DbPath)) { if (!Directory.Exists(Config.DataPath)) { Directory.CreateDirectory(Config.DataPath); } using var fzDb = SQLiteDatabaseHelper.OpenOrCreate(DbPath); fzDb.CreateTable(WebPagesTableName, "ID", new SQLiteColumn(nameof(WebPage.Name), SQLiteDataType.Text), new SQLiteColumn(nameof(WebPage.Url), SQLiteDataType.Text), new SQLiteColumn(nameof(WebPage.Enabled), SQLiteDataType.Integer), new SQLiteColumn(nameof(WebPage.LastUpdateTime), SQLiteDataType.Text), new SQLiteColumn(nameof(WebPage.LastCheckTime), SQLiteDataType.Text), new SQLiteColumn(nameof(WebPage.Interval), SQLiteDataType.Integer), //new SQLiteColumn(nameof(WebPage.LatestContent), SQLiteDataType.Blob), new SQLiteColumn(nameof(WebPage.BlackWhiteListJson), SQLiteDataType.Text), new SQLiteColumn(nameof(WebPage.BlackWhiteListMode), SQLiteDataType.Integer), new SQLiteColumn(nameof(WebPage.InnerTextOnly), SQLiteDataType.Integer), new SQLiteColumn(nameof(WebPage.IgnoreWhiteSpace), SQLiteDataType.Integer), new SQLiteColumn(nameof(WebPage.Request_CookiesJson), SQLiteDataType.Text), new SQLiteColumn(nameof(WebPage.Request_Accept), SQLiteDataType.Integer), new SQLiteColumn(nameof(WebPage.Request_Method), SQLiteDataType.Text), new SQLiteColumn(nameof(WebPage.Request_Origin), SQLiteDataType.Text), new SQLiteColumn(nameof(WebPage.Request_Referer), SQLiteDataType.Text), new SQLiteColumn(nameof(WebPage.Request_ContentType), SQLiteDataType.Text), new SQLiteColumn(nameof(WebPage.Request_UserAgent), SQLiteDataType.Text), new SQLiteColumn(nameof(WebPage.Request_Body), SQLiteDataType.Text), new SQLiteColumn(nameof(WebPage.Request_Expect100Continue), SQLiteDataType.Integer), new SQLiteColumn(nameof(WebPage.Request_KeepAlive), SQLiteDataType.Integer), new SQLiteColumn(nameof(WebPage.Request_AllowAutoRedirect), SQLiteDataType.Integer), new SQLiteColumn(nameof(WebPage.Response_Type), SQLiteDataType.Integer) ); fzDb.CreateTable(ScriptsTableName, "ID", new SQLiteColumn(nameof(Script.Name), SQLiteDataType.Text), new SQLiteColumn(nameof(Script.Code), SQLiteDataType.Text), new SQLiteColumn(nameof(Script.Enabled), SQLiteDataType.Integer), new SQLiteColumn(nameof(Script.Interval), SQLiteDataType.Integer), new SQLiteColumn(nameof(Script.LastExcuteTime), SQLiteDataType.Text) ); fzDb.CreateTable(WebPageUpdatesTableName, "ID", new SQLiteColumn(nameof(WebPageUpdate.WebPage_ID), SQLiteDataType.Integer), new SQLiteColumn(nameof(WebPageUpdate.Time), SQLiteDataType.Text), new SQLiteColumn(nameof(WebPageUpdate.Content), SQLiteDataType.Blob) ); fzDb.CreateTable(TriggersTableName, "ID", new SQLiteColumn(nameof(Trigger.Name), SQLiteDataType.Text), new SQLiteColumn(nameof(Trigger.Enabled), SQLiteDataType.Integer), new SQLiteColumn(nameof(Trigger.LastExcuteTime), SQLiteDataType.Text), new SQLiteColumn(nameof(Trigger.Event), SQLiteDataType.Text), new SQLiteColumn(nameof(Trigger.Event_ID), SQLiteDataType.Text), new SQLiteColumn(nameof(Trigger.Operation), SQLiteDataType.Text), new SQLiteColumn(nameof(Trigger.Operation_ID), SQLiteDataType.Text), new SQLiteColumn(nameof(Trigger.Operation_Command), SQLiteDataType.Text) ); fzDb.CreateTable(LogTableName, "ID", new SQLiteColumn(nameof(Log.Type), SQLiteDataType.Text), new SQLiteColumn(nameof(Log.Message), SQLiteDataType.Text), new SQLiteColumn(nameof(Log.Item_ID), SQLiteDataType.Integer), new SQLiteColumn(nameof(Log.Time), SQLiteDataType.Text) ); } } db = new SQLiteConnection($"data source = {DbPath};version=3;"); }