Beispiel #1
0
        public HelperSysObjectsAngular(Context context)
        {
            var _contexts = new List <Context> {
                context
            };

            this.Contexts = _contexts;
            PathOutput.UsePathProjects = true;
            this._defineTemplateFolder = new DefineTemplateFolder();
            this._defineTemplateFolder.SetTemplatePathBase("Templates\\Front");
        }
Beispiel #2
0
        public static string AllText(TableInfo tableInfo, string path, DefineTemplateFolder defineTemplateFolder)
        {
            var pathNew = path;

            if (!File.Exists(path))
            {
                var folderSpecial = defineTemplateFolder.Define(tableInfo);
                var folderDefault = defineTemplateFolder.GetDefaultTemplateFolder();
                if (folderSpecial != folderDefault)
                {
                    pathNew = path.Replace(folderSpecial, folderDefault);
                }
            }

            if (!File.Exists(pathNew))
            {
                return(string.Empty);
            }

            return(File.ReadAllText(pathNew));
        }
Beispiel #3
0
        public static string MakeAuditFields(TableInfo tableInfo, Info item, string textTemplateAudit, DefineTemplateFolder defineTemplateFolder)
        {
            var pathTemplateAudit = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, defineTemplateFolder.Define(tableInfo), "models.audit");

            if (string.IsNullOrEmpty(textTemplateAudit))
            {
                textTemplateAudit = Read.AllText(tableInfo, pathTemplateAudit, defineTemplateFolder);
            }

            textTemplateAudit = textTemplateAudit.Replace("<#className#>", tableInfo.ClassName);

            if (item.PropertyName == "UserCreateId" || item.PropertyName == "UserAlterId")
            {
                var cast = String.Format("({0})userId", TypeConvertCSharp.Convert(item.TypeOriginal, item.IsNullable));

                if (item.PropertyName == "UserCreateId")
                {
                    textTemplateAudit = textTemplateAudit.Replace("<#propertCastInsert#>", cast);
                }

                if (item.PropertyName == "UserAlterId")
                {
                    textTemplateAudit = textTemplateAudit.Replace("<#propertCastUpdate#>", cast);
                }
            }
            return(textTemplateAudit);
        }
Beispiel #4
0
        public static string MakeAuditRow(TableInfo tableInfo, bool generateAudit, Info item, string textTemplateAudit, DefineTemplateFolder defineTemplateFolder)
        {
            if (generateAudit)
            {
                return(MakeAuditFields(tableInfo, item, textTemplateAudit, defineTemplateFolder));
            }

            return(string.Empty);
        }
Beispiel #5
0
 public HelperSysObjectsInherit(IEnumerable <Context> contexts) : base(contexts)
 {
     this.Contexts = contexts;
     PathOutput.UsePathProjects = true;
     this._defineTemplateFolder = new DefineTemplateFolder();
 }