private void saveFileTypeButton_Click(object sender, EventArgs e) { try { SettingsDAO settingsDAO = new SettingsDAO(ConfigurationDatabase); settingsDAO.Delete(FileTypeID); settingsDAO.Insert(new Settings(FileTypeID, useFileNameCheckBox.Checked, useFileExtensionCheckBox.Checked, textToIgnoreFileNameTextBox.Text, dateTimeFormatFileNameTextBox.Text, textToIgnoreFileExtensionTextBox.Text, dateTimeFormatFileExtensionTextBox.Text, linkDateTimeCheckBox.Checked, dateTimeColumnTextBox.Text, dateTimeFormatLinkDateTextBox.Text, truncateTableCheckBox.Checked)); ColumnDAO columnDAO = new ColumnDAO(ConfigurationDatabase); columnDAO.DeleteAll(FileTypeID); foreach (DataGridViewRow row in columnDataGridView.Rows) { columnDAO.Insert(new Column(FileTypeID, Convert.ToInt32(row.Cells[0].Value), row.Cells[1].Value.ToString(), row.Cells[2].Value.ToString(), Convert.ToBoolean(row.Cells[3].Value), Convert.ToBoolean(row.Cells[4].Value))); } HeaderDAO headerDAO = new HeaderDAO(ConfigurationDatabase); headerDAO.DeleteAll(FileTypeID); foreach (DataGridViewRow row in headerDataGridView.Rows) { headerDAO.Insert(new Header(FileTypeID, Convert.ToInt32(row.Cells[0].Value), row.Cells[1].Value.ToString())); } FooterDAO footerDAO = new FooterDAO(ConfigurationDatabase); footerDAO.DeleteAll(FileTypeID); foreach (DataGridViewRow row in footerDataGridView.Rows) { footerDAO.Insert(new Footer(FileTypeID, Convert.ToInt32(row.Cells[0].Value), row.Cells[1].Value.ToString())); } MessageBox.Show("Successfully saved File Type Configuration!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } catch (Exception exception) { MessageBox.Show("Failed to save Column data. " + exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }