Beispiel #1
0
    /// <summary>
    /// Get a List of PreValues by Id
    /// </summary>
    /// <param name="id">Id of the PreValue</param>
    /// <returns>List of PreValues</returns>
    public static IEnumerable <PreValue> DataTypeValue(int id)
    {
        DataTypeDefinition dataTypeDefinition = DataTypeDefinition.GetDataTypeDefinition(id);
        SortedList         data = PreValues.GetPreValues(dataTypeDefinition.Id);

        return(data.Values.Cast <PreValue>());
    }
Beispiel #2
0
    /// <summary>
    /// Get a List of PreValues by Id
    /// </summary>
    /// <param name="parameter">UmbracoType</param>
    /// <returns>List of PreValues</returns>
    public static IEnumerable <PreValue> DataTypeValue(UmbracoType parameter)
    {
        int id = Convert.ToInt32(GetParameterValue(parameter));
        DataTypeDefinition dataTypeDefinition = DataTypeDefinition.GetDataTypeDefinition(id);
        SortedList         data = PreValues.GetPreValues(dataTypeDefinition.Id);

        return(data.Values.Cast <PreValue>());
    }
        /// <summary>
        /// Retrieves a list of all datatypedefinitions
        /// </summary>
        /// <returns>A list of all datatypedefinitions</returns>
        public static DataTypeDefinition[] GetAll()
        {
            SortedList retvalSort = new SortedList();

            Guid[] tmp = CMSNode.getAllUniquesFromObjectType(_objectType);
            DataTypeDefinition[] retval = new DataTypeDefinition[tmp.Length];
            for (int i = 0; i < tmp.Length; i++)
            {
                DataTypeDefinition dt = DataTypeDefinition.GetDataTypeDefinition(tmp[i]);
                retvalSort.Add(dt.Text + "|||" + Guid.NewGuid().ToString(), dt);
            }

            IDictionaryEnumerator ide = retvalSort.GetEnumerator();
            int counter = 0;

            while (ide.MoveNext())
            {
                retval[counter] = (DataTypeDefinition)ide.Value;
                counter++;
            }
            return(retval);
        }