示例#1
0
        public static void RemoveCustomSettings <T>(this SPListItem listItem, AIAPortalFeatures featureName)
        {
            string strKey = Utility.BuildKey <T>(featureName);

            listItem.Properties.Remove(strKey);
            listItem.SystemUpdate();
        }
 public SPDiagnosticsCategory this[AIAPortalFeatures id]
 {
     get
     {
         return Areas[DiagnosticsAreaName].Categories[(uint)id];
     }
 }
示例#3
0
        public static T GetCustomSettings <T>(this SPListItem listItem, AIAPortalFeatures featureName, bool lookupInParent)
        {
            string strKey      = Utility.BuildKey <T>(featureName);
            string settingsXml = listItem.GetCustomProperty(strKey);

            //CCIUtility.LogError(settingsXml, CCIappFeatureNames.CCIappEEC);
            if (!string.IsNullOrEmpty(settingsXml))
            {
                return((T)SerializationHelper.DeserializeFromXml <T>(settingsXml));
            }

            if (!lookupInParent)
            {
                return(default(T));
            }

            T objReturn = default(T);

            if (listItem.ContentType != null)
            {
                objReturn = listItem.ContentType.GetCustomSettings <T>(featureName);
            }

            return(objReturn);
        }
示例#4
0
        public static void SetCustomSettings <T>(this SPList list, AIAPortalFeatures featureName, T settingsObject)
        {
            string strKey      = Utility.BuildKey <T>(featureName);
            string settingsXml = SerializationHelper.SerializeToXml <T>(settingsObject);

            list.SetCustomProperty(strKey, settingsXml);
        }
示例#5
0
        public static T GetCustomSettings <T>(this SPContentType contentType, AIAPortalFeatures featureName, bool lookupInParent)
        {
            string strKey      = Utility.BuildKey <T>(featureName);
            string settingsXml = contentType.XmlDocuments[strKey];

            if (!string.IsNullOrEmpty(settingsXml))
            {
                return((T)SerializationHelper.DeserializeFromXml <T>(settingsXml, strKey));
            }

            if (!lookupInParent)
            {
                return(default(T));
            }

            T objReturn = default(T);

            if (contentType.Parent.Sealed == false)
            {
                objReturn = contentType.Parent.GetCustomSettings <T>(featureName);
            }

            if (objReturn == null && contentType.ParentList != null)
            {
                objReturn = contentType.ParentList.GetCustomSettings <T>(featureName);
            }

            if (objReturn == null && contentType.ParentWeb != null)
            {
                objReturn = contentType.ParentWeb.GetCustomSettings <T>(featureName);
            }

            return(objReturn);
        }
示例#6
0
 public SPDiagnosticsCategory this[AIAPortalFeatures id]
 {
     get
     {
         return(Areas[DiagnosticsAreaName].Categories[(uint)id]);
     }
 }
示例#7
0
        public static void SetCustomSettings <T>(this SPListItem listItem, AIAPortalFeatures featureName, T settingsObject)
        {
            string strKey      = Utility.BuildKey <T>(featureName);
            string settingsXml = SerializationHelper.SerializeToXml <T>(settingsObject);

            //CCIUtility.LogError(settingsXml, CCIappFeatureNames.CCIappEEC);
            listItem.SetCustomProperty(strKey, settingsXml);
        }
示例#8
0
        public static void RemoveCustomSettings <T>(this SPWeb web, AIAPortalFeatures featureName)
        {
            string strKey = Utility.BuildKey <T>(featureName);

            //web.Properties.Remove(strKey);
            web.Properties[strKey] = null;
            web.Update();
            web.Properties.Update();
        }
示例#9
0
        public static void RemoveCustomSettings <T>(this SPList list, AIAPortalFeatures featureName)
        {
            string strKey = Utility.BuildKey <T>(featureName);

            SPFolder rootFolder = list.RootFolder;

            rootFolder.Properties.Remove(strKey);
            rootFolder.Update();
        }
示例#10
0
        protected override IEnumerable <SPDiagnosticsArea> ProvideAreas()
        {
            List <SPDiagnosticsCategory> categories = new List <SPDiagnosticsCategory>();

            foreach (string catName in Enum.GetNames(typeof(AIAPortalFeatures)))
            {
                AIAPortalFeatures entry = ( AIAPortalFeatures)Enum.Parse(typeof(AIAPortalFeatures), catName);
                uint   catId            = (uint)(int)Enum.Parse(typeof(AIAPortalFeatures), catName);
                string friendlyname     = GetDescription(entry);
                categories.Add(new SPDiagnosticsCategory(friendlyname, TraceSeverity.Verbose, EventSeverity.Error, 0, catId));
            }
            yield return(new SPDiagnosticsArea(DiagnosticsAreaName, categories));
        }
示例#11
0
 public static void LogInfo(string errorMessage, AIAPortalFeatures category)
 {
     try
     {
         DiagnosticsService myULS = DiagnosticsService.Local;
         if (myULS != null)
         {
             SPDiagnosticsCategory cat = myULS[category];
             string format             = errorMessage;
             //myULS.WriteTrace(1, cat, TraceSeverity.Medium, format, myULS.TypeName);
             myULS.Information(cat, errorMessage);
         }
     }
     catch {}
 }
