예제 #1
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);
        }
예제 #2
0
        private void BuildDocumentTypes(DocumentTypeLib typeLib)
        {
            List <DocumentType> docTypes = DocumentType.GetAllAsList();

            foreach (var documentType in docTypes)
            {
                typeLib.DocumentTypes.Add(this.BuildDocumentTypeItem(documentType));
            }
        }
예제 #3
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);
         }
     }
 }
예제 #4
0
        private void BuildDataTypes(DocumentTypeLib typeLib)
        {
            AddValueTypes(typeLib);
            var dataTypes = DataTypeDefinition.GetAll();

            foreach (var dataType in dataTypes)
            {
                typeLib.DataTypes.Add(this.BuildDataTypeItem(dataType));
            }
        }
예제 #5
0
        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);
        }
예제 #6
0
        public DocumentTypeLib Load(string typeLibConfigFile)
        {
            DocumentTypeLib documentTypeLib = null;

            if (File.Exists(typeLibConfigFile))
            {
                string xml = File.ReadAllText(typeLibConfigFile);
                if (!string.IsNullOrEmpty(xml))
                {
                    documentTypeLib = SerializationHelper.Deserialize <DocumentTypeLib>(xml);
                }
            }
            return(documentTypeLib);
        }
예제 #7
0
 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"
     });
 }