Example #1
0
        private void lblCodeMaker_Click(object sender, EventArgs e)
        {
            string longservername = FormCommon.GetDbViewSelServer();

            if (longservername == "")
            {
                MessageBox.Show("没有可用的数据库连接,请先连接数据库服务器。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            mainfrm.AddSinglePage(new CodeMaker(), "代码生成");
        }
Example #2
0
        private void lblCodeExport_Click(object sender, EventArgs e)
        {
            string longservername = FormCommon.GetDbViewSelServer();

            if (longservername == "")
            {
                MessageBox.Show("没有可用的数据库连接,请先连接数据库服务器。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            CodeExport ce = new CodeExport(longservername);

            ce.ShowDialog(this);
        }
Example #3
0
        private void lblWord_Click(object sender, EventArgs e)
        {
            string longservername = FormCommon.GetDbViewSelServer();

            if (longservername == "")
            {
                MessageBox.Show("没有可用的数据库连接,请先连接数据库服务器。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            DbToWord dbtoword = new DbToWord(longservername);

            dbtoword.Show();
        }
Example #4
0
        private void btn_ok_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count < 1)
            {
                return;
            }
            string selstr  = this.listView1.SelectedItems[0].Text;
            string daltype = "S3";

            switch (selstr)
            {
            case "单类结构":
            {
                daltype = "One";
                MessageBox.Show("该功能暂不支持,可以选择其他功能继续使用。");
            }
            break;

            case "简单三层结构":
            {
                folder1 = Application.StartupPath + "\\Template\\CodematicDemoS3";
                daltype = "S3";
            }
            break;

            case "简单三层结构(管理)":
            {
                folder1 = Application.StartupPath + "\\Template\\CodematicDemoS3p";
                daltype = "S3p";
            }
            break;

            case "工厂模式结构":
            {
                folder1 = Application.StartupPath + "\\Template\\CodematicDemoF3";
                daltype = "F3";
            }
            break;

            default:
                break;
            }

            #region  制目录
            folder2 = txtProPath.Text.Trim();
            ProName = txtProName.Text.Trim();
            cfgfile.IniWriteValue("Project", "lastpath", folder2);
            if (ProName != "")
            {
                folder2 += "\\" + ProName;
            }
            else
            {
                MessageBox.Show("请输入项目名称!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (txtProPath.Text.Trim() == "")
            {
                MessageBox.Show("请选择输出目录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            string longservername = FormCommon.GetDbViewSelServer();
            if (longservername == "")
            {
                MessageBox.Show("你尚未选择要生成代码的数据库信息!\r\n请先建立数据库连接。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            #region 目录检查
            //try
            //{
            //    DirectoryInfo source = new DirectoryInfo(folder1);
            //    DirectoryInfo target = new DirectoryInfo(folder2);
            //    if (!source.Exists)
            //    {
            //        MessageBox.Show("源目录已经不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //        return;
            //    }
            //    if (!target.Exists)
            //    {
            //        try
            //        {
            //            target.Create();
            //        }
            //        catch
            //        {
            //            MessageBox.Show("目标目录不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //            return;
            //        }
            //    }
            //}
            //catch
            //{
            //    MessageBox.Show("目录信息有误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    return;
            //}
            #endregion

            //mythread = new Thread(new ThreadStart(ThreadWork));
            //mythread.Start();

            NewProjectDB npb = new NewProjectDB(longservername, this, folder2, daltype, ProName);
            npb.Show();

            #endregion

            Close();
        }