private void AddValueTypes(DocumentTypeLib typeLib)
 {
     typeLib.DataTypes.Add(new DataTypeItem() { Id = -2, ControlTypeName = "umbraco.editorControls.textfield.TextFieldDataType", ModelType = "string", Type = "string" });
     typeLib.DataTypes.Add(new DataTypeItem() { Id = -3, ControlTypeName = "umbraco.editorControls.textfield.TextFieldDataType", ModelType = "int", Type = "string" });
     typeLib.DataTypes.Add(new DataTypeItem() { Id = -4, ControlTypeName = "umbraco.editorControls.textfield.TextFieldDataType", ModelType = "bool", Type = "string" });
     typeLib.DataTypes.Add(new DataTypeItem() { Id = -5, ControlTypeName = "umbraco.editorControls.textfield.TextFieldDataType", ModelType = "double", Type = "string" });
     typeLib.DataTypes.Add(new DataTypeItem() { Id = -6, ControlTypeName = "umbraco.editorControls.textfield.TextFieldDataType", ModelType = "DateTime", Type = "string" });
 }
 private void BuildDataTypes(DocumentTypeLib typeLib)
 {
     AddValueTypes(typeLib);
     var dataTypes = DataTypeDefinition.GetAll();
     foreach (var dataType in dataTypes)
     {
         typeLib.DataTypes.Add(this.BuildDataTypeItem(dataType));
     }
 }
        public void Build()
        {
            var typeLib = new DocumentTypeLib();

            BuildDataTypes(typeLib);
            BuildDocumentTypes(typeLib);

            string xml = SerializationHelper.Serialize(typeLib);
            string path = Path.Combine(umbraco.GlobalSettings.FullpathToRoot, "App_Data", "typelib.config");
            File.WriteAllText(path, xml);
        }
 private void BuildDocumentTypes(DocumentTypeLib typeLib)
 {
     List<DocumentType> docTypes = DocumentType.GetAllAsList();
     foreach (var documentType in docTypes)
     {
         typeLib.DocumentTypes.Add(this.BuildDocumentTypeItem(documentType));
     }
 }
Esempio n. 5
0
 private void SetPropertyTypeDataType(DocumentTypeLib typeLib)
 {
     foreach (var docType in typeLib.DocumentTypes)
     {
         foreach (var propType in docType.Properties)
         {
             propType.DataType = typeLib.DataTypes.FirstOrDefault(dt => dt.Id == propType.TypeId);
         }
     }
 }
Esempio n. 6
0
        private List<DataGridTypeItem> BuildDataGridTypeItemList(DocumentTypeLib typeLib)
        {
            var dataGridTypeItems = new List<DataGridTypeItem>();
            foreach (var docType in TypeLib.DocumentTypes)
            {
                string className = this.ClassName(docType.Alias);

                foreach (var propType in docType.Properties)
                {
                    if (IncludeProperty(propType, className))
                    {
                        if (propType.DataType.Type.Equals("DataGrid"))
                        {
                            if (dataGridTypeItems.Any(dg => dg.TypeId == propType.TypeId) == false)
                            {
                                var dataGridTypeItem = CreateDataGridTypeItem(propType, className);
                                if (dataGridTypeItem != null)
                                    dataGridTypeItems.Add(dataGridTypeItem);
                            }
                        }
                    }
                }
            }
            return dataGridTypeItems;
        }