コード例 #1
0
        private void AzClassDesign_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;

            azCdgnClassProperty1.SetSelectedObject();



            azProjectInformation = AzCreateItem.GetProjectInformation();
            if (azProjectInformation != null)
            {
                toolStripMenuItem0102.Visible = azProjectInformation.HasDalInterface;
                toolStripMenuItem0201.Visible = azProjectInformation.HasDalLayer;
                toolStripMenuItem02.Visible   = azProjectInformation.HasDalInterface || azProjectInformation.HasDalLayer;

                toolStripMenuItem0301.Visible = azProjectInformation.HasBll;
                toolStripMenuItem0303.Visible = azProjectInformation.HasBllList;
                toolStripMenuItem03.Visible   = azProjectInformation.HasBll || azProjectInformation.HasBllList;


                toolStripMenuItem0401.Visible = azProjectInformation.HasWebUIDto;
                toolStripMenuItem0402.Visible = azProjectInformation.HasWebListUIDto;
                toolStripMenuItem0403.Visible = azProjectInformation.HasWebListUIHandle;
                toolStripMenuItem04.Visible   = azProjectInformation.HasWebUIDto || azProjectInformation.HasWebListUIDto || azProjectInformation.HasWebListUIHandle;
            }



            azCdgnDBSchema1.GetContextMenu().Items.Insert(0, mspCreateCode);
        }
コード例 #2
0
        private void MenuItemSet()
        {
            var cp = azCdgnClassProperty1.GetClassCreatProperty();

            mspCreateCode.Enabled = cp != null;
            if (cp == null)
            {
                return;
            }
            AzCreateItem azCreateItem = AzCreateItem.GetAzCreateItem(cp);

            toolStripMenuItem0102.Enabled = azCreateItem.AzthinkerDal_Interface;
            toolStripMenuItem0201.Enabled = azCreateItem.AzthinkerDal_SQL;
            toolStripMenuItem0301.Enabled = azCreateItem.AzthinkerBll_Class;
            toolStripMenuItem0303.Enabled = azCreateItem.AzthinkerBll_ListClass;
            toolStripMenuItem0401.Enabled = azCreateItem.AzthinkerClass_WebUIDto;
            toolStripMenuItem0402.Enabled = azCreateItem.AzthinkerClass_WebListUIDto;
            toolStripMenuItem0403.Enabled = azCreateItem.AzthinkerClass_WebHandle;
            toolStripMenuItem0501.Enabled = azCreateItem.AzthinkerControllers;
            toolStripMenuItem0601.Enabled = azCreateItem.AzthinkerView_Create;
            toolStripMenuItem0602.Enabled = azCreateItem.AzthinkerView_Delete;
            toolStripMenuItem0604.Enabled = azCreateItem.AzthinkerView_Details;
            toolStripMenuItem0603.Enabled = azCreateItem.AzthinkerView_Edit;
            toolStripMenuItem0605.Enabled = azCreateItem.AzthinkerView_Index;
            toolStripMenuItem0606.Enabled = azCreateItem.AzthinkerView_IndexPage;
            toolStripMenuItem0607.Enabled = azCreateItem.AzthinkerView_IndexPageDetails;
        }
