本文整理汇总了C#中EventLogProvider.LogEvent方法的典型用法代码示例。如果您正苦于以下问题:C# EventLogProvider.LogEvent方法的具体用法?C# EventLogProvider.LogEvent怎么用?C# EventLogProvider.LogEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventLogProvider
的用法示例。
在下文中一共展示了EventLogProvider.LogEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
/// <summary>
/// Executes the task.
/// </summary>
/// <param name="ti">Task info</param>
public string Execute(TaskInfo ti)
{
EventLogProvider ev = new EventLogProvider();
ev.LogEvent(EventLogProvider.EVENT_TYPE_INFORMATION, DateTime.Now, "MyTask", "Execute", null, "This task was executed from '~/App_Code/Global/CMS/CMSCustom.cs'.");
return null;
}
示例2: btnClone_Click
protected void btnClone_Click(object sender, EventArgs e)
{
try
{
CloneResult result = cloneObjectElem.CloneObject();
if (result != null)
{
if (result.Errors.Count > 0)
{
ShowError(ResHelper.LocalizeString(string.Join("\n", result.Errors.ToArray())));
SwitchToErrorMode();
}
else if (result.Warnings.Count > 0)
{
ShowWarning(GetString("cloning.savedwithwarnings"), ResHelper.LocalizeString(string.Join("<br/>", result.Warnings.ToArray())), null);
SwitchToErrorMode();
}
else
{
ScriptHelper.RegisterStartupScript(this.Page, typeof(string), "CloneRefresh", cloneObjectElem.CloseScript, true);
}
}
}
catch (Exception ex)
{
EventLogProvider provider = new EventLogProvider();
provider.LogEvent(string.IsNullOrEmpty(objectType) ? "System" : objectType.ToLowerCSafe(), "CLONEOBJECT", ex);
ShowError(ex.Message);
if (!cloneObjectElem.UseTransaction)
{
SwitchToErrorMode();
}
}
}
示例3: SetSiteInfoInternal
/// <summary>
/// Sets the specified site data.
/// </summary>
/// <param name="siteInfoObj">New site info data</param>
protected override void SetSiteInfoInternal(SiteInfo siteInfoObj)
{
base.SetSiteInfoInternal(siteInfoObj);
// Log the event that the site was updated
EventLogProvider ev = new EventLogProvider();
ev.LogEvent(EventLogProvider.EVENT_TYPE_INFORMATION, DateTime.Now, "MyCustomSiteInfoProvider", "SetSiteInfo", null, "The site was updated");
}
示例4: RemoveInternal
/// <summary>
/// Removes the item from the cache.
/// </summary>
/// <param name="key">Cache key</param>
protected override object RemoveInternal(string key)
{
// Log the event that the user was updated
EventLogProvider ev = new EventLogProvider();
ev.LogEvent(EventLogProvider.EVENT_TYPE_INFORMATION, DateTime.Now, "MyCustomCacheHelper", "Remove", null, "The cache item was removed");
return base.RemoveInternal(key);
}
示例5: btnOk_Click
/// <summary>
/// OkClick Handler.
/// </summary>
protected void btnOk_Click(object sender, EventArgs e)
{
string culture = ValidationHelper.GetString(cultureSelector.Value, "");
if ((culture != "") && ((currentCulture.ToLower() != culture.ToLower()) || chkDocuments.Checked))
{
// Set new culture
SiteInfo si = SiteInfoProvider.GetSiteInfo(siteId);
if (si != null)
{
try
{
// Set default culture and change current culture label
ObjectHelper.SetSettingsKeyValue(si.SiteName + ".CMSDefaultCultureCode", culture.Trim());
// Change culture of documents
if (chkDocuments.Checked)
{
// Change culture of the documents
TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);
tree.ChangeCulture(si.SiteName, currentCulture, culture);
}
if (!LicenseHelper.CheckFeature(URLHelper.GetCurrentDomain(), FeatureEnum.Multilingual))
{
// If not multilingual, remove all cultures from the site and assign new culture
CultureInfoProvider.RemoveSiteCultures(si.SiteName);
CultureInfoProvider.AddCultureToSite(culture, si.SiteName);
}
ltlScript.Text = ScriptHelper.GetScript("wopener.ChangeCulture('" + chkDocuments.Checked.ToString() + "'); window.close();");
}
catch (Exception ex)
{
EventLogProvider ev = new EventLogProvider();
ev.LogEvent("SiteManager", "ChangeDefaultCulture", ex);
}
}
}
else
{
ltlScript.Text = ScriptHelper.GetScript("window.close();");
}
}
示例6: LogEvent
/// <summary>
/// Logs error.
/// </summary>
/// <param name="message">Error message</param>
/// <param name="eventCode">Event code</param>
protected void LogEvent(string message, string eventCode)
{
try
{
// Add some additional information to the error message
string info = "ORDER ID: " + orderId + "\r\n";
info += "TRANSACTION ID: " + transactionId + "\r\n";
info += "PAYMENT STATUS: " + paymentStatus + "\r\n";
message = info + message;
EventLogProvider evenLog = new EventLogProvider();
evenLog.LogEvent(EventLogProvider.EVENT_TYPE_ERROR, DateTime.Now, "PayPal IPN", eventCode, 0, "", 0, "", "", message, 0, "");
}
catch
{
// Unable to log the event
}
}
示例7: DeleteData
/// <summary>
/// Deletes sample data.
/// </summary>
private void DeleteData()
{
try
{
QueryDataParameters parameters = new QueryDataParameters();
parameters.Add("siteId", CMSContext.CurrentSiteID);
ConnectionHelper.ExecuteQuery("ecommerce.order.deleteSampleData", parameters);
// Log successful attempt
EventLogProvider eventLog = new EventLogProvider();
eventLog.LogEvent("I", DateTime.Now, "E-commerce data generator", "DATADELETED", CMSContext.CurrentSiteID);
ShowConfirmation(GetString("com.reports.datadeleted"));
}
catch (Exception ex)
{
EventLogProvider.LogException("Reports", "Delete", ex);
ShowError(GetString("com.reports.operationFailed"));
}
}
示例8: btnHiddenImpersonate_Click
protected void btnHiddenImpersonate_Click(object sender, EventArgs e)
{
string originalUserName = ValidationHelper.GetString(SessionHelper.GetValue("OriginalUserName"), "");
if (RequestHelper.IsFormsAuthentication())
{
UserInfo ui = UserInfoProvider.GetUserInfo(originalUserName);
CMSContext.CurrentUser.UserImpersonate(ui);
}
else
{
SessionHelper.SetValue("ImpersonateUserName", null);
SessionHelper.SetValue("OriginalUserName", null);
CMSContext.CurrentUser.Invalidate(false);
// Log event
EventLogProvider log = new EventLogProvider();
log.LogEvent(EventLogProvider.EVENT_TYPE_INFORMATION, DateTime.Now, "Administration", "Impersonate", 0, null, 0, null, null, "User " + originalUserName + " has returned to his account.", CMSContext.CurrentSiteID, URLHelper.CurrentURL);
URLHelper.Redirect(URLHelper.CurrentURL);
}
}
示例9: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
string domain = QueryHelper.GetText("domainname", String.Empty);
if (domain != String.Empty)
{
LicenseKeyInfo lki = LicenseKeyInfoProvider.GetLicenseKeyInfo(domain);
if (lki != null)
{
LabelMessage.Text = GetString("CMSSiteManager.FeatureNotAvailable");
// Log message to event log
EventLogProvider eventLog = new EventLogProvider();
eventLog.LogEvent(EventLogProvider.EVENT_TYPE_WARNING, DateTime.Now, "Feature not available page", "FeatureNotAvailable", URLHelper.CurrentURL, "The requested feature is not available in the CMS edition you are using: " + LicenseHelper.GetEditionName(lki.Edition));
}
else
{
LabelMessage.Text = GetString("CMSSiteManager.LicenseNotFound").Replace("%%name%%", domain);
}
}
titleElem.TitleText = GetString("CMSSiteManager.AccesDenied");
titleElem.TitleImage = GetImageUrl("Others/Messages/denied.png");
}
示例10: Upgrade60Import
private static void Upgrade60Import()
{
EventLogProvider evp = new EventLogProvider();
// Import
try
{
RequestStockHelper.Remove("CurrentDomain", true);
SiteImportSettings importSettings = new SiteImportSettings(CMSContext.CurrentUser)
{
DefaultProcessObjectType = ProcessObjectEnum.All,
SourceFilePath = mUpgradePackagePath,
WebsitePath = mWebsitePath
};
ImportProvider.ImportObjectsData(importSettings);
// Regenerate time zones
TimeZoneInfoProvider.GenerateTimeZoneRules();
#region "Separability"
String webPartsPath = mWebsitePath + "CMSWebParts\\";
List<String> files = new List<string>();
// Create list of files to remove
if (!ModuleEntry.IsModuleLoaded(ModuleEntry.BIZFORM))
{
files.AddRange(GetAllFiles(webPartsPath + "BizForms"));
}
if (!ModuleEntry.IsModuleLoaded(ModuleEntry.BLOGS))
{
files.AddRange(GetAllFiles(webPartsPath + "Blogs"));
}
if (!ModuleEntry.IsModuleLoaded(ModuleEntry.COMMUNITY))
{
files.AddRange(GetAllFiles(webPartsPath + "Community"));
}
if (!ModuleEntry.IsModuleLoaded(ModuleEntry.ECOMMERCE))
{
files.AddRange(GetAllFiles(webPartsPath + "Ecommerce"));
}
if (!ModuleEntry.IsModuleLoaded(ModuleEntry.EVENTMANAGER))
{
files.AddRange(GetAllFiles(webPartsPath + "Events"));
}
if (!ModuleEntry.IsModuleLoaded(ModuleEntry.FORUMS))
{
files.AddRange(GetAllFiles(webPartsPath + "Forums"));
}
if (!ModuleEntry.IsModuleLoaded(ModuleEntry.MEDIALIBRARY))
{
files.AddRange(GetAllFiles(webPartsPath + "MediaLibrary"));
}
if (!ModuleEntry.IsModuleLoaded(ModuleEntry.MESSAGEBOARD))
{
files.AddRange(GetAllFiles(webPartsPath + "MessageBoards"));
}
if (!ModuleEntry.IsModuleLoaded(ModuleEntry.MESSAGING))
{
files.AddRange(GetAllFiles(webPartsPath + "Messaging"));
}
if (!ModuleEntry.IsModuleLoaded(ModuleEntry.NEWSLETTER))
{
files.AddRange(GetAllFiles(webPartsPath + "Newsletters"));
}
if (!ModuleEntry.IsModuleLoaded(ModuleEntry.NOTIFICATIONS))
{
files.AddRange(GetAllFiles(webPartsPath + "Notifications"));
}
if (!ModuleEntry.IsModuleLoaded(ModuleEntry.ONLINEMARKETING))
{
files.AddRange(GetAllFiles(webPartsPath + "OnlineMarketing"));
}
if (!ModuleEntry.IsModuleLoaded(ModuleEntry.POLLS))
{
files.AddRange(GetAllFiles(webPartsPath + "Polls"));
}
if (!ModuleEntry.IsModuleLoaded(ModuleEntry.PROJECTMANAGEMENT))
{
files.AddRange(GetAllFiles(webPartsPath + "ProjectManagement"));
}
if (!ModuleEntry.IsModuleLoaded(ModuleEntry.REPORTING))
{
files.AddRange(GetAllFiles(webPartsPath + "Reporting"));
}
// Remove webparts for separated modules
foreach (String file in files)
{
try
{
File.Delete(file);
}
catch (Exception ex)
{
evp.LogEvent("Upgrade to 6.0", "Upgrade", ex);
}
}
#endregion
//.........这里部分代码省略.........
示例11: baseImageEditor_InitializeProperties
/// <summary>
/// Initializes common properties used for processing image.
/// </summary>
void baseImageEditor_InitializeProperties()
{
// Process media file
if (baseImageEditor.ImageType == ImageHelper.ImageTypeEnum.MediaFile)
{
// Get mediafile
mfi = MediaFileInfoProvider.GetMediaFileInfo(mediafileGuid, this.CurrentSiteName);
// If file is not null
if (mfi != null)
{
MediaLibraryInfo mli = MediaLibraryInfoProvider.GetMediaLibraryInfo(mfi.FileLibraryID);
if ((mli != null) && (MediaLibraryInfoProvider.IsUserAuthorizedPerLibrary(mli, "filemodify")))
{
// Load media file thumbnail
if (isPreview)
{
PreviewPath = MediaFileInfoProvider.GetPreviewFilePath(mfi);
if (PreviewPath != null)
{
OldPreviewExt = Path.GetExtension(PreviewPath);
try
{
// Get file contents from file system
previewFile = File.ReadAllBytes(PreviewPath);
}
catch (Exception ex)
{
EventLogProvider ev = new EventLogProvider();
ev.LogEvent("ImageEditor", "GetPreviewFile", ex);
}
if (previewFile != null)
{
baseImageEditor.ImgHelper = new ImageHelper(previewFile);
}
else
{
baseImageEditor.LoadingFailed = true;
baseImageEditor.LblLoadFailed.ResourceString = "img.errors.loading";
}
}
else
{
baseImageEditor.LoadingFailed = true;
baseImageEditor.LblLoadFailed.ResourceString = "img.errors.loading";
}
}
// Load media file
else
{
mfi.FileBinary = MediaFileInfoProvider.GetFile(mfi, mli.LibraryFolder, this.CurrentSiteName);
// Ensure metafile binary data
if (mfi.FileBinary != null)
{
baseImageEditor.ImgHelper = new ImageHelper(mfi.FileBinary);
}
else
{
baseImageEditor.LoadingFailed = true;
baseImageEditor.LblLoadFailed.ResourceString = "img.errors.loading";
}
}
}
else
{
baseImageEditor.LoadingFailed = true;
baseImageEditor.LblLoadFailed.ResourceString = "img.errors.filemodify";
}
}
else
{
baseImageEditor.LoadingFailed = true;
baseImageEditor.LblLoadFailed.ResourceString = "img.errors.loading";
}
}
// Check that image is in supported formats
if ((!baseImageEditor.LoadingFailed) && (baseImageEditor.ImgHelper.ImageFormatToString() == null))
{
baseImageEditor.LoadingFailed = true;
baseImageEditor.LblLoadFailed.ResourceString = "img.errors.format";
}
}
示例12: wzdImport_NextButtonClick
//.........这里部分代码省略.........
string error = ImportExportControl.CheckLicenses(ImportSettings);
if (!string.IsNullOrEmpty(error))
{
lblError.Text = error;
e.Cancel = true;
return;
}
ImportSettings = pnlImport.Settings;
PreviousButton.Enabled = false;
NextButton.Enabled = false;
SiteName = ImportSettings.SiteName;
Domain = ImportSettings.SiteDomain;
// Init the Mimetype helper (required for the Import)
MimeTypeHelper.LoadMimeTypes();
// Start asynchronnous Import
ImportSettings.SetSettings(ImportExportHelper.SETTINGS_DELETE_TEMPORARY_FILES, false);
ImportSettings.DefaultProcessObjectType = ProcessObjectEnum.Selected;
ImportManager.Settings = ImportSettings;
// Import site asynchronously
ctrlImport.RunAsync(ImportManager.Import, WindowsIdentity.GetCurrent());
ctrlImport.PostbackOnError = false;
ltlScript.Text = ScriptHelper.GetScript("StartImportStateTimer();");
wzdImport.ActiveStepIndex++;
break;
// Import progress
case 4:
PreviousButton.Visible = false;
CultureHelper.SetPreferredCulture(Culture);
if (siteType.SelectTemplate)
{
// Done
finishSite.Domain = Domain;
finishSite.SiteIsRunning = SiteIsRunning;
wzdImport.ActiveStepIndex = 7;
}
else
{
if (ImportManager.Settings.IsWarning())
{
try
{
// Convert default culture
TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);
tree.ChangeSiteDefaultCulture(SiteName, Culture, "en-US");
// Change root GUID
TreeNode root = DocumentHelper.GetDocument(SiteName, "/", Culture, false, "cms.root", null, null, 1, false, null, tree);
if (root != null)
{
root.NodeGUID = Guid.NewGuid();
DocumentHelper.UpdateDocument(root, tree);
}
}
catch (Exception ex)
{
EventLogProvider ev = new EventLogProvider();
ev.LogEvent("NewSiteWizard", "FINISH", ex);
lblError.Text = ex.Message;
e.Cancel = true;
return;
}
}
selectMaster.SiteName = SiteName;
selectMaster.ReloadData();
}
break;
// Master template
case 5:
if (!selectMaster.ApplySettings())
{
e.Cancel = true;
return;
}
siteStructure.SiteName = SiteName;
break;
// Define site structure
case 6:
finishSite.Domain = Domain;
finishSite.SiteIsRunning = SiteIsRunning;
break;
// Other steps
default:
wzdImport.ActiveStepIndex = e.NextStepIndex;
break;
}
}
示例13: Update60
public static void Update60()
{
EventLogProvider evp = new EventLogProvider();
evp.LogEvent("I", DateTime.Now, "Upgrade to 6.0", "Upgrade - Start");
DataClassInfo dci = null;
#region "CMS.UserSettings"
try
{
dci = DataClassInfoProvider.GetDataClass("cms.usersettings");
if (dci != null)
{
FormInfo fi = new FormInfo(dci.ClassFormDefinition);
if (fi != null)
{
FormFieldInfo ffi = new FormFieldInfo();
ffi.Name = "UserAuthenticationGUID";
ffi.DataType = FormFieldDataTypeEnum.GUID;
ffi.AllowEmpty = true;
ffi.PublicField = false;
ffi.System = true;
ffi.FieldType = FormFieldControlTypeEnum.LabelControl;
ffi.Visible = false;
fi.AddFormField(ffi);
ffi = new FormFieldInfo();
ffi.Name = "UserBounces";
ffi.DataType = FormFieldDataTypeEnum.Integer;
ffi.AllowEmpty = true;
ffi.PublicField = false;
ffi.System = true;
ffi.FieldType = FormFieldControlTypeEnum.TextBoxControl;
ffi.Visible = false;
ffi.Caption = "UserBounces";
fi.AddFormField(ffi);
ffi = new FormFieldInfo();
ffi.Name = "UserLinkedInID";
ffi.DataType = FormFieldDataTypeEnum.Text;
ffi.Size = 100;
ffi.AllowEmpty = true;
ffi.PublicField = false;
ffi.System = true;
ffi.FieldType = FormFieldControlTypeEnum.LabelControl;
ffi.Visible = false;
fi.AddFormField(ffi);
ffi = new FormFieldInfo();
ffi.Name = "UserLogActivities";
ffi.DataType = FormFieldDataTypeEnum.Boolean;
ffi.AllowEmpty = true;
ffi.PublicField = false;
ffi.System = true;
ffi.FieldType = FormFieldControlTypeEnum.LabelControl;
ffi.Visible = false;
fi.AddFormField(ffi);
ffi = new FormFieldInfo();
ffi.Name = "UserPasswordRequestHash";
ffi.DataType = FormFieldDataTypeEnum.Text;
ffi.Size = 100;
ffi.AllowEmpty = true;
ffi.PublicField = false;
ffi.System = true;
ffi.FieldType = FormFieldControlTypeEnum.LabelControl;
ffi.Visible = false;
fi.AddFormField(ffi);
dci.ClassFormDefinition = fi.GetXmlDefinition();
TableManager tm = new TableManager(dci.ClassConnectionString);
dci.ClassXmlSchema = tm.GetXmlSchema("CMS_UserSettings");
DataClassInfoProvider.SetDataClass(dci);
// Generate queries
SqlGenerator.GenerateDefaultQueries(dci, true, false);
tm.RefreshCustomViews("CMS_UserSettings");
}
}
}
catch (Exception ex)
{
evp.LogEvent("CMS.UserSettings - Upgrade", "Upgrade", ex);
}
#endregion
#region "Ecommerce - Customer"
try
{
dci = DataClassInfoProvider.GetDataClass("ecommerce.customer");
//.........这里部分代码省略.........
示例14: RaiseCallbackEvent
/// <summary>
/// Callback event handler.
/// </summary>
/// <param name="argument">Callback argument</param>
public void RaiseCallbackEvent(string argument)
{
// Get arguments
string[] args = argument.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
bool cancel = ValidationHelper.GetBoolean(args[0], false);
int messageLength = 0;
int errorLength = 0;
int warningLength = 0;
string machineName = null;
if (args.Length == 5)
{
messageLength = ValidationHelper.GetInteger(args[1], 0);
errorLength = ValidationHelper.GetInteger(args[2], 0);
warningLength = ValidationHelper.GetInteger(args[3], 0);
machineName = ValidationHelper.GetString(args[4], null);
}
// Check if on same machine
if (machineName == SqlHelperClass.MachineName.ToLowerCSafe())
{
try
{
// Cancel Import
if (cancel)
{
ImportManager.Settings.Cancel();
}
hdnState.Value = ImportManager.Settings.GetLimitedProgressLog(messageLength, errorLength, warningLength);
}
catch (Exception ex)
{
EventLogProvider ev = new EventLogProvider();
ev.LogEvent("NewSiteWizard", "IMPORT", ex);
hdnState.Value = ImportManager.Settings.GetLimitedProgressLog(messageLength, errorLength, warningLength);
}
finally
{
if (ImportManager.Settings.GetProgressState() != LogStatusEnum.Info)
{
// Delete presistent data
PersistentStorageHelper.RemoveValue(PersistentSettingsKey);
}
}
}
}
示例15: ctrlImport_OnFinished
protected void ctrlImport_OnFinished(object sender, EventArgs e)
{
try
{
// Convert default culture
if (!siteType.SelectTemplate)
{
TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);
tree.ChangeSiteDefaultCulture(SiteName, Culture, "en-US");
// Change root GUID
TreeNode root = DocumentHelper.GetDocument(SiteName, "/", Culture, false, "cms.root", null, null, 1, false, null, tree);
if (root != null)
{
root.NodeGUID = Guid.NewGuid();
DocumentHelper.UpdateDocument(root, tree);
}
}
}
catch (Exception ex)
{
EventLogProvider ev = new EventLogProvider();
ev.LogEvent("NewSiteWizard", "FINISH", ex);
}
finally
{
if (ImportManager.Settings.ProcessCanceled)
{
NextButton.Enabled = CancelButton.Enabled = false;
mImportCanceled = true;
lblProgress.Text = "<strong>" + ResHelper.GetAPIString("ImportSite.ImportCanceled", "Import process has been cancelled.") + "</strong>";
}
else
{
if (!ImportManager.Settings.IsWarning() && !ImportManager.Settings.IsError())
{
PreviousButton.Visible = false;
CultureHelper.SetPreferredCulture(Culture);
if (siteType.SelectTemplate)
{
// Done
finishSite.Domain = Domain;
wzdImport.ActiveStepIndex = 7;
}
else
{
selectMaster.SiteName = SiteName;
wzdImport.ActiveStepIndex += 1;
selectMaster.ReloadData();
}
}
}
// Stop the timer
string script = "StopSelectionTimer();";
ltlScriptAfter.Text += ScriptHelper.GetScript(script);
}
}