private void btnGenerate_Click(object sender, EventArgs e) { // First, validate each input InputValidationResult validationResult = ValidateInput(); if (validationResult != InputValidationResult.VALID) { ShowInputErrorDialog(validationResult); } else { // Build DALEntity and DALAttributes DALEntity entity = new DALEntity(txtEntityName.Text, txtDatabaseName.Text, txtSchemaName.Text, txtNamespace.Text); foreach (SQLAttributePicker attributePicker in attributeList) { DALAttributes attribute = new DALAttributes(attributePicker.AttributeName, attributePicker.DataType, attributePicker.AttributeSize, attributePicker.IsPrimaryKey, attributePicker.AutoIncrement, attributePicker.IsForeignKey, attributePicker.ReferenceEntity, attributePicker.ReferenceAttribute); entity.Attributes.Add(attribute); } String outputPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); if (radTSQL.Checked) { // Generate TSQL Create Table and Stored Procedure scripts. var tsqlGenerator = new TSQLTemplate(); tsqlGenerator.GenerateContent(entity, outputPath); } if (radMySQL.Checked) { // Generate MySQL Create Table and Stored Procedure scripts. var mysqlGenerator = new MySQLTemplate(); mysqlGenerator.GenerateContent(entity, outputPath); } if (radOracle.Checked) { // Generate Oracle Create Table and Stored Procedure scripts. } if (chkCPP.Checked) { // Generate C++ DAL } if (chkCSharp.Checked) { // Generate C# DAL } if (chkJava.Checked) { // Generate Java DAL } if (chkPython.Checked) { // Generate Python DAL } if (chkPHP.Checked) { // Generate PHP DAL var phpGenerator = new PHPTemplate(); phpGenerator.GenerateContent(entity, outputPath); } MessageBox.Show(this, "Success", "Content Generated Successfully", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnGenerate_Click(object sender, EventArgs e) { // First, validate each input InputValidationResult validationResult = ValidateInput(); if (validationResult != InputValidationResult.VALID) { ShowInputErrorDialog(validationResult); } else { // Build DALEntity and DALAttributes DALEntity entity = new DALEntity(txtEntityName.Text, txtDatabaseName.Text, txtSchemaName.Text, txtNamespace.Text); foreach (SQLAttributePicker attributePicker in attributeList) { DALAttributes attribute = new DALAttributes(attributePicker.AttributeName, attributePicker.DataType, attributePicker.AttributeSize, attributePicker.IsPrimaryKey, attributePicker.AutoIncrement, attributePicker.IsForeignKey, attributePicker.ReferenceEntity, attributePicker.ReferenceAttribute); entity.Attributes.Add(attribute); } String outputPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); if (entity.Attributes.Where(x => x.IsPrimaryKey).Count() < 1) { DialogResult result = MessageBox.Show("No primary key has been selected for this entity. Without a primary key several DAL method such as Load and Update cannot function appropriately. For this reason, only a class library will be generated. Would you like to continue?", "Warning", MessageBoxButtons.OKCancel); if (result == DialogResult.Cancel) { return; } } if (radTSQL.Checked) { // Generate TSQL Create Table and Stored Procedure scripts. var tsqlGenerator = new TSQLTemplate(); tsqlGenerator.GenerateContent(entity, outputPath); } if (radMySQL.Checked) { // Generate MySQL Create Table and Stored Procedure scripts. var mysqlGenerator = new MySQLTemplate(); mysqlGenerator.GenerateContent(entity, outputPath); } if (radOracle.Checked) { // Generate Oracle Create Table and Stored Procedure scripts. } if (chkCPP.Checked) { // Generate C++ DAL } if (chkCSharp.Checked) { // Generate C# DAL } if (chkJava.Checked) { // Generate Java DAL } if (chkPython.Checked) { // Generate Python DAL } if (chkPHP.Checked) { // Generate PHP DAL var phpGenerator = new PHPTemplate(); phpGenerator.GenerateContent(entity, outputPath); } MessageBox.Show(this, "Success", "Content Generated Successfully", MessageBoxButtons.OK, MessageBoxIcon.Information); } }