Пример #1
0
        private void ExecuteTemplateAngularModule(TableInfo tableInfo, Context configContext)
        {
            if (tableInfo.CodeCustomImplemented)
            {
                return;
            }

            if (!tableInfo.MakeFront)
            {
                return;
            }

            var pathOutput = PathOutputAngular.PathOutputAngularModule(tableInfo, configContext);

            if (File.Exists(pathOutput))
            {
                return;
            }

            var pathTemplate = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularModule(tableInfo));
            var textTemplate = Read.AllText(tableInfo, pathTemplate, this._defineTemplateFolder);
            var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplate);

            using (var stream = new HelperStream(pathOutput).GetInstance()) { stream.Write(classBuilder); }
        }
Пример #2
0
        private void ExecuteTemplateAngularFilterComponentHtml(TableInfo tableInfo, Context configContext, UniqueListInfo infos)
        {
            if (tableInfo.CodeCustomImplemented)
            {
                return;
            }

            if (!tableInfo.MakeFront)
            {
                return;
            }

            var pathOutput = PathOutputAngular.PathOutputAngularFilterComponentHtml(tableInfo, configContext);

            if (File.Exists(pathOutput))
            {
                return;
            }

            var pathTemplate = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularFilterGeneratedComponentHtml(tableInfo));
            var textTemplate = Read.AllText(tableInfo, pathTemplate, this._defineTemplateFolder);
            var classBuilder = this.MakeFilterClassBuilder(tableInfo, configContext, infos, textTemplate);

            using (var stream = new StreamWriter(pathOutput)) { stream.Write(classBuilder); }
        }
Пример #3
0
        private void ExecuteTemplateAngularRoutingGenerated(TableInfo tableInfo, Context configContext)
        {
            if (tableInfo.CodeCustomImplemented)
            {
                return;
            }

            if (!tableInfo.MakeFront)
            {
                return;
            }

            var pathOutput = PathOutputAngular.PathOutputAngularRoutingGenerated(tableInfo, configContext);

            var pathTemplate = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.RoutingGenerated(tableInfo));
            var textTemplate = Read.AllText(tableInfo, pathTemplate, this._defineTemplateFolder);
            var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplate);

            var itens = string.Empty;

            foreach (var item in configContext.TableInfo)
            {
                var str = @"    { path: '" + item.ClassName.ToLower() + "', loadChildren: './views/" + item.ClassName.ToLower() + "/" + item.ClassName.ToLower() + ".module#" + item.ClassName + "Module' },";
                itens += string.Format("{0}{1}", str, System.Environment.NewLine);
            }

            classBuilder = classBuilder.Replace("<#pathsRoute#>", itens);

            using (var stream = new HelperStream(pathOutput).GetInstance()) { stream.Write(classBuilder); }
        }
Пример #4
0
        private void ExecuteTemplateAngularDeleteGeneratedComponent(TableInfo tableInfo, Context configContext)
        {
            if (tableInfo.CodeCustomImplemented)
            {
                return;
            }

            if (!tableInfo.MakeFront)
            {
                return;
            }

            var pathOutputController = PathOutputAngular.PathOutputAngularDeleteGeneratedComponent(tableInfo, configContext);

            var pathTemplate = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularDeleteGeneratedComponent(tableInfo));
            var textTemplate = Read.AllText(tableInfo, pathTemplate, this._defineTemplateFolder);
            var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplate);

            using (var stream = new StreamWriter(pathOutputController)) { stream.Write(classBuilder); }
        }
Пример #5
0
        private void ExecuteTemplateAngularModelFilterGenerated(TableInfo tableInfo, Context configContext, UniqueListInfo infos)
        {
            if (tableInfo.CodeCustomImplemented)
            {
                return;
            }

            if (!tableInfo.MakeFront)
            {
                return;
            }

            var pathOutput = PathOutputAngular.PathOutputAngularModelFilterGenerated(tableInfo, configContext);

            var pathTemplateModelGenerated = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularModelFilterGenerated(tableInfo));
            var textTemplateModelGenerated = Read.AllText(tableInfo, pathTemplateModelGenerated, this._defineTemplateFolder);
            var classBuilderModelGenerated = GenericTagsTransformer(tableInfo, configContext, textTemplateModelGenerated);

            var classBuilderForm = string.Empty;

            if (infos.IsAny())
            {
                foreach (var item in infos)
                {
                    var itemForm          = string.Empty;
                    var pathTemplateField = string.Empty;
                    var textTemplateField = string.Empty;

                    if (item.Type == "string" || item.Type == "DateTime" || item.Type == "DateTime?" || item.Type == "Guid" || item.Type == "Guid?")
                    {
                        if (item.Type == "DateTime" || item.Type == "DateTime?")
                        {
                            itemForm  = string.Format(@"    public {0}Start: string;{1}", item.PropertyName, System.Environment.NewLine);
                            itemForm += string.Format(@"    public {0}End: string;", item.PropertyName);
                        }
                        else
                        {
                            itemForm = string.Format(@"    public {0}: string;", item.PropertyName);
                        }
                    }

                    else if (item.Type == "bool")
                    {
                        itemForm = string.Format(@"    public {0}: boolean;", item.PropertyName);
                    }

                    else if (item.Type == "bool?")
                    {
                        itemForm = string.Format(@"    public {0}?: boolean;", item.PropertyName);
                    }

                    else if (item.Type == "int" || item.Type == "float" || item.Type == "decimal")
                    {
                        itemForm = string.Format(@"    public {0}: number;", item.PropertyName);
                    }

                    else if (item.Type == "int?" || item.Type == "float?" || item.Type == "decimal?")
                    {
                        itemForm = string.Format(@"    public {0}?: number;", item.PropertyName);
                    }



                    classBuilderForm += string.Format("{0}{1}", itemForm, System.Environment.NewLine);
                }
            }

            classBuilderModelGenerated = classBuilderModelGenerated.Replace("<#formFields#>", classBuilderForm);

            using (var stream = new HelperStream(pathOutput).GetInstance()) { stream.Write(classBuilderModelGenerated); }
        }