コード例 #3
0
        private void AzCreateCodeSelect_Load(object sender, EventArgs e)
        {
            var azprojectinfo = AzCreateItem.GetProjectInformation();

            foreach (TreeNode nitem in treeView1.Nodes)
            {
                if (nitem != null)
                {
                    if (nitem.Nodes.Count > 0)
                    {
                        foreach (TreeNode cnitem in nitem.Nodes)
                        {
                            if (cnitem != null)
                            {
                                switch (cnitem.Name)
                                {
                                case "AzthinkerDal_Interface":
                                    if (!azprojectinfo.HasDalInterface)
                                    {
                                        cnitem.Remove();
                                    }

                                    break;

                                case "AzthinkerDal_SQL":
                                    if (!azprojectinfo.HasDalLayer)
                                    {
                                        cnitem.Remove();
                                    }

                                    break;

                                case "AzthinkerBll_Class":
                                    if (!azprojectinfo.HasBll)
                                    {
                                        cnitem.Remove();
                                    }

                                    break;

                                case "AzthinkerBll_ListClass":
                                    if (!azprojectinfo.HasBllList)
                                    {
                                        cnitem.Remove();
                                    }

                                    break;

                                case "AzthinkerClass_WebUIDto":
                                    if (!azprojectinfo.HasWebUIDto)
                                    {
                                        cnitem.Remove();
                                    }

                                    break;

                                case "AzthinkerClass_WebListUIDto":
                                    if (!azprojectinfo.HasWebListUIDto)
                                    {
                                        cnitem.Remove();
                                    }

                                    break;

                                case "AzthinkerClass_WebHandle":
                                    if (!azprojectinfo.HasWebListUIHandle)
                                    {
                                        cnitem.Remove();
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            foreach (TreeNode nitem in treeView1.Nodes)
            {
                if (nitem != null)
                {
                    switch (nitem.Name)
                    {
                    case "DalLayer":
                        if (!azprojectinfo.HasDalInterface || !azprojectinfo.HasDalLayer)
                        {
                            nitem.Remove();
                        }

                        break;

                    case "BLLLayer":
                        if (!azprojectinfo.HasBll || !azprojectinfo.HasBllList)
                        {
                            nitem.Remove();
                        }

                        break;

                    case "UIServerLayer":
                        if (!azprojectinfo.HasWebUIDto || !azprojectinfo.HasWebListUIDto || !azprojectinfo.HasWebListUIHandle)
                        {
                            nitem.Remove();
                        }

                        break;
                    }
                }
            }
            treeView1.ExpandAll();
        }
コード例 #4
0
        private string CreateCodeHandle(string opCreate, AzMetaTableEntity item, AzClassCreatProperty itemproperty, IEnumerable <AzMetaCloumEntity> itemDetails)
        {
            if (!AzCreateItem.GetAzCreateItemEnable(opCreate, itemproperty))
            {
                return(string.Empty);
            }

            CodeHandle.HasSummary = azCdgnMasterDisplay1.GetHasSummary();

            string path     = string.Empty;
            string floder   = string.Empty;
            string filename = string.Empty;
            string codestr  = string.Empty;
            string ext      = ".cs";


            switch (opCreate)
            {
            case "AzthinkerDal_Interface":
                path     = $"{NormalSet.AzBase.AzProjectSpace}.Dal.{NormalSet.AzBase.AzProjectName}";
                floder   = item.ClassName;
                filename = $"I{item.ClassName}Dal";
                codestr  = CodeHandle.AzInterfaceDal(item, itemproperty);
                break;

            case "AzthinkerDal_SQL":
                path     = $"{NormalSet.AzBase.AzProjectSpace}.Dal.{NormalSet.AzBase.AzProjectName}";
                floder   = item.ClassName;
                filename = $"{item.ClassName}Dal";
                codestr  = CodeHandle.AzDalConcrete(item, itemproperty, itemDetails);
                break;

            case "AzthinkerBll_Class":
                path     = $"{NormalSet.AzBase.AzProjectSpace}.BLL.{NormalSet.AzBase.AzProjectName}";
                floder   = item.ClassName;
                filename = $"{item.ClassName}Entity";
                codestr  = CodeHandle.AzBll_Class(item, itemproperty, itemDetails);
                break;

            case "AzthinkerBll_ListClass":
                path     = $"{NormalSet.AzBase.AzProjectSpace}.BLL.{NormalSet.AzBase.AzProjectName}";
                floder   = item.ClassName;
                filename = $"{item.ClassName}ListEntity";
                codestr  = CodeHandle.AzBll_ListClass(item, itemproperty, itemDetails);
                break;

            case "AzthinkerClass_WebUIDto":
                path     = $"{NormalSet.AzBase.AzProjectSpace}.UIServer.{NormalSet.AzBase.AzProjectName}";
                floder   = item.ClassName;
                filename = $"{item.ClassName}WebDto";
                codestr  = CodeHandle.AzWebUI_Dto(item, itemproperty, itemDetails);
                break;

            case "AzthinkerClass_WebListUIDto":
                path     = $"{NormalSet.AzBase.AzProjectSpace}.UIServer.{NormalSet.AzBase.AzProjectName}";
                floder   = item.ClassName;
                filename = $"{item.ClassName}ListWebDto";
                codestr  = CodeHandle.AzWebUiList_Dto(item, itemproperty, itemDetails);
                break;

            case "AzthinkerClass_WebHandle":
                path     = $"{NormalSet.AzBase.AzProjectSpace}.UIServer.{NormalSet.AzBase.AzProjectName}";
                floder   = item.ClassName;
                filename = $"{item.ClassName}WebHandle";
                codestr  = CodeHandle.AzWebUiHandle(item, itemproperty, itemDetails);
                break;

            case "AzthinkerControllers":
                path     = $"{NormalSet.AzBase.AzProjectSpace}.WebUI";
                floder   = "Controllers";
                filename = $"{item.ClassName}Controller";
                codestr  = CodeHandle.AzMVC_Controllers(item, itemproperty, itemDetails);
                break;

            case "AzthinkerView_Create":
                path     = $"{NormalSet.AzBase.AzProjectSpace}.WebUI\\View";
                floder   = item.ClassName;
                filename = "Create";
                ext      = ".cshtml";
                codestr  = CodeHandle.AzMvc_View_Create(item, itemproperty, itemDetails);
                break;

            case "AzthinkerView_Delete":
                path     = $"{NormalSet.AzBase.AzProjectSpace}.WebUI\\View";
                floder   = item.ClassName;
                filename = "Delete";
                ext      = ".cshtml";
                codestr  = CodeHandle.AzMvc_View_Delete(item, itemproperty, itemDetails);
                break;

            case "AzthinkerView_Details":
                path     = $"{NormalSet.AzBase.AzProjectSpace}.WebUI\\View";
                floder   = item.ClassName;
                filename = "Details";
                ext      = ".cshtml";
                codestr  = CodeHandle.AzMvc_View_Details(item, itemproperty, itemDetails);
                break;

            case "AzthinkerView_Edit":
                path     = $"{NormalSet.AzBase.AzProjectSpace}.WebUI\\View";
                floder   = item.ClassName;
                filename = "Edit";
                ext      = ".cshtml";
                codestr  = CodeHandle.AzMvc_View_Edit(item, itemproperty, itemDetails);
                break;

            case "AzthinkerView_Index":
                path     = $"{NormalSet.AzBase.AzProjectSpace}.WebUI\\View";
                floder   = item.ClassName;
                filename = "Index";
                ext      = ".cshtml";
                codestr  = CodeHandle.AzMvc_View_GetList(item, itemproperty, itemDetails);
                break;

            case "AzthinkerView_IndexPage":
                path     = $"{NormalSet.AzBase.AzProjectSpace}.WebUI\\View";
                floder   = item.ClassName;
                filename = "Index";
                ext      = ".cshtml";
                codestr  = CodeHandle.AzMvc_View_GetListPage(item, itemproperty, itemDetails);
                break;

            case "AzthinkerView_IndexPageDetails":
                path     = $"{NormalSet.AzBase.AzProjectSpace}.WebUI\\View";
                floder   = item.ClassName;
                filename = "DetailsPage";
                ext      = ".cshtml";
                codestr  = CodeHandle.AzMvc_View_GetListPageDetails(item, itemproperty, itemDetails);
                break;
            }
            if (string.IsNullOrWhiteSpace(path))
            {
                return("");
            }
            if (string.IsNullOrWhiteSpace(codestr))
            {
                return($"{item.ClassName}({item.ClassDisPlay}),无可生成代码");
            }
            FileHelper.SaveCodeToFile(path, floder, filename, codestr, ext);

            return(codestr);
        }