private void btnBuilderAll_Click(object sender, EventArgs e)
        {
            this.SetControlState(false);
            this.txtCode.txtContent.Text = string.Empty;
            this.txtCode.SettxtContent("c#", "");//2011-10-21 Modify By Fang
            bool overwrite = this.chkOverwrite.Checked;
            bool twoTier = this.chkTwoTier.Checked;
            for (int i = 0; i < this.lbxTables.Items.Count; i++)
            {
                this.lbxTables.SelectedIndex = i;
                this.txtClassName.Text = this.GetClassName();
                Business.CodeGenerator codeGenerator = new Business.CodeGenerator(this.xmlDocument, this.txtCompany.Text, this.ProjectName, this.txtAuthor.Text, this.txtYearCreated.Text, this.txtDateCreated.Text, this.txtClassName.Text, "Manager", this.GetTableName(), this.GetDescription());
                overwrite = codeGenerator.BuilderTable(this.txtOutput.Text, overwrite, twoTier, sss);
                overwrite = codeGenerator.BuilderEntity(this.txtOutput.Text, overwrite, twoTier);
                //overwrite = codeGenerator.BuilderManager(this.txtOutput.Text, overwrite, this.CurrentDb, twoTier);
                // overwrite = this.BuilderManager(this.txtOutput.Text, overwrite, twoTier);

                // 生成创建页面
                overwrite = this.BuilderCreatePage(this.txtOutput.Text, overwrite);

                // 生成编辑页面
                overwrite = this.BuilderEditPage(this.txtOutput.Text, overwrite);

                //// 生成删除页面
                overwrite = this.BuilderDeletePage(this.txtOutput.Text, overwrite);

                //// 生成列表页面
                overwrite = this.BuilderListPage(this.txtOutput.Text, overwrite);

                //// 生成详细页面
                overwrite = this.BuilderDetailsPage(this.txtOutput.Text, overwrite);
                //// 生成Controller页面
                overwrite = this.BuilderController(this.txtOutput.Text, overwrite);

            }
            this.SetControlState(true);
            // 打开文件夹
            Process.Start(this.txtOutput.Text);
        }
        private void btnBuilder_Click(object sender, EventArgs e)
        {
            this.SetControlState(false);
            this.txtCode.txtContent.Text = string.Empty;
            this.txtCode.SettxtContent("c#", "");
            bool overwrite = this.chkOverwrite.Checked;
            this.txtClassName.Text = this.GetClassName();
            bool twoTier = this.chkTwoTier.Checked;
            Business.CodeGenerator codeGenerator = new Business.CodeGenerator(this.xmlDocument, this.txtCompany.Text, this.ProjectName, this.txtAuthor.Text, this.txtYearCreated.Text, this.txtDateCreated.Text, this.txtClassName.Text, "Manager", this.GetTableName(), this.GetDescription());
            overwrite = codeGenerator.BuilderTable(this.txtOutput.Text, overwrite, twoTier);
            overwrite = codeGenerator.BuilderEntity(this.txtOutput.Text, overwrite, twoTier);
            overwrite = codeGenerator.BuilderManager(this.txtOutput.Text, overwrite, this.CurrentDb, twoTier);
            overwrite = this.BuilderManager(this.txtOutput.Text, overwrite, twoTier);
            if (!this.chkTwoTier.Checked)
            {
                overwrite = this.BuilderIService(this.txtOutput.Text, overwrite);
                overwrite = this.BuilderService(this.txtOutput.Text, overwrite);
            }
            // 生成编辑页面
            //overwrite = this.BuilderEditPage(this.txtOutput.Text, overwrite);
            //overwrite = this.BuilderEditCode(this.txtOutput.Text, overwrite);
            //// 生成显示页面
            //overwrite = this.BuilderShowPage(this.txtOutput.Text, overwrite);
            //overwrite = this.BuilderShowCode(this.txtOutput.Text, overwrite);
            //// 生成列表页面
            //overwrite = this.BuilderListPage(this.txtOutput.Text, overwrite);
            //overwrite = this.BuilderListCode(this.txtOutput.Text, overwrite);
            //// 生成查询页面
            //overwrite = this.BuilderSearchPage(this.txtOutput.Text, overwrite);
            //overwrite = this.BuilderSearchCode(this.txtOutput.Text, overwrite);
            //// 生成管理页面
            //overwrite = this.BuilderAdminPage(this.txtOutput.Text, overwrite);
            //overwrite = this.BuilderAdminCode(this.txtOutput.Text, overwrite);

            this.SetControlState(true);
            // 打开文件夹
            Process.Start(this.txtOutput.Text);
        }
 private string BuilderDeletePage()
 {
     string className = this.txtClassName.Text;
     string file = Application.StartupPath + "\\Templates\\easyui\\Delete.txt";
     string code = GetTemplate(file);
     code = ReplaceAssemblyInfo(code);
     Business.CodeGenerator codeGenerator = new Business.CodeGenerator(this.xmlDocument, this.txtCompany.Text, this.ProjectName, this.txtAuthor.Text, this.txtYearCreated.Text, this.txtDateCreated.Text, className, "", this.GetTableName(), this.GetDescription());
     code = codeGenerator.ReplaceEasy(code);
     return code;
 }
        private void btnTableColumns_Click(object sender, EventArgs e)
        {
            this.SetControlState(false);
            this.txtCode.txtContent.Text = string.Empty;
            this.txtClassName.Text = this.GetClassName();
            this.txtClassName.Text += "TableColumns";
            this.txtFileName.Text = this.txtClassName.Text + ".SQL";

            Business.CodeGenerator codeGenerator = new Business.CodeGenerator(this.xmlDocument, this.txtCompany.Text, this.ProjectName, this.txtAuthor.Text, this.txtYearCreated.Text, this.txtDateCreated.Text, this.GetClassName(), "Table", this.GetTableName(), this.GetDescription());
            //this.txtCode.SettxtContent("c#", codeGenerator);

            this.btnCopyCode.Enabled = true;
            this.btnSaveCode.Enabled = true;
            this.SetControlState();
            this.txtClassName.Focus();
            this.txtClassName.SelectAll();
        }
 private string BuilderManager()
 {
     string file = Application.StartupPath + "\\Business.CodeGenerator\\Templates\\Manager.txt";
     string code = GetTemplate(file);
     Business.CodeGenerator codeGenerator = new Business.CodeGenerator(this.xmlDocument, this.txtCompany.Text, this.ProjectName, this.txtAuthor.Text, this.txtYearCreated.Text, this.txtDateCreated.Text, this.GetClassName(), "Table", this.GetTableName(), this.GetDescription());
     code = code.Replace("#Search#", codeGenerator.GetSearch());
     code = this.ReplaceAssemblyInfo(code);
     return code;
 }