Example #1
0
        private void InitFromDictionary(DictionaryNVR itemdict, SPWeb web)
        {
            if (itemdict == null || web == null) throw new ArgumentNullException();
            Urls = ((string)itemdict["NVR_SiteConfigUrl"] ?? "").Split('\n','|'); // HACK for newline not saving in field problem
            ContentTypes = ((string)itemdict["NVR_SiteConfigContentType"] ?? "").Split('\n');
            ListTypes = ((string)itemdict["NVR_SiteConfigListType"] ?? "").Split('\n');
            Apps = ((string) itemdict["NVR_SiteConfigApp"] ?? "").Split('\n', ',');
            Order = int.Parse((itemdict["NVR_SiteConfigOrder"] ?? "0").ToString());
            JsonConfigBody = (string)itemdict["NVR_SiteConfigJSON"];
            Active = (bool)itemdict["NVR_SiteConfigActive"];
            Approved = (bool)itemdict["NVR_SiteConfigApproved"];

            if (!itemdict.ContainsKey("NVR_SiteConfigActiveFor") || itemdict["NVR_SiteConfigActiveFor"] == null || string.IsNullOrWhiteSpace((string)itemdict["NVR_SiteConfigActiveFor"]))
                ActiveForUsers = null;
            else
                ActiveForUsers = web.GetSPPrincipals((string)itemdict["NVR_SiteConfigActiveFor"]).GetLogins().ToArray();

            _itemId = (Guid)itemdict["_ItemUniqueId"];

            Deserialize();
        }