Example #1
0
        private void menuItemBrowserModel_Click(object sender, EventArgs e)
        {
            PdmModelViewer viewer = null;

            foreach (IDockContent content in DockPanel.Documents)
            {
                if (content is PdmModelViewer)
                {
                    viewer = content as PdmModelViewer;
                }
            }

            if (viewer == null)
            {
                viewer = new PdmModelViewer();
            }

            TreeNode node = tv.SelectedNode;

            if (node.Tag.GetType().Name == typeof(PDModel).Name)
            {
                PDModel m = node.Tag as PDModel;
                viewer.LoadModel(m);
            }
            if (node.Tag.GetType().Name == typeof(PDPackage).Name)
            {
                PDPackage p = node.Tag as PDPackage;
                viewer.LoadPackage(p);
            }

            viewer.Show(this.DockPanel);
        }
Example #2
0
        private void menuItemBuildPdf_Click(object sender, EventArgs e)
        {
            IList <PDTable> tableList = new List <PDTable>();
            string          title     = string.Empty;
            TreeNode        node      = tv.SelectedNode;

            if (node.Tag is PDModel)
            {
                PDModel m = node.Tag as PDModel;
                tableList = m.AllTableList;
                title     = m.Name;
            }
            if (node.Tag is PDPackage)
            {
                PDPackage p = node.Tag as PDPackage;
                tableList = p.TableList;
                title     = p.Name;
            }

            saveFileDialog1.FileName = title;
            saveFileDialog1.Filter   = "pdf文件(*.pdf)|*.pdf|所有文件(*.*)|*.*";

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string fileName = saveFileDialog1.FileName;

                iTextExporter exporter = new iTextExporter(fileName);
                exporter.PDModel2Pdf(tableList, title);

                if (MsgBox.ShowQuestionMessage("数据库文档生成成功,是否打开文档", "提示信息") == DialogResult.Yes)
                {
                    CmdHelper.Execute(fileName);
                }
            }
        }
Example #3
0
        public void LoadPackage(PDPackage p)
        {
            this.Text = p.Name;

            dgvTable.AutoGenerateColumns = false;
            dgvView.AutoGenerateColumns  = false;
            dgvSP.AutoGenerateColumns    = false;

            dgvTable.DataSource = p.TableList;
            dgvView.DataSource  = p.ViewList;
            dgvSP.DataSource    = p.ProcedureList;

            tpTable.Text = string.Format("表[{0}]", dgvTable.Rows.Count);
            tpView.Text  = string.Format("视图[{0}]", dgvView.Rows.Count);
            tpSP.Text    = string.Format("存储过程[{0}]", dgvSP.Rows.Count);
        }
Example #4
0
        ////使用实体层模板批量生成代码
        //private void menuItemBatchBuildEnityCode_Click(object sender, EventArgs e)
        //{
        //    SODatabase db = null;
        //    TreeNode node = tv.SelectedNode;

        //    if (node.Tag is PDModel)
        //    {
        //        PDModel m = node.Tag as PDModel;
        //        db = SOConverter.ToSODatabase(m);
        //    }
        //    else
        //    {
        //        PDPackage p = node.Tag as PDPackage;
        //        db = SOConverter.ToSODatabase(p);
        //    }

        //    BatchBuildEntityCode dialog = new BatchBuildEntityCode(db);
        //    dialog.ShowDialog();
        //}

        ////使用数据层模板批量生成代码
        //private void menuItemBatchBuildDALCode_Click(object sender, EventArgs e)
        //{
        //    SODatabase db = null;
        //    TreeNode node = tv.SelectedNode;

        //    if (node.Tag is PDModel)
        //    {
        //        PDModel m = node.Tag as PDModel;
        //        db = SOConverter.ToSODatabase(m);
        //    }
        //    else
        //    {
        //        PDPackage p = node.Tag as PDPackage;
        //        db = SOConverter.ToSODatabase(p);
        //    }

        //    BatchBuildDALCode dialog = new BatchBuildDALCode(db);
        //    dialog.ShowDialog();
        //}

        //批量生成代码

        private void menuItemBatchBuildCode_Click(object sender, EventArgs e)
        {
            SODatabase db   = null;
            TreeNode   node = tv.SelectedNode;

            if (node.Tag is PDModel)
            {
                PDModel m = node.Tag as PDModel;
                db = SOConverter.ToSODatabase(m);
            }
            else
            {
                PDPackage p = node.Tag as PDPackage;
                db = SOConverter.ToSODatabase(p);
            }

            BatchBuildCode dialog = new BatchBuildCode(db);

            dialog.Show(this.DockPanel);
        }