Exemple #1
0
        CreatePRContentTypes(SPContentTypeCollection spContentTypes, Dictionary <Guid, PRList> listsDictionary, Action <ProgressChangedEventArgs> progress, Func <string, bool, bool> selected)
        {
            List <PRContentType> _prContentTypeList = new List <PRContentType>();
            int _ix = 0;

            foreach (SPContentType _spctx in spContentTypes)
            {
                progress(new ProgressChangedEventArgs(_ix * 100 / spContentTypes.Count, _spctx.Name));
                _ix++;
                _prContentTypeList.Add(PRContentType.CreatePRContentType(_spctx, listsDictionary, selected));
            }
            return(_prContentTypeList);
        }
Exemple #2
0
        private static PRContentType CreatePRContentType(SPContentType contentType, Dictionary <Guid, PRList> listsDictionary, Func <string, bool, bool> selected)
        {
            List <PRColumn> _columns         = PRColumn.CreatePRColumns(contentType.Fields.Cast <SPField>(), (name, type) => type.IsSPFieldTypeSupported(), listsDictionary);
            PRContentType   _baseContentType = null;

            if (contentType.Id != SPBuiltInContentTypeId.System)
            {
                _baseContentType = PRContentType.CreatePRContentType(contentType.Parent, listsDictionary, (x, y) => false);
            }
            PRContentType _ret = new PRContentType()
            {
                Class                = contentType.Name,
                Checked              = selected(contentType.Group, contentType.Hidden),
                Column               = _columns.ToArray <PRColumn>(),
                SPContentTypeId      = contentType.Id,
                ExcludeColumn        = null,
                ExcludeOtherColumns  = null,
                IncludeHiddenColumns = null,
                Name            = contentType.Name,
                BaseContentType = _baseContentType
            };

            return(_ret);
        }