Beispiel #1
0
        public string GenerateFrontendTemplate(List <string> Template, ModuleModel ModuleModel)
        {
            var Generation = new Generation(Template);

            Generation.Dictionary.Add("[MODULE]", ModuleModel.Name);
            Generation.Dictionary.Add("[MODULES]", ModuleModel.PluralName);
            foreach (var PropertyModel in ModuleModel.PropertyModels)
            {
                if (PropertyModel.IsVirtual)
                {
                    if (PropertyModel.Type.Contains("ICollection"))
                    {
                        var Type = PropertyModel.Type.Split('<')[1].Split('>')[0];
                        Generation.Arraypropertities.Add(LanguageProcessService.ToSingle(PropertyModel.Name), Type);
                    }
                    else
                    {
                        try
                        {
                            Generation.Objectpropertities.Add(PropertyModel.Type, PropertyModel.Type);
                        }
                        catch (Exception e)
                        {
                        }
                    }
                }
                else
                {
                    string Type;
                    switch (PropertyModel.Type)
                    {
                    case "long":
                    case "int":
                    case "double":
                    case "float":
                        Type = "number";
                        break;

                    case "bool":
                    case "bool?":
                        Type = "boolean";
                        break;

                    case "DateTime":
                    case "DateTime?":
                        Type = "Date";
                        break;

                    default:
                        Type = "string";
                        break;
                    }
                    Generation.Primitivepropertities.Add(PropertyModel.Name, Type);
                }
            }
            return(Generation.Analysis());
        }
Beispiel #2
0
        public string GenerateBackendTemplate(List <string> Template, ModuleModel ModuleModel, string NameSpace,
                                              string Entity, string Prefix)
        {
            var Generation = new Generation(Template);

            Generation.Dictionary.Add("[MODULE]", ModuleModel.Name);
            Generation.Dictionary.Add("[MODULES]", ModuleModel.PluralName);
            Generation.Dictionary.Add("[NAMESPACE]", NameSpace);
            Generation.Dictionary.Add("[ENTITY]", Entity);
            Generation.Dictionary.Add("[MODULEPREFIX]", Prefix);
            foreach (var PropertyModel in ModuleModel.PropertyModels)
            {
                if (PropertyModel.IsVirtual)
                {
                    if (PropertyModel.Type.Contains("ICollection"))
                    {
                        var Type = PropertyModel.Type.Split('<')[1].Split('>')[0];
                        Generation.Arraypropertities.Add(LanguageProcessService.ToSingle(PropertyModel.Name), Type);
                    }
                    else
                    {
                        try
                        {
                            Generation.Objectpropertities.Add(PropertyModel.Type, PropertyModel.Type);
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
                else
                {
                    Generation.Primitivepropertities.Add(PropertyModel.Name, PropertyModel.Type);
                }
            }
            return(Generation.Analysis());
        }