private void Save() { // We have to remove all the existing data and insert the new data to save properly #region Fields _formSchema.schema_name = txtSchemaName.Text; _formSchema.data_type = (DataMappingConnectionTypes)cmbDataType.SelectedItem; _formSchema.sqlstatement = txtSQL.Text; _formSchema.server_name = txtServerName.Text; _formSchema.database_name = txtDatabaseName.Text; _formSchema.user_name = txtUserName.Text; _formSchema.allow_password_save = chkAllowSavePassword.Checked; _formSchema.claim_id_column = txtClaimIDColumn.Text; _formSchema.company_namecolumn = txtCompanyNameColumn.Text; _formSchema.date_column = txtDateColumn.Text; _formSchema.sqlstatementsecondaries = txtSQLSecondary.Text; _formSchema.sqlstatementpredeterms = txtSQLPredeterm.Text; _formSchema.claim_db_column = txtClaimDBColumn.Text; _formSchema.sqlstatementsecondarypredeterms = txtSQLSecondaryPredeterm.Text; if (chkAllowSavePassword.Checked) { _formSchema.pw = txtPassword.Text; } else { _formSchema.pw = ""; } #endregion _formSchema.Save(); _formSchema.ExecuteNonQuery("DELETE FROM data_mapping_schema_data WHERE schema_id = " + _formSchema.id); data_mapping_schema_data saveSchemaData; foreach (DataGridViewRow aRow in dgvMappings.Rows) { if (CommonFunctions.DBNullToString(aRow.Cells["colLinkedField"].Value) != "") { // Save this saveSchemaData = new data_mapping_schema_data(); saveSchemaData.mapping_field_id = ((data_mapping_field)aRow.Cells["colFieldData"].Value).id; saveSchemaData.mapped_to_text = aRow.Cells["colLinkedField"].Value.ToString(); saveSchemaData.schema_id = _formSchema.id; saveSchemaData.Save(); } } _dataChanged = false; }
private void cmbSchema_SelectedIndexChanged(object sender, EventArgs e) { data_mapping_schema toLoad; if (cmbSchema.SelectedIndex == cmbSchema.Items.Count - 1) { toLoad = new data_mapping_schema(); toLoad.schema_name = GenerateNewName(); toLoad.data_type = DataMappingConnectionTypes.SQLServer; toLoad.allow_password_save = false; toLoad.Save(); frmConfigureSchema toShow = new frmConfigureSchema(toLoad); toShow.ShowDialog(); InitializeSchemaList(toShow.SchemaName); } }