Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        internal static PRList Create(Guid listGuid, Dictionary <Guid, PRList> listsDictionary)
        {
            if (listGuid.Equals(Guid.Empty))
            {
                return(null);
            }
            PRList _ret = new PRList();

            listsDictionary.Add(listGuid, _ret);
            return(_ret);
        }
Exemplo n.º 3
0
        internal static PRList[] CreateLists
            (SPListCollection listsCollection, Dictionary <Guid, PRList> listsDictionary, Action <ProgressChangedEventArgs> progress, Func <string, bool, bool> selected)
        {
            List <PRList> _lists = new List <PRList>();
            int           _count = 0;

            foreach (SPList _lix in listsCollection)
            {
                progress(new ProgressChangedEventArgs(_count * 100 / listsCollection.Count, _lix.Title));
                _count++;
                _lists.Add(PRList.Create(_lix, listsDictionary, x => { }, selected));
            }
            return(_lists.ToArray <PRList>());
        }
Exemplo n.º 4
0
        //http://msdn.microsoft.com/en-us/library/office/ee535721(v=office.15).aspx
        private static PRColumn CreatePRColumn(SPField sPField, Dictionary <Guid, PRList> listsDictionary, Func <string, SPFieldType, bool> selected)
        {
            SPFieldLookup _spFieldLookup = sPField as SPFieldLookup;
            PRList        _lookupList    = null;

            if (_spFieldLookup != null)
            {
                if (_spFieldLookup.IsDependentLookup)
                {
                    return(null);
                }
                Guid _lookupListid = _spFieldLookup.LookupList.GuidTryParse();
                if (_lookupListid.Equals(Guid.Empty))
                {
                    return(null);
                }
                if (listsDictionary.ContainsKey(_lookupListid))
                {
                    _lookupList = listsDictionary[_lookupListid];
                }
                else
                {
                    _lookupList = PRList.Create(_lookupListid, listsDictionary);
                }
                Debug.Assert(_lookupList != null);
            }
            else
            {
                Debug.Assert(sPField.Type != SPFieldType.Lookup);
            }
            PRColumn _PRColumn = new PRColumn()
            {
                Checked       = selected(sPField.InternalName, sPField.Type),
                Member        = sPField.InternalName.SQLName(),
                Name          = sPField.InternalName,
                Type          = PRType.Enum, //http://msdn.microsoft.com/en-us/library/office/ee536245(v=office.15).aspx
                TypeSpecified = false,
                FieldType     = sPField.Type,
                ListLookup    = _lookupList,
                SQLDataType   = sPField.Type.SQLDataType(),
                SQLNullable   = !sPField.Required,
                SQLPrecision  = -1,
            };

            return(_PRColumn);
        }