/// <summary> /// UpdateAfterOpenDB - Updates the controls and other important variables after a database is opened. /// </summary> private void UpdateAfterOpenDB() { DataTable dt = new DataTable(); Mydb.GetCurrentInventory(); //Load the current inventory into the datatable used by View and Search dt_V_DispensedTable.Clear(); Mydb.GetTable(dt_V_DispensedTable, SSTable.Dispensed); //Load the dispensed inventory into the datatable used by View Mydb.GetDBInfo(dt); //Load the database info GuiPrefs.OpenDBPath = Mydb.MyPath; if (dt.Rows.Count > 0) { //Set the database info to corresponding member variables GuiPrefs.OpenDBName = dt.Rows[0][0].ToString(); GuiPrefs.OpenDBLoc = dt.Rows[0][1].ToString(); string codb = String.Format("Database: {0} ({1})", GuiPrefs.OpenDBName, GuiPrefs.OpenDBLoc); lb_Add_CurrentOpenDB.Text = codb; lb_S_CurrentOpenDB.Text = codb; lb_D_CurrentOpenDB.Text = codb; lb_V_CurrentOpenDB.Text = codb; lb_R_CurrentOpenDB.Text = codb; } //Check for merge info and alter display if necessary dt.Reset(); dt_Add_MergeTable.Clear(); try { Mydb.GetTable(dt, SSTable.MergeInfo); tb_Add_MinSKU.Text = dt.Rows[0][1].ToString(); tb_Add_MaxSKU.Text = dt.Rows[0][2].ToString(); Mydb.GetTable(dt_Add_MergeTable, SSTable.MergeItems); bs_Add_InventorySource.DataSource = dt_Add_MergeTable; Enable_AllControls(false); } catch { //If there's an exception, it's not a merge db bs_Add_InventorySource.DataSource = Mydb.InvResults; tb_Add_MinSKU.Clear(); tb_Add_MaxSKU.Clear(); Enable_AllControls(true); } Enable_MenuItems(true); ResetOps(); //Reset number of operations performed since last auto backup ConfigureAutoBackupTimer(); //Configures (and resets) the timer for auto backups }