示例#12
0
        public static void LogInfo(string errorMessage, string category)
        {
            //Log(errorMessage, TraceProvider.TraceSeverity.InformationEvent, category);
            AIAPortalFeatures e = AIAPortalFeatures.Infrastructure;

            try
            {
                e = (AIAPortalFeatures)Enum.Parse(typeof(AIAPortalFeatures), category);
            }
            catch {};
            LogInfo(errorMessage, e);


            //SPTraceLogger logger = new SPTraceLogger();
            //logger.Write(0, SPTraceLogger.TraceSeverity.InformationEvent, "AIA.Intranet TraceProvider", "AIA.Intranet", category, errorMessage);
        }
示例#13
0
        public static T GetCustomSettings <T>(this SPList list, AIAPortalFeatures featureName, bool lookupInParent)
        {
            string strKey      = Utility.BuildKey <T>(featureName);
            string settingsXml = list.GetCustomProperty(strKey);

            if (!string.IsNullOrEmpty(settingsXml))
            {
                return((T)SerializationHelper.DeserializeFromXml <T>(settingsXml));
            }

            if (lookupInParent && string.IsNullOrEmpty(settingsXml) && list.ParentWeb != null)
            {
                return(list.ParentWeb.GetCustomSettings <T>(featureName));
            }

            return(default(T));
        }
示例#14
0
        public static void LogError(string errorMessage, AIAPortalFeatures category)
        {
            try
            {
                DiagnosticsService myULS = DiagnosticsService.Local;
                if (myULS != null)
                {
                    //SPDiagnosticsCategory cat = myULS[CategoryId.DocuSignService];
                    SPDiagnosticsCategory cat = myULS[category];

                    string format = errorMessage;
                    myULS.WriteTrace(1, cat, TraceSeverity.Unexpected, format, myULS.TypeName);
                }
            }
            catch (Exception)
            {
            }

            //Log(errorMessage, TraceProvider.TraceSeverity.CriticalEvent, category);
            //SPTraceLogger logger = new SPTraceLogger();
            //logger.Write(0, SPTraceLogger.TraceSeverity.Exception,"AIA.Intranet TraceProvider", "AIA.Intranet", category, errorMessage);
        }
示例#15
0
        public static void SetCustomSettings <T>(this SPContentType contentType, AIAPortalFeatures featureName, T settingsObject, bool applyToChilds)
        {
            string strKey      = Utility.BuildKey <T>(featureName);
            string settingsXml = SerializationHelper.SerializeToXml <T>(settingsObject, strKey);
            SPXmlDocumentCollection xmlDocCollection = contentType.XmlDocuments;

            if (!string.IsNullOrEmpty(xmlDocCollection[strKey]))
            {
                xmlDocCollection.Delete(strKey);
            }

            XmlDocument customXmlDocSettings = new XmlDocument();

            customXmlDocSettings.LoadXml(settingsXml);
            xmlDocCollection.Add(customXmlDocSettings);

            //try
            //{
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                contentType.ParentWeb.AllowUnsafeUpdates = true;
                contentType.XmlDocuments.Delete("http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url");
                if (contentType.ParentList == null)
                {
                    contentType.Update(applyToChilds, false);
                }
                else
                {
                    contentType.Update();
                }
                contentType.ParentWeb.AllowUnsafeUpdates = false;
            });
            //}
            //catch
            //{
            //    CCIUtility.LogInfo("Do not throw message if using option apply to child but current content type doen't have any child", "AIA.Intranet.Common");
            //}
        }
示例#16
0
 public static T GetCustomSettings <T>(this SPList list, AIAPortalFeatures featureName)
 {
     return(list.GetCustomSettings <T>(featureName, true));
 }
示例#17
0
 public static T GetCustomSettings <T>(this SPWeb web, AIAPortalFeatures featureName)
 {
     return(web.GetCustomSettings <T>(featureName, true));
 }
示例#18
0
 public static void RemoveCustomSettings <T>(this SPContentType ctype, AIAPortalFeatures featureName, bool applyToChilds)
 {
     ctype.SetCustomSettings <T>(featureName, default(T), applyToChilds);
 }
示例#19
0
 public static void RemoveCustomSettings <T>(this SPContentType ctype, AIAPortalFeatures featureName)
 {
     ctype.SetCustomSettings <T>(featureName, default(T));
 }
示例#20
0
 public static void SetCustomSettings <T>(this SPContentType contentType, AIAPortalFeatures featureName, T settingsObject)
 {
     contentType.SetCustomSettings <T>(featureName, settingsObject, false);
 }
示例#21
0
 public static T GetCustomSettings <T>(this SPContentType contentType, AIAPortalFeatures featureName)
 {
     return(contentType.GetCustomSettings <T>(featureName, true));
 }
示例#22
0
 public static string BuildKey <T>(AIAPortalFeatures featureName)
 {
     return(featureName.ToString() + typeof(T).ToString());
 }