private void menuItemGenerateMappingFiles_Click(object sender, EventArgs e) { CodeGeneratorMappingsDialog dialog1 = null; try { if (listView.CheckedItems.Count == 0) { MessageBox.Show("Please choose the table from which you want to generate the mappings", "DataBlock Modeler", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (CheckForPrimaryKeys()) { dialog1 = new CodeGeneratorMappingsDialog(); if (dialog1.ShowDialog() == DialogResult.OK) { GenerateMappings(dialog1.SelectedNamespaceName, dialog1.SelectedPath, dialog1.SelectedLanguage); GeneratePersistent(dialog1.SelectedNamespaceName, dialog1.SelectedPath, dialog1.SelectedLanguage); MessageBox.Show("Files were successfully generated.", "DataBlock Modeler", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } catch (Exception exception1) { MessageBox.Show("Error occurred while generating the files \n" + exception1.Message, "DataBlock Modeler", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } finally { if (dialog1 != null) { dialog1.Dispose(); } } }
private void menuItemGenerateMappingFiles_Click(object sender, EventArgs e) { CodeGeneratorMappingsDialog dialog = null; try { if (listView.CheckedItems.Count == 0) { MessageBox.Show("Please choose the table from which you want to generate the mappings", "DataBlock Modeler", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (CheckForPrimaryKeys()) { dialog = new CodeGeneratorMappingsDialog(); List <string> listTables = new List <string>(); List <string> listEntities = new List <string>(); GetSelectedEntities(ref listTables, ref listEntities); if (dialog.ShowDialog() == DialogResult.OK) { presenter.GenerateDomainObjects(dialog.SelectedNamespaceName, dialog.SelectedPath, dialog.SelectedLanguage, listTables, listEntities); presenter.GenerateDataAccessEntities(dialog.SelectedNamespaceName, dialog.SelectedPath, dialog.SelectedLanguage, listTables, listEntities); presenter.GenerateBusinessObjects(dialog.SelectedNamespaceName + ".BusinessObjects", dialog.SelectedPath, dialog.SelectedLanguage, listTables, listEntities); MessageBox.Show("Files were successfully generated.", "DataBlock Modeler", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } catch (Exception exception1) { MessageBox.Show("Error occurred while generating the files \n" + exception1.Message, "DataBlock Modeler", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } finally { if (dialog != null) { dialog.Dispose(); } } }