Пример #1
0
        private void btnGenBLLDataDict_Click(object sender, EventArgs e)
        {
            if (false == Msg.AskQuestion("确认要生成吗?"))
            {
                return;
            }

            //创建参数对象
            Params4DataDictBLL param = new Params4DataDictBLL();

            param.BLL_Name       = txtBLL.Text;
            param.BLL_Namespace  = txtBllNamespace.Text;
            param.ConcretelyName = txtConcretelyName.Text;
            param.DAL_Name       = txtDAL.Text;
            param.ORM_Name       = txtORM.Text;
            param.UsingNamespace = txtUsingNamespace.Lines;

            //生成源码
            string code = new GenerateBLL().GenerateDataDictBLL(param);

            //显示代码
            if (chkPreviewBLL.Checked)
            {
                this.ShowCode(code);
            }

            //输出.cs文件
            if (chkExportToFileBLL.Checked)
            {
                string fileName = txtOutpup_BLL_DataDict.Text + txtBLL.Text + ".cs";
                File.WriteAllText(fileName, code, Encoding.UTF8);
                MessageBox.Show("输出文件:" + fileName);
            }
        }
Пример #2
0
        private void btnGenBLLBusiness_Click(object sender, EventArgs e)
        {
            if (false == Msg.AskQuestion("确认要生成吗?"))
            {
                return;
            }

            //创建参数对象
            Params4BusinessBLL param = new Params4BusinessBLL();

            param.BLL_Name           = txtBLL.Text;
            param.BLL_Namespace      = txtBllNamespace.Text;
            param.ConcretelyName     = txtConcretelyName.Text;
            param.DAL_Name           = txtDAL.Text;
            param.ORM_Name           = txtORM.Text;
            param.UsingNamespace     = txtUsingNamespace.Lines;
            param.BusinessFormName   = txtFormName.Text;
            param.SupportBusinessLog = chkBusinessLog.Checked;

            //生成源码
            string code = new GenerateBLL().GenerateBusinessBLL(param);

            //显示代码
            if (chkPreviewBLL.Checked)
            {
                this.ShowCode(code);
            }

            //输出.cs文件
            if (chkExportToFileBLL.Checked)
            {
                string fileName = txtOutpup_BLL_Business.Text + txtBLL.Text + ".cs";
                if (!Directory.Exists(txtOutpup_BLL_Business.Text))
                {
                    Directory.CreateDirectory(txtOutpup_BLL_Business.Text);
                }
                File.WriteAllText(fileName, code, Encoding.UTF8);
                MessageBox.Show("输出文件:" + fileName);
            }
        }