Exemplo n.º 1
0
        public static void GenerateCode(List <HotchnerTable> tableList)
        {
            foreach (var table in tableList)
            {
                var folderName = AngularFolderDictionary[table.PascalMethodName];
                var folder     = Frontend_Code.FrontendOutputPath + folderName;
                if (Program.IsOutputToProject)
                {
                    folder = DataManageModulesPath + folderName;
                }
                CommonMethod.CreateDirectoryIfNotExist(folder);
                CommonMethod.ClearFolderIfExistFiles(folder);

                var componentName = table.AngularComponentName;
                var tsContent     = GenerateTsContent(table);
                var htmlContent   = GenerateHtmlContent(table);
                var scssContent   = GenerateScssContent(table);

                var tsFilePath   = folder + componentName + ".component.ts";
                var htmlFilePath = folder + componentName + ".component.html";
                var scssFilePath = folder + componentName + ".component.scss";

                File.WriteAllText(tsFilePath, tsContent, new UTF8Encoding(false));
                File.WriteAllText(htmlFilePath, htmlContent, new UTF8Encoding(false));
                File.WriteAllText(scssFilePath, scssContent, new UTF8Encoding(false));
            }
        }
Exemplo n.º 2
0
        public static void GenerateTemplate(List <HotchnerTable> tableList)
        {
            CommonMethod.ClearFolderIfExistFiles(DesktopOutputPath);
            CommonMethod.ClearFolderIfExistFiles(PostmanOutputPath);

            foreach (var table in tableList)
            {
                var templateContent = GenerateTemplateContent(table);
                SaveTemplateToCsv(templateContent, table);
            }
        }
Exemplo n.º 3
0
        public static void PreProcessFolder(string folderPrefix,
                                            out string entityFolderPath,
                                            out string daoFolderPath,
                                            out string mapperFolderPath,
                                            out string controllerFolderPath,
                                            out string serviceImplFolderPath,
                                            out string serviceInterfaceFolderPath)
        {
            entityFolderPath           = BackendOutputPath + EntityPath + folderPrefix;
            daoFolderPath              = BackendOutputPath + DaoPath + folderPrefix;
            mapperFolderPath           = BackendOutputPath + MapperPath + folderPrefix;
            controllerFolderPath       = BackendOutputPath + ControllerPath + folderPrefix;
            serviceImplFolderPath      = BackendOutputPath + ServiceImplPath + folderPrefix;
            serviceInterfaceFolderPath = BackendOutputPath + ServiceInterfacePath + folderPrefix;

            if (Program.IsOutputToProject)
            {
                entityFolderPath           = @"C:\0_Workspace\icts\src\main\java\com\infinite\icts\" + EntityPath + folderPrefix;
                daoFolderPath              = @"C:\0_Workspace\icts\src\main\java\com\infinite\icts\" + DaoPath + folderPrefix;
                mapperFolderPath           = @"C:\0_Workspace\icts\src\main\resources\" + MapperPath + folderPrefix;
                controllerFolderPath       = @"C:\0_Workspace\icts\src\main\java\com\infinite\icts\" + ControllerPath + folderPrefix;
                serviceImplFolderPath      = @"C:\0_Workspace\icts\src\main\java\com\infinite\icts\" + ServiceImplPath + folderPrefix;
                serviceInterfaceFolderPath = @"C:\0_Workspace\icts\src\main\java\com\infinite\icts\" + ServiceInterfacePath + folderPrefix;
            }

            CommonMethod.CreateDirectoryIfNotExist(entityFolderPath);
            CommonMethod.CreateDirectoryIfNotExist(daoFolderPath);
            CommonMethod.CreateDirectoryIfNotExist(mapperFolderPath);
            CommonMethod.CreateDirectoryIfNotExist(controllerFolderPath);
            CommonMethod.CreateDirectoryIfNotExist(serviceImplFolderPath);
            CommonMethod.CreateDirectoryIfNotExist(serviceInterfaceFolderPath);

            if (!string.IsNullOrEmpty(folderPrefix))
            {
                CommonMethod.ClearFolderIfExistFiles(entityFolderPath);
                CommonMethod.ClearFolderIfExistFiles(daoFolderPath);
                CommonMethod.ClearFolderIfExistFiles(mapperFolderPath);
                CommonMethod.ClearFolderIfExistFiles(controllerFolderPath);
                CommonMethod.ClearFolderIfExistFiles(serviceImplFolderPath);
                CommonMethod.ClearFolderIfExistFiles(serviceInterfaceFolderPath);
            }
        }
Exemplo n.º 4
0
 private static void PreproccessFolder()
 {
     CommonMethod.CreateDirectoryIfNotExist(OutputPath);
     CommonMethod.ClearFolderIfExistFiles(OutputPath);
 }