本文整理汇总了C#中DotNetNuke.Services.Log.EventLog.EventLogController类的典型用法代码示例。如果您正苦于以下问题:C# EventLogController类的具体用法?C# EventLogController怎么用?C# EventLogController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventLogController类属于DotNetNuke.Services.Log.EventLog命名空间,在下文中一共展示了EventLogController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddModuleInternal
private void AddModuleInternal(ModuleInfo module)
{
var eventLogController = new EventLogController();
// add module
if (Null.IsNull(module.ModuleID))
{
CreateContentItem(module);
//Add Module
module.ModuleID = dataProvider.AddModule(module.ContentItemId,
module.PortalID,
module.ModuleDefID,
module.AllTabs,
module.StartDate,
module.EndDate,
module.InheritViewPermissions,
module.IsDeleted,
UserController.GetCurrentUserInfo().UserID);
//Now we have the ModuleID - update the contentItem
var contentController = Util.GetContentController();
contentController.UpdateContentItem(module);
eventLogController.AddLog(module, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.MODULE_CREATED);
// set module permissions
ModulePermissionController.SaveModulePermissions(module);
}
//Save ModuleSettings
UpdateModuleSettings(module);
}
示例2: OnEmptyBinClick
/// <summary>
/// Permanently removes all deleted tabs and modules
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <remarks>
/// Parent tabs will not be deleted. To delete a parent tab all child tabs need to be deleted before.
/// </remarks>
/// <history>
/// [VMasanas] 18/08/2004 Created
/// </history>
protected void OnEmptyBinClick(Object sender, EventArgs e)
{
var objEventLog = new EventLogController();
foreach (ListItem item in lstModules.Items)
{
var objModules = new ModuleController();
var values = item.Value.Split('-');
var tabId = int.Parse(values[0]);
var moduleId = int.Parse(values[1]);
//delete module
var objModule = objModules.GetModule(moduleId, tabId, false);
if (objModule != null)
{
//hard-delete Tab Module Instance
objModules.DeleteTabModule(tabId, moduleId, false);
objEventLog.AddLog(objModule, PortalSettings, UserId, "", EventLogController.EventLogType.MODULE_DELETED);
}
}
foreach (ListItem item in lstTabs.Items)
{
var intTabId = int.Parse(item.Value);
var objTabs = new TabController();
var objTab = objTabs.GetTab(intTabId, PortalId, false);
if (objTab != null)
{
DeleteTab(objTab, true);
}
}
BindData();
}
示例3: AddMessage
private void AddMessage(RoleInfo roleInfo, EventLogController.EventLogType logType)
{
var eventLogController = new EventLogController();
eventLogController.AddLog(roleInfo,
PortalController.GetCurrentPortalSettings(),
UserController.GetCurrentUserInfo().UserID,
"",
logType);
}
示例4: AddAuthentication
/// -----------------------------------------------------------------------------
/// <summary>
/// AddAuthentication adds a new Authentication System to the Data Store.
/// </summary>
/// <param name="authSystem">The new Authentication System to add</param>
/// <history>
/// [cnurse] 07/10/2007 Created
/// </history>
/// -----------------------------------------------------------------------------
public static int AddAuthentication(AuthenticationInfo authSystem)
{
var objEventLog = new EventLogController();
objEventLog.AddLog(authSystem, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.AUTHENTICATION_CREATED);
return provider.AddAuthentication(authSystem.PackageID,
authSystem.AuthenticationType,
authSystem.IsEnabled,
authSystem.SettingsControlSrc,
authSystem.LoginControlSrc,
authSystem.LogoffControlSrc,
UserController.GetCurrentUserInfo().UserID);
}
示例5: DeleteLanguagePack
public static void DeleteLanguagePack(LanguagePackInfo languagePack)
{
if (languagePack.PackageType == LanguagePackType.Core)
{
Locale language = LocaleController.Instance.GetLocale(languagePack.LanguageID);
if (language != null)
{
Localization.DeleteLanguage(language);
}
}
DataProvider.Instance().DeleteLanguagePack(languagePack.LanguagePackID);
var objEventLog = new EventLogController();
objEventLog.AddLog(languagePack, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.LANGUAGEPACK_DELETED);
}
示例6: DeleteLanguagePack
public static void DeleteLanguagePack(LanguagePackInfo languagePack)
{
// fix DNN-26330 Removing a language pack extension removes the language
// we should not delete language when deleting language pack, as there is just a loose relationship
//if (languagePack.PackageType == LanguagePackType.Core)
//{
// Locale language = LocaleController.Instance.GetLocale(languagePack.LanguageID);
// if (language != null)
// {
// Localization.DeleteLanguage(language);
// }
//}
DataProvider.Instance().DeleteLanguagePack(languagePack.LanguagePackID);
var objEventLog = new EventLogController();
objEventLog.AddLog(languagePack, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.LANGUAGEPACK_DELETED);
}
示例7: WritteEventLog
public static void WritteEventLog(string message, EventLogController.EventLogType type)
{
var eventLog = new EventLogController();
var logInfo = new LogInfo
{
LogUserID = Data.Common.CurrentUser.UserID,
LogPortalID = Data.Common.PortalId,
LogTypeKey = type.ToString()
};
logInfo.AddProperty("PortalId:", Data.Common.PortalId.ToString());
logInfo.AddProperty("UserId:", Data.Common.CurrentUser.UserID.ToString());
logInfo.AddProperty("User:", Data.Common.CurrentUser.Username);
logInfo.AddProperty("Message:", message.Trim());
eventLog.AddLog(logInfo);
}
示例8: AddSchedule
public static int AddSchedule(string TypeFullName, int TimeLapse, string TimeLapseMeasurement, int RetryTimeLapse, string RetryTimeLapseMeasurement, int RetainHistoryNum, string AttachToEvent,
bool CatchUpEnabled, bool Enabled, string ObjectDependencies, string Servers, string FriendlyName)
{
var objEventLog = new EventLogController();
objEventLog.AddLog("TypeFullName", TypeFullName, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, EventLogController.EventLogType.SCHEDULE_CREATED);
return DataProvider.Instance().AddSchedule(TypeFullName,
TimeLapse,
TimeLapseMeasurement,
RetryTimeLapse,
RetryTimeLapseMeasurement,
RetainHistoryNum,
AttachToEvent,
CatchUpEnabled,
Enabled,
ObjectDependencies,
Servers,
UserController.GetCurrentUserInfo().UserID,
FriendlyName);
}
示例9: UpgradeModule
private static void UpgradeModule(EventMessage message)
{
try
{
int desktopModuleId = Convert.ToInt32(message.Attributes["DesktopModuleId"]);
var desktopModule = DesktopModuleController.GetDesktopModule(desktopModuleId, Null.NullInteger);
string BusinessControllerClass = message.Attributes["BusinessControllerClass"];
object controller = Reflection.CreateObject(BusinessControllerClass, "");
var eventLogController = new EventLogController();
LogInfo eventLogInfo;
if (controller is IUpgradeable)
{
//get the list of applicable versions
string[] UpgradeVersions = message.Attributes["UpgradeVersionsList"].Split(',');
foreach (string Version in UpgradeVersions)
{
//call the IUpgradeable interface for the module/version
string Results = ((IUpgradeable) controller).UpgradeModule(Version);
//log the upgrade results
eventLogInfo = new LogInfo();
eventLogInfo.AddProperty("Module Upgraded", BusinessControllerClass);
eventLogInfo.AddProperty("Version", Version);
if (!string.IsNullOrEmpty(Results))
{
eventLogInfo.AddProperty("Results", Results);
}
eventLogInfo.LogTypeKey = EventLogController.EventLogType.MODULE_UPDATED.ToString();
eventLogController.AddLog(eventLogInfo);
}
}
UpdateSupportedFeatures(controller, Convert.ToInt32(message.Attributes["DesktopModuleId"]));
}
catch (Exception exc)
{
Exceptions.LogException(exc);
}
}
示例10: SaveLanguagePack
public static void SaveLanguagePack(LanguagePackInfo languagePack)
{
var objEventLog = new EventLogController();
if (languagePack.LanguagePackID == Null.NullInteger)
{
//Add Language Pack
languagePack.LanguagePackID = DataProvider.Instance().AddLanguagePack(languagePack.PackageID,
languagePack.LanguageID,
languagePack.DependentPackageID,
UserController.GetCurrentUserInfo().UserID);
objEventLog.AddLog(languagePack, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.LANGUAGEPACK_CREATED);
}
else
{
//Update LanguagePack
DataProvider.Instance().UpdateLanguagePack(languagePack.LanguagePackID,
languagePack.PackageID,
languagePack.LanguageID,
languagePack.DependentPackageID,
UserController.GetCurrentUserInfo().UserID);
objEventLog.AddLog(languagePack, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.LANGUAGEPACK_UPDATED);
}
}
示例11: GetConfig
public static RewriterConfiguration GetConfig()
{
var config = new RewriterConfiguration {Rules = new RewriterRuleCollection()};
FileStream fileReader = null;
string filePath = "";
try
{
config = (RewriterConfiguration) DataCache.GetCache("RewriterConfig");
if ((config == null))
{
filePath = Common.Utilities.Config.GetPathToFile(Common.Utilities.Config.ConfigFileType.SiteUrls);
//Create a FileStream for the Config file
fileReader = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
var doc = new XPathDocument(fileReader);
config = new RewriterConfiguration {Rules = new RewriterRuleCollection()};
foreach (XPathNavigator nav in doc.CreateNavigator().Select("RewriterConfig/Rules/RewriterRule"))
{
var rule = new RewriterRule {LookFor = nav.SelectSingleNode("LookFor").Value, SendTo = nav.SelectSingleNode("SendTo").Value};
config.Rules.Add(rule);
}
if (File.Exists(filePath))
{
//Set back into Cache
DataCache.SetCache("RewriterConfig", config, new DNNCacheDependency(filePath));
}
}
}
catch (Exception ex)
{
//log it
var objEventLog = new EventLogController();
var objEventLogInfo = new LogInfo();
objEventLogInfo.AddProperty("UrlRewriter.RewriterConfiguration", "GetConfig Failed");
objEventLogInfo.AddProperty("FilePath", filePath);
objEventLogInfo.AddProperty("ExceptionMessage", ex.Message);
objEventLogInfo.LogTypeKey = EventLogController.EventLogType.HOST_ALERT.ToString();
objEventLog.AddLog(objEventLogInfo);
Logger.Error(objEventLogInfo);
}
finally
{
if (fileReader != null)
{
//Close the Reader
fileReader.Close();
}
}
return config;
}
示例12: AddUserAuthentication
/// -----------------------------------------------------------------------------
/// <summary>
/// AddUserAuthentication adds a new UserAuthentication to the User.
/// </summary>
/// <param name="userID">The new Authentication System to add</param>
/// <param name="authenticationType">The authentication type</param>
/// <param name="authenticationToken">The authentication token</param>
/// <history>
/// [cnurse] 07/12/2007 Created
/// [skydnn] 11/14/2013 DNN-4016
/// </history>
/// -----------------------------------------------------------------------------
public static int AddUserAuthentication(int userID, string authenticationType, string authenticationToken)
{
var objEventLog = new EventLogController();
UserAuthenticationInfo userAuth = GetUserAuthentication(userID);
if (userAuth == null || String.IsNullOrEmpty(userAuth.AuthenticationType))
{
objEventLog.AddLog("userID/authenticationType",
userID + "/" + authenticationType,
PortalController.GetCurrentPortalSettings(),
UserController.GetCurrentUserInfo().UserID,
EventLogController.EventLogType.AUTHENTICATION_USER_CREATED);
return provider.AddUserAuthentication(userID, authenticationType, authenticationToken, UserController.GetCurrentUserInfo().UserID);
}
else
{
objEventLog.AddLog("userID/authenticationType already exists",
userID + "/" + authenticationType,
PortalController.GetCurrentPortalSettings(),
UserController.GetCurrentUserInfo().UserID,
EventLogController.EventLogType.AUTHENTICATION_USER_UPDATED);
return userAuth.UserAuthenticationID;
}
}
示例13: LogModuleProviderExceptionInRequest
/// <summary>
/// logs an exception related to a module provider once per cache-lifetime
/// </summary>
/// <param name="ex"></param>
/// <param name="status"></param>
/// <param name="result"></param>
/// <param name="messages"></param>
/// <param name="provider"></param>
public static void LogModuleProviderExceptionInRequest(Exception ex, string status,
ExtensionUrlProvider provider,
UrlAction result,
List<string> messages)
{
if (ex != null)
{
string moduleProviderName = "Unknown Provider";
string moduleProviderVersion = "Unknown Version";
if (provider != null)
{
moduleProviderName = provider.ProviderConfig.ProviderName;
moduleProviderVersion = provider.GetType().Assembly.GetName(false).Version.ToString();
}
//this logic prevents a site logging an exception for every request made. Instead
//the exception will be logged once for the life of the cache / application restart or 1 hour, whichever is shorter.
//create a cache key for this exception type
string cacheKey = ex.GetType().ToString();
//see if there is an existing object logged for this exception type
object existingEx = DataCache.GetCache(cacheKey);
if (existingEx == null)
{
//if there was no existing object logged for this exception type, this is a new exception
DateTime expire = DateTime.Now.AddHours(1);
DataCache.SetCache(cacheKey, cacheKey, expire);
//just store the cache key - it doesn't really matter
//create a log event
string productVer = Assembly.GetExecutingAssembly().GetName(false).Version.ToString();
var elc = new EventLogController();
var logEntry = new LogInfo {LogTypeKey = "GENERAL_EXCEPTION"};
logEntry.AddProperty("Url Rewriting Extension Url Provider Exception",
"Exception in Url Rewriting Process");
logEntry.AddProperty("Provider Name", moduleProviderName);
logEntry.AddProperty("Provider Version", moduleProviderVersion);
logEntry.AddProperty("Http Status", status);
logEntry.AddProperty("Product Version", productVer);
if (result != null)
{
logEntry.AddProperty("Original Path", result.OriginalPath ?? "null");
logEntry.AddProperty("Raw Url", result.RawUrl ?? "null");
logEntry.AddProperty("Final Url", result.FinalUrl ?? "null");
logEntry.AddProperty("Rewrite Result", !string.IsNullOrEmpty(result.RewritePath)
? result.RewritePath
: "[no rewrite]");
logEntry.AddProperty("Redirect Location", string.IsNullOrEmpty(result.FinalUrl)
? "[no redirect]"
: result.FinalUrl);
logEntry.AddProperty("Action", result.Action.ToString());
logEntry.AddProperty("Reason", result.Reason.ToString());
logEntry.AddProperty("Portal Id", result.PortalId.ToString());
logEntry.AddProperty("Tab Id", result.TabId.ToString());
logEntry.AddProperty("Http Alias", result.PortalAlias != null ? result.PortalAlias.HTTPAlias : "Null");
if (result.DebugMessages != null)
{
int i = 1;
foreach (string debugMessage in result.DebugMessages)
{
string msg = debugMessage;
if (debugMessage == null)
{
msg = "[message was null]";
}
logEntry.AddProperty("Debug Message[result] " + i.ToString(), msg);
i++;
}
}
}
else
{
logEntry.AddProperty("Result", "Result value null");
}
if (messages != null)
{
int i = 1;
foreach (string msg in messages)
{
logEntry.AddProperty("Debug Message[raw] " + i.ToString(), msg);
i++;
}
}
logEntry.AddProperty("Exception Type", ex.GetType().ToString());
logEntry.AddProperty("Message", ex.Message);
logEntry.AddProperty("Stack Trace", ex.StackTrace);
if (ex.InnerException != null)
{
logEntry.AddProperty("Inner Exception Message", ex.InnerException.Message);
logEntry.AddProperty("Inner Exception Stacktrace", ex.InnerException.StackTrace);
}
logEntry.BypassBuffering = true;
elc.AddLog(logEntry);
//.........这里部分代码省略.........
示例14: UpdateSkinPackage
public static void UpdateSkinPackage(SkinPackageInfo skinPackage)
{
DataProvider.Instance().UpdateSkinPackage(skinPackage.SkinPackageID,
skinPackage.PackageID,
skinPackage.PortalID,
skinPackage.SkinName,
skinPackage.SkinType,
UserController.GetCurrentUserInfo().UserID);
var eventLogController = new EventLogController();
eventLogController.AddLog(skinPackage, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.SKINPACKAGE_UPDATED);
foreach (KeyValuePair<int, string> kvp in skinPackage.Skins)
{
UpdateSkin(kvp.Key, kvp.Value);
}
}
示例15: UpdateUserProfile
/// -----------------------------------------------------------------------------
/// <summary>
/// UpdateUserProfile persists a user's Profile to the Data Store
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="user">The user to persist to the Data Store.</param>
/// -----------------------------------------------------------------------------
public override void UpdateUserProfile(UserInfo user)
{
ProfilePropertyDefinitionCollection properties = user.Profile.ProfileProperties;
//Ensure old and new TimeZone properties are in synch
var newTimeZone = properties["PreferredTimeZone"];
var oldTimeZone = properties["TimeZone"];
if (oldTimeZone != null && newTimeZone != null)
{ //preference given to new property, if new is changed then old should be updated as well.
if (newTimeZone.IsDirty && !string.IsNullOrEmpty(newTimeZone.PropertyValue))
{
var timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(newTimeZone.PropertyValue);
if (timeZoneInfo != null)
oldTimeZone.PropertyValue = timeZoneInfo.BaseUtcOffset.TotalMinutes.ToString(CultureInfo.InvariantCulture);
}
//however if old is changed, we need to update new as well
else if (oldTimeZone.IsDirty)
{
int oldOffset;
int.TryParse(oldTimeZone.PropertyValue, out oldOffset);
newTimeZone.PropertyValue = Localization.ConvertLegacyTimeZoneOffsetToTimeZoneInfo(oldOffset).Id;
}
}
foreach (ProfilePropertyDefinition profProperty in properties)
{
if ((profProperty.PropertyValue != null) && (profProperty.IsDirty))
{
var objSecurity = new PortalSecurity();
string propertyValue = objSecurity.InputFilter(profProperty.PropertyValue, PortalSecurity.FilterFlag.NoScripting);
_dataProvider.UpdateProfileProperty(Null.NullInteger, user.UserID, profProperty.PropertyDefinitionId,
propertyValue, (int) profProperty.ProfileVisibility.VisibilityMode,
profProperty.ProfileVisibility.ExtendedVisibilityString(), DateTime.Now);
var objEventLog = new EventLogController();
objEventLog.AddLog(user, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", "USERPROFILE_UPDATED");
}
}
}