Exemplo n.º 1
0
        //建表脚本-Tables
        public static string CreateTablesScript(string projectID)
        {
            Information.Clear();
            StringBuilder sb = new StringBuilder();

            try
            {
                CodeBuilderService service = ServiceHelper.GetCodeBuilderService();
                ProjectEntity      project = service.GetProjectById(projectID);
                TableEntity[]      tables  = service.GetTableList(projectID);
                for (int i = 0; i < tables.Length; i++)
                {
                    if (i == 0)
                    {
                        sb.Append(CreateTableScript(project, tables[i], true));
                    }
                    else
                    {
                        sb.Append(CreateTableScript(project, tables[i], false));
                    }
                    sb.AppendLine("");
                }
            }
            catch (Exception ex) {
                Information.AddFmt("创建表脚本出错,错误信息:{0}", ex.Message);
            }
            return(sb.ToString());
        }
Exemplo n.º 2
0
 public void BindTablesNode(TreeNode tablesNode, string projectid)
 {
     tablesNode.Nodes.Clear();
     TableEntity[] tables = service.GetTableList(projectid);
     tablesNode.Text = "Tables(" + tables.Length + ")";
     foreach (TableEntity table in tables)
     {
         tablesNode.Nodes.Add(GetTableNode(table));
     }
 }
Exemplo n.º 3
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            string path = this.selectPath.Text;

            if (string.IsNullOrEmpty(path))
            {
                MsgBox.Alert("请选择导出地址"); return;
            }
            //if (this.cboType.Text.ToLower()=="word")
            //{
            //    MsgBox.Alert("暂不支持word文档导出");
            //    return;
            //}
            bool               checkRequired = this.checkRequired.Checked;
            ProjectEntity      project       = Global.GetCurrentProject();
            List <TableEntity> tables        = service.GetTableList(Global.GetCurrentProjectID()).ToList();

            if (tables.Count <= 1)
            {
                MsgBox.Alert("当前项目没有表"); return;
            }
            DbDocumentManager doc = new DbDocumentManager()
            {
                AllowRequired = checkRequired,
                Project       = project,
                Tables        = tables,
                ExportPath    = path,
                Type          = StringHelper.ToEnum <DbDocumentType>(this.cboType.Text)
            };

            this.progress.Value   = 0;
            this.progress.Maximum = tables.Count;
            doc.OnProgress       += new Options.Common.ProgressHandler(doc_OnProgress);
            doc.Export();
            if (MsgBox.Confirm("导出完毕,是否打开文件?"))
            {
                FileHelper.OpenFile(doc.FileName);
            }
        }