Exemplo n.º 1
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.º 2
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);
        }