private void btnRepair_Click(object sender, EventArgs e) { DisableAllControls(); if (DB_Conn.CompactAndRepair()) { MessageBox.Show("Successfully Compacted and Repaired the games database file.", "Success"); } else { DialogResult dialogResult = MessageBox.Show("The database could not be Compacted and Repaired. You will need to open up the games.accdb file in Access if you want to still compact and repair. \n\nDo you want to open the folder where the database is located so that you can open it in Access?\n\nWarning. Don't delete anything in this folder!", "Failure to Optimize", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Error); if (dialogResult == DialogResult.Yes) { try { Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Jeopardy2019"); } catch (Exception ex) { MessageBox.Show("Could not find the folder:\n" + Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Jeopardy2019"); Console.Write(ex.ToString()); } } } EnableAllControls(); btnRepair.Enabled = false; }
internal static int ExecuteQuery(string query) { // Getting oracle connection first OracleConnection connection = DB_Conn.GetOracleConnection(); if (connection != null) { // Creating Oracle Command for perticular query through that connection OracleCommand command = new OracleCommand(query, connection); return(command.ExecuteNonQuery()); } return(0); }
public static int stockCheck(Software.Model.Order_Food food) { int stock = 0; OracleConnection conn = DB_Conn.GetOracleConnection(); string sql = "select stock_count from food where id=" + food.Food_Id; OracleCommand cmd = new OracleCommand(sql, conn); cmd.CommandType = CommandType.Text; OracleDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { stock = Convert.ToInt32(dr["stock_count"].ToString()); } conn.Close(); return(stock); }
internal static DataSet GetDataSet(string query) { // Getting oracle connection first OracleConnection connection = DB_Conn.GetOracleConnection(); if (connection != null) { // Creating Oracle Command for perticular query through that connection OracleCommand command = new OracleCommand(query, connection); // Converting the command into C# dataset OracleDataAdapter dataAdapter = new OracleDataAdapter(command); DataSet dataSet = new DataSet(); dataAdapter.Fill(dataSet); // Closing the connection connection.Close(); // Returning dataset return(dataSet); } return(null); }
private void btnRestore_Click(object sender, EventArgs e) { DisableAllControls(); DialogResult dialogResult = MessageBox.Show("Are you sure that you want to reset the database to just the default games that came pre-installed? You may lose progress on any games that you created or edited. Consider Exporting any games that you want to save to an XML file.", "Factory Reset Confirm", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); if (dialogResult == DialogResult.Yes) { if (DB_Conn.RestoreDBFromBackup()) { MessageBox.Show("Database restore successfully", "Success"); } else { MessageBox.Show("Database could not be restored. You may need to re-install this program.", "Failure to Restore"); } } EnableAllControls(); btnRestore.Enabled = false; }
private void tutorialToolStripMenuItem_Click(object sender, EventArgs e) { DB_Conn.OpenHelpFile(); }
private void btnInstall_Click_1(object sender, EventArgs e) { DisableAllControls(); DB_Conn.InstallAccessRuntime(); EnableAllControls(); }