private static PRList Create(SPList list, Dictionary <Guid, PRList> listsDictionary, Action <ProgressChangedEventArgs> progress, Func <string, bool, bool> selected) { PRList _ret; if (listsDictionary.ContainsKey(list.ID)) { _ret = listsDictionary[list.ID]; } else { if (list.ID.Equals(Guid.Empty)) { throw new ArgumentOutOfRangeException("The list Guid should not be empty"); } _ret = new PRList(); listsDictionary.Add(list.ID, _ret); } //Update _ret.ListGuid = list.ID; _ret.Name = list.Title; _ret.Member = list.Title; _ret.ContentType = PRContentType.CreatePRContentTypes(list.ContentTypes, listsDictionary, x => { }, (x, y) => false).ToArray <PRContentType>(); _ret.Checked = !list.ContentTypes.Cast <SPContentType>().Select <SPContentType, bool>(x => selected(x.Group, x.Hidden)).Any <bool>(x => !x); _ret.ContentTypesID = list.ContentTypes.Cast <SPContentType>().Select <SPContentType, SPContentTypeId>(_ctx => _ctx.Id).ToArray <SPContentTypeId>(); _ret.IsProxy = false; return(_ret); }
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); }
internal PRContentType GetSPMetalParameters() { Debug.Assert(Checked); PRContentType _ret = new PRContentType { Class = Class, Column = this.Column.Where <PRColumn>(x => x.Checked).Select <PRColumn, PRColumn>(x => x.GetSPMetalParameters()).ToArray <PRColumn>(), ExcludeOtherColumns = new PRFlagElement(), Name = this.Name }; return(_ret); }
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); }