示例#1
0
        private void doTheItemsExist()
        {
            connection = DBReader.connectionCreator(DBName);
            try
            {
                DBReader.connectionOpen(connection);

                if (DBReader.procedureStatus(connection, tableName).Count() > 0)
                {
                    buttonShowItems.Enabled = true;
                    items = DBReader.selectItems(connection, tableName);
                }
                else
                {
                    buttonShowItems.Enabled = false;
                }
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                DBReader.connectionEnd(connection);
            }
        }
示例#2
0
        private List <string> getColumnsInBothTables(string normalName, string itemsName)
        {
            connection = DBReader.connectionCreator(DBName);
            try
            {
                DBReader.connectionOpen(connection);
                columnsInBothTables  = new List <string>();
                columnsInNormalTable = new List <string>();
                columnsInItemsTable  = new List <string>();

                columnsInNormalTable = DBReader.selectAllColumnNames(connection, normalName);
                columnsInItemsTable  = DBReader.selectAllColumnNames(connection, itemsName);

                foreach (string value in columnsInNormalTable)
                {
                    for (int i = 0; i < columnsInItemsTable.Count(); i++)
                    {
                        if (value == columnsInItemsTable[i])
                        {
                            columnsInBothTables.Add(value);
                        }
                    }
                }
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                DBReader.connectionEnd(connection);
            }
            return(columnsInBothTables);
        }
示例#3
0
 private void newConnection(string databaseName)
 {
     connection = DBReader.connectionCreator(databaseName);
     try
     {
         DBReader.connectionOpen(connection);
     }
     catch (MySqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         DBReader.connectionEnd(connection);
     }
 }
示例#4
0
        /// <summary>
        /// Opens everything when EntityManager is loaded
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EntityManager_Load(object sender, EventArgs e)
        {
            namesToTextBoxes();

            connection = DBReader.connectionCreator(DBName);
            try
            {
                DBReader.connectionOpen(connection);
                addNewRowEditor();
                placeRowEditors();
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                DBReader.connectionEnd(connection);
            }
            doTheItemsExist();
        }