Beispiel #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            button2.Enabled = false;

            if (string.IsNullOrEmpty(textBox1DbPath.Text))
            {
                MessageBox.Show("请填写数据库地址!", "Error");
                return;
            }
            if (comboBox2.SelectedItem == null)
            {
                MessageBox.Show("请选择数据库!", "Error");
                return;
            }


            string val = comboBox1.SelectedItem.ToString().ToLower();

            if (val.ToLower() == "oledb")
            {
                core = new AccessModeCreate(textBox1DbPath.Text);
            }
            else if (val == "mysql")
            {
                button1.Visible = false;
                core            = new MySqlModeCreate(textBox1DbPath.Text);
            }
            else if (val == "sqlserver")
            {
                button1.Visible = false;
                core            = new SqlServerModeCreate(textBox1DbPath.Text);
            }
            labelResult.Text = "正在生成文件...";
            string np = textBox1NameSpace.Text;

            if (string.IsNullOrEmpty(np))
            {
                np = "Hjn.Model";
            }
            //    core.CreateAll(textBox1NameSpace.Text, comboBox2.SelectedItem == null ? string.Empty : comboBox2.SelectedItem.ToString());
            core.CreateAll(np,
                           comboBox2.SelectedItem == null ? string.Empty : comboBox2.SelectedItem.ToString(),
                           "", saveFolder);
            richTextBox1.Text += "[" + DateTime.Now.ToString() + "] create succcess!\r\n";

            if (checkBox1.Checked)
            {
                string path = AppDomain.CurrentDomain.BaseDirectory + "CreatedFiles";
                System.Diagnostics.Process.Start("explorer.exe", saveFolder);
            }
            labelResult.Text = "数据生成完成!";

            button2.Enabled = true;
        }
Beispiel #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            button2.Enabled = false;

            if (string.IsNullOrEmpty(textBox1DbPath.Text))
            {
                MessageBox.Show("请填写数据库地址!", "Error");
                return;
            }
            if (comboBox2.SelectedItem == null)
            {
                MessageBox.Show("请选择数据库!", "Error");
                return;
            }


            string val = comboBox1.SelectedItem.ToString().ToLower();
            if (val.ToLower() == "oledb")
            {
                core = new AccessModeCreate(textBox1DbPath.Text);
            }
            else if (val == "mysql")
            {
                button1.Visible = false;
                core = new MySqlModeCreate(textBox1DbPath.Text);
            }
            else if (val == "sqlserver")
            {
                button1.Visible = false;
                core = new SqlServerModeCreate(textBox1DbPath.Text);
            }
            labelResult.Text = "正在生成文件...";
            string np = textBox1NameSpace.Text;
            if (string.IsNullOrEmpty(np)) np = "Hjn.Model";
            //    core.CreateAll(textBox1NameSpace.Text, comboBox2.SelectedItem == null ? string.Empty : comboBox2.SelectedItem.ToString());
            core.CreateAll(np,
                comboBox2.SelectedItem == null ? string.Empty : comboBox2.SelectedItem.ToString(),
                "", saveFolder);
            richTextBox1.Text += "[" + DateTime.Now.ToString() + "] create succcess!\r\n";

            if (checkBox1.Checked)
            {
                string path = AppDomain.CurrentDomain.BaseDirectory + "CreatedFiles";
                System.Diagnostics.Process.Start("explorer.exe", saveFolder);
            }
            labelResult.Text = "数据生成完成!";

            button2.Enabled = true;
        }