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); } }
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); } }
private string MakeFilterClassBuilder(TableInfo tableInfo, Context configContext, UniqueListInfo infos, string textTemplate) { var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplate); var classBuilderForm = string.Empty; if (infos.IsAny()) { foreach (var item in infos) { if (Audit.IsAuditField(item.PropertyName)) { continue; } if (item.IsKey == 1 && !IsPropertyNavigationTypeInstance(tableInfo, item.PropertyName)) { continue; } var itemForm = string.Empty; var pathTemplateField = string.Empty; var textTemplateField = string.Empty; var fieldInBlackListFilter = FieldInBlackListFilter(tableInfo, item.PropertyName); if (fieldInBlackListFilter) { continue; } if (item.Type == "string") { pathTemplateField = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularFieldInput(tableInfo)); textTemplateField = Read.AllText(tableInfo, pathTemplateField, this._defineTemplateFolder); } else if (item.Type == "DateTime" || item.Type == "DateTime?") { pathTemplateField = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularFieldDate(tableInfo)); textTemplateField = Read.AllText(tableInfo, pathTemplateField, this._defineTemplateFolder); itemForm.Replace("<#propertyName#>", string.Format("{0}{1}{2}", item.PropertyName + "Start", System.Environment.NewLine, "<#propertyName#>")); itemForm.Replace("<#propertyName#>", string.Format("{0}", item.PropertyName + "End")); } else if (item.Type == "bool" || item.Type == "bool?") { pathTemplateField = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularFieldRadio(tableInfo)); textTemplateField = Read.AllText(tableInfo, pathTemplateField, this._defineTemplateFolder); } else { if (IsPropertyNavigationTypeInstance(tableInfo, item.PropertyName)) { pathTemplateField = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularFieldSelect(tableInfo)); textTemplateField = Read.AllText(tableInfo, pathTemplateField, this._defineTemplateFolder); } else { pathTemplateField = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularFieldInput(tableInfo)); textTemplateField = Read.AllText(tableInfo, pathTemplateField, this._defineTemplateFolder); } } itemForm = FormFieldReplace(configContext, tableInfo, item, textTemplateField); itemForm = itemForm .Replace("<#formType#>", "filter") .Replace("<#propertyName#>", item.PropertyName) .Replace("<#className#>", tableInfo.ClassName) .Replace("<#isRequired#>", "") .Replace("<#ReletedClass#>", PropertyNavigationTypeInstance(tableInfo, item.PropertyName)); classBuilderForm += string.Format("{0}{1}", itemForm, System.Environment.NewLine); } } classBuilder = classBuilder.Replace("<#formFields#>", classBuilderForm); return(classBuilder); }
private void ExecuteTemplateAngularFilterGeneratedComponentHtml(TableInfo tableInfo, Context configContext, UniqueListInfo infos) { if (tableInfo.CodeCustomImplemented) { return; } if (!tableInfo.MakeFront) { return; } var pathOutput = PathOutputAngular.PathOutputAngularFilterGeneratedComponentHtml(tableInfo, configContext); 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 HelperStream(pathOutput).GetInstance()) { stream.Write(classBuilder); } }
private string MakeGridClassBuilder(TableInfo tableInfo, Context configContext, UniqueListInfo infos, string textTemplate) { var classBuilder = GenericTagsTransformer(tableInfo, configContext, textTemplate); var classBuilderThead = string.Empty; var classBuilderTbody = string.Empty; if (infos.IsAny()) { foreach (var item in infos) { if (Audit.IsAuditField(item.PropertyName)) { continue; } var itemForm = string.Empty; var textTemplateThead = string.Empty; var textTemplateTbody = string.Empty; var fieldInBlackListCreate = FieldInBlackListSave(tableInfo, item.PropertyName); if (fieldInBlackListCreate) { continue; } if (item.IsKey == 1 && !IsPropertyNavigationTypeInstance(tableInfo, item.PropertyName)) { var pathTemplateThead = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularTheadId(tableInfo)); textTemplateThead = Read.AllText(tableInfo, pathTemplateThead, this._defineTemplateFolder); var pathTemplateTbody = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularTbodyString(tableInfo)); textTemplateTbody = Read.AllText(tableInfo, pathTemplateTbody, this._defineTemplateFolder); } else if (item.Type == "string") { var pathTemplateThead = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularTheadFields(tableInfo)); textTemplateThead = Read.AllText(tableInfo, pathTemplateThead, this._defineTemplateFolder); var pathTemplateTbody = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularTbodyString(tableInfo)); textTemplateTbody = Read.AllText(tableInfo, pathTemplateTbody, this._defineTemplateFolder); } else if (item.Type == "DateTime" || item.Type == "DateTime?") { var pathTemplateThead = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularTheadFields(tableInfo)); textTemplateThead = Read.AllText(tableInfo, pathTemplateThead, this._defineTemplateFolder); var pathTemplateTbody = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularTbodyDate(tableInfo)); textTemplateTbody = Read.AllText(tableInfo, pathTemplateTbody, this._defineTemplateFolder); } else if (item.Type == "bool" || item.Type == "bool?") { var pathTemplateThead = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularTheadFields(tableInfo)); textTemplateThead = Read.AllText(tableInfo, pathTemplateThead, this._defineTemplateFolder); var pathTemplateTbody = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularTbodyBoolean(tableInfo)); textTemplateTbody = Read.AllText(tableInfo, pathTemplateTbody, this._defineTemplateFolder); } else if (item.Type == "decimal" || item.Type == "decimal?" || item.Type == "float" || item.Type == "float?") { var pathTemplateThead = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularTheadFields(tableInfo)); textTemplateThead = Read.AllText(tableInfo, pathTemplateThead, this._defineTemplateFolder); var pathTemplateTbody = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularTbodyNumber(tableInfo)); textTemplateTbody = Read.AllText(tableInfo, pathTemplateTbody, this._defineTemplateFolder); } else { if (!IsPropertyNavigationTypeInstance(tableInfo, item.PropertyName)) { var pathTemplateThead = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularTheadId(tableInfo)); textTemplateThead = Read.AllText(tableInfo, pathTemplateThead, this._defineTemplateFolder); var pathTemplateTbody = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._defineTemplateFolder.Define(tableInfo), DefineTemplateNameAngular.AngularTbodyString(tableInfo)); textTemplateTbody = Read.AllText(tableInfo, pathTemplateTbody, this._defineTemplateFolder); } else { continue; } } textTemplateThead = textTemplateThead .Replace("<#propertyName#>", item.PropertyName) .Replace("<#className#>", tableInfo.ClassName) .Replace("<#isRequired#>", item.IsNullable == 0 ? "required" : "") .Replace("<#ReletedClass#>", PropertyNavigationTypeInstance(tableInfo, item.PropertyName)); textTemplateTbody = textTemplateTbody .Replace("<#propertyName#>", item.PropertyName) .Replace("<#className#>", tableInfo.ClassName) .Replace("<#isRequired#>", item.IsNullable == 0 ? "required" : "") .Replace("<#ReletedClass#>", PropertyNavigationTypeInstance(tableInfo, item.PropertyName)); classBuilderThead += string.Format("{0}{1}", textTemplateThead, System.Environment.NewLine); classBuilderTbody += string.Format("{0}{1}", textTemplateTbody, System.Environment.NewLine); } } classBuilder = classBuilder .Replace("<#theadFields#>", classBuilderThead) .Replace("<#tbodyFields#>", classBuilderTbody); return(classBuilder); }
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); } }
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); } }