コード例 #1
0
        public static string ConvertActivityLogTypeProviderToXml(IActivityLogTypeProvider activityLogTypeProvider)
        {
            var xmlString = new StringBuilder();

            xmlString.AppendFormat("<{0}>", "activitylogTypes");

            foreach (var logType in activityLogTypeProvider.GetActivityLogTypes())
            {
                xmlString.AppendFormat("<{0}>", "activitylogType");
                xmlString.AppendFormat("<{0}>{1}</{0}>", "name", logType.Name);
                xmlString.AppendFormat("<{0}>{1}</{0}>", "systemKeyword", logType.SystemKeyword);
                xmlString.AppendFormat("<{0}>{1}</{0}>", "enabled", logType.Enabled);
                xmlString.AppendFormat("</{0}>", "activitylogType");
            }

            xmlString.AppendFormat("</{0}>", "activitylogTypes");

            return xmlString.ToString();
        }
コード例 #2
0
        public static string ConvertActivityLogTypeProviderToXml(IActivityLogTypeProvider activityLogTypeProvider)
        {
            var xmlString = new StringBuilder();

            xmlString.AppendFormat("<{0}>", "activitylogTypes");

            foreach (var logType in activityLogTypeProvider.GetActivityLogTypes())
            {
                xmlString.AppendFormat("<{0}>", "activitylogType");
                xmlString.AppendFormat("<{0}>{1}</{0}>", "name", logType.Name);
                xmlString.AppendFormat("<{0}>{1}</{0}>", "systemKeyword", logType.SystemKeyword);
                xmlString.AppendFormat("<{0}>{1}</{0}>", "enabled", logType.Enabled);
                xmlString.AppendFormat("</{0}>", "activitylogType");
            }

            xmlString.AppendFormat("</{0}>", "activitylogTypes");

            return(xmlString.ToString());
        }
コード例 #3
0
        /// <summary>
        /// Install all activity types specified by the activity log type provider
        /// </summary>
        /// <param name="activityLogTypeProvider">The activity log type provider.</param>
        /// <param name="reInstall">Should the provider be reinstalled (add new types or update existing)</param>
        /// <remarks></remarks>
        public void InstallActivityLogTypes(IActivityLogTypeProvider activityLogTypeProvider, bool reInstall = false)
        {
            var providerName = activityLogTypeProvider.GetType().Name;

            if (reInstall)
            {
                _installedActivityLogProviderCollection.Remove(Query <ActivityLogTypeProviderInstalled> .EQ(x => x.Name, providerName));
            }

            if (_installedActivityLogProviderCollection.Count(Query <ActivityLogTypeProviderInstalled> .EQ(x => x.Name, providerName)) > 0)
            {
                return;
            }

            _installedActivityLogProviderCollection.Insert(new ActivityLogTypeProviderInstalled {
                Name = providerName
            });

            foreach (var activityLogType in activityLogTypeProvider.GetActivityLogTypes())
            {
                var existing = _activityLogTypeCollection.FindOne(Query.And(Query <ActivityLogType> .EQ(x => x.SystemKeyword, activityLogType.SystemKeyword)));

                if (existing == null)
                {
                    existing = new ActivityLogType();
                }

                existing.SystemKeyword = activityLogType.SystemKeyword;
                existing.Name          = activityLogType.Name;
                existing.Enabled       = activityLogType.Enabled;

                if (existing.Id == ObjectId.Empty)
                {
                    _activityLogTypeCollection.Insert(existing);
                }
                else
                {
                    _activityLogTypeCollection.Update(Query <ActivityLogType> .EQ(x => x.Id, existing.Id), Update <ActivityLogType> .Replace(existing));
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// Uninstall the activity types specified by the activity log type provider
 /// </summary>
 /// <param name="activityLogTypeProvider">The activity log type provider.</param>
 /// <remarks></remarks>
 public void UninstallActivityLogTypes(IActivityLogTypeProvider activityLogTypeProvider)
 {
     throw new NotImplementedException("TODO");
 }
コード例 #5
0
        /// <summary>
        /// Install all activity types specified by the activity log type provider
        /// </summary>
        /// <param name="activityLogTypeProvider">The activity log type provider.</param>
        /// <param name="reInstall">Should the provider be reinstalled (add new types or update existing)</param>
        /// <remarks></remarks>
        public void InstallActivityLogTypes(IActivityLogTypeProvider activityLogTypeProvider, bool reInstall = false)
        {
            var providerName = activityLogTypeProvider.GetType().Name;

            if (reInstall)
                _installedActivityLogProviderCollection.Remove(Query<ActivityLogTypeProviderInstalled>.EQ(x => x.Name, providerName));

            if(_installedActivityLogProviderCollection.Count(Query<ActivityLogTypeProviderInstalled>.EQ(x => x.Name, providerName)) > 0)
                return;

            _installedActivityLogProviderCollection.Insert(new ActivityLogTypeProviderInstalled { Name = providerName });

            foreach (var activityLogType in activityLogTypeProvider.GetActivityLogTypes())
            {
                var existing = _activityLogTypeCollection.FindOne(Query.And(Query<ActivityLogType>.EQ(x => x.SystemKeyword, activityLogType.SystemKeyword)));

                if(existing == null)
                    existing = new ActivityLogType();

                existing.SystemKeyword = activityLogType.SystemKeyword;
                existing.Name = activityLogType.Name;
                existing.Enabled = activityLogType.Enabled;

                if(existing.Id == ObjectId.Empty)
                    _activityLogTypeCollection.Insert(existing);
                else
                    _activityLogTypeCollection.Update(Query<ActivityLogType>.EQ(x => x.Id, existing.Id), Update<ActivityLogType>.Replace(existing));
            }
        }
コード例 #6
0
 /// <summary>
 /// Uninstall the activity types specified by the activity log type provider
 /// </summary>
 /// <param name="activityLogTypeProvider">The activity log type provider.</param>
 /// <remarks></remarks>
 public void UninstallActivityLogTypes(IActivityLogTypeProvider activityLogTypeProvider)
 {
     throw new NotImplementedException("TODO");
 }