コード例 #1
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            try
            {
                //create entity
                CodeGeneratorSettingsInfo folder = ConfigCtrl.GetCodeGeneratorSettings();
                Collection <TableInfo>    tables = Johnny.CodeGenerator.Core.DatabaseCtrl.GetTables(_connectionstring, _server, _database);
                foreach (TableInfo tb in tables)
                {
                    if (tb.TableName == _table)
                    {
                        string entityFolder = Path.Combine(folder.WorkingFolder, "Temp");
                        entityFolder = Path.Combine(entityFolder, folder.Entity);
                        Generator.GenerateEntityXmlFromTable(tb, entityFolder, txtNameSpacePrefix.Text, txtNameSpaceSuffix.Text);
                        break;
                    }
                }



                richtxtCode.Text = Johnny.CodeGenerator.Core.Generator.GenerateSingle(_connectionstring, _database, _server, GetModelName(_table), cmbTemplateGroup.Items[cmbTemplateGroup.SelectedIndex].ToString(), cmbTemplate.Items[cmbTemplate.SelectedIndex].ToString());

                tabSingleGenerator.SelectedIndex = 1;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
        private void GenerateTextXmlClick(object o, EventArgs e)
        {
            TableNode tn = (TableNode)this.SelectedNode;

            if (tn == null)
            {
                return;
            }
            CodeGeneratorSettingsInfo folder = ConfigCtrl.GetCodeGeneratorSettings();

            Generator.GenerateTextXmlFromTable(tn.Table, @"D:\WorkSpace\Projects_GitHub\CodeGenerator\Dev\Src\CodeGenerator\");
        }
コード例 #3
0
        private void GenerateEntityXmlClick(object o, EventArgs e)
        {
            TableNode tn = (TableNode)this.SelectedNode;

            if (tn == null)
            {
                return;
            }
            CodeGeneratorSettingsInfo folder = ConfigCtrl.GetCodeGeneratorSettings();

            Generator.GenerateEntityXmlFromTable(tn.Table, folder.EntityFullPath, "Johnny.CMS", "Access");
        }
コード例 #4
0
        private void tabSingleGenerator_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (tabSingleGenerator.SelectedIndex == 2) //Template
            {
                CodeGeneratorSettingsInfo folder = ConfigCtrl.GetCodeGeneratorSettings();

                if (cmbTemplateGroup.SelectedIndex >= 0 && cmbTemplate.SelectedIndex >= 0)
                {
                    string strFile    = DataConvert.GetString(cmbTemplate.Items[cmbTemplate.SelectedIndex]) + ".xslt";
                    string xsltFolder = Path.Combine(folder.Template, DataConvert.GetString(cmbTemplateGroup.Items[cmbTemplateGroup.SelectedIndex]));
                    //xsltFolder = Path.Combine(xsltFolder, DataConvert.GetString(cmbTemplate.Items[cmbTemplate.SelectedIndex]));
                    string xsltFile = Path.Combine(xsltFolder, strFile);
                    txtTemplatePath.Text = xsltFile;
                    using (StreamReader sr = new StreamReader(xsltFile, Encoding.UTF8))
                    {
                        richtxtTemplate.Text = sr.ReadToEnd();
                        sr.Close();
                    }
                }
            }
            else if (tabSingleGenerator.SelectedIndex == 3)
            {
                CodeGeneratorSettingsInfo folder = ConfigCtrl.GetCodeGeneratorSettings();

                string xmlFile = Path.Combine(folder.EntityFullPath, GetModelName(_table) + ".xml");
                txtEntityPath.Text = xmlFile;
                using (StreamReader sr = new StreamReader(xmlFile, Encoding.UTF8))
                {
                    richtxtEntity.Text = sr.ReadToEnd();
                    sr.Close();
                }
            }
            else if (tabSingleGenerator.SelectedIndex == 4)
            {
                CodeGeneratorSettingsInfo folder = ConfigCtrl.GetCodeGeneratorSettings();

                string xmlFolder = @"D:\WorkSpace\Projects_GitHub\CodeGenerator\Dev\Src\CodeGenerator\";
                string xmlFile   = xmlFolder + @"\" + GetModelName(_table) + ".xml";
                using (StreamReader sr = new StreamReader(xmlFile, Encoding.UTF8))
                {
                    richtxtFieldText.Text = sr.ReadToEnd();
                    sr.Close();
                }
            }
        }
コード例 #5
0
        private void DlgSettingsCG_Load(object sender, EventArgs e)
        {
            try
            {
                //load config info
                CodeGeneratorSettingsInfo cgsettings = ConfigCtrl.GetCodeGeneratorSettings();
                if (cgsettings != null)
                {
                    txtWorkingFolder.Text = cgsettings.WorkingFolder;
                    txtTemplate.Text      = cgsettings.Template;
                    txtVsTemplate.Text    = cgsettings.VsTemplate;
                    txtOutput.Text        = cgsettings.Output;
                    txtEntity.Text        = cgsettings.Entity;
                }

                txtWorkingFolder.Select();
                txtOutput.Text = "Output";
                txtEntity.Text = "Entity";
            }
            catch (Exception ex)
            {
                Program.ShowMessageBox("DlgSettingsCG.DlgSettingsCG_Load", ex);
            }
        }
コード例 #6
0
        private void btnGenXml_Click(object sender, EventArgs e)
        {
            CodeGeneratorSettingsInfo folder = ConfigCtrl.GetCodeGeneratorSettings();

            Generator.GenerateEntityXml(_connectionstring, _table, "dbo", _server, _database, folder.Entity, txtNameSpacePrefix.Text, txtNameSpaceSuffix.Text);
        }