本文整理汇总了C#中EventLogProvider类的典型用法代码示例。如果您正苦于以下问题:C# EventLogProvider类的具体用法?C# EventLogProvider怎么用?C# EventLogProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventLogProvider类属于命名空间,在下文中一共展示了EventLogProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAndBulkUpdateEvents
/// <summary>
/// Gets and bulk updates eventss. Called when the "Get and bulk update events" button is pressed.
/// Expects the LogEvent method to be run first.
/// </summary>
private bool GetAndBulkUpdateEvents()
{
// Create new instance of event log provider
EventLogProvider eventLog = new EventLogProvider();
// Get events matching the where condition
string where = "EventCode = 'APIEXAMPLE'";
DataSet events = eventLog.GetAllEvents(where, null);
if (!DataHelper.DataSourceIsEmpty(events))
{
// Loop through the individual items
foreach (DataRow eventDr in events.Tables[0].Rows)
{
// Create the object from DataRow
EventLogInfo updateEvent = new EventLogInfo(eventDr);
// Update the properties
updateEvent.EventDescription = updateEvent.EventDescription.ToUpper();
// Save the changes
eventLog.SetEventLogInfo(updateEvent);
}
return true;
}
return false;
}
示例2: 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;
}
示例3: 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();
}
}
}
示例4: 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");
}
示例5: 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);
}
示例6: ClearLog
/// <summary>
/// Clears event log for current site. Called when the "Clear event log" button is pressed.
/// Expects the CreateAbuseReport method to be run first.
/// </summary>
private bool ClearLog()
{
// Create new instance of event log provider
EventLogProvider eventLog = new EventLogProvider();
// Clear event log for current site
eventLog.ClearEventLog(CMSContext.CurrentUser.UserID, CMSContext.CurrentUser.UserName, HTTPHelper.UserHostAddress, CMSContext.CurrentSiteID);
return true;
}
示例7: 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();");
}
}
示例8: 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
}
}
示例9: GenerateData
/// <summary>
/// Generates sample data.
/// </summary>
private void GenerateData()
{
try
{
QueryDataParameters parameters = new QueryDataParameters();
parameters.Add("siteId", CMSContext.CurrentSiteID);
ConnectionHelper.ExecuteQuery("ecommerce.order.generateSampleData", parameters);
// Log successful attempt
EventLogProvider eventLog = new EventLogProvider();
eventLog.LogEvent("I", DateTime.Now, "E-commerce data generator", "DATAGENERATED", CMSContext.CurrentSiteID);
ShowConfirmation(GetString("com.reports.datagenerated"));
}
catch (Exception ex)
{
EventLogProvider.LogException("Reports", "Generate", ex);
ShowError(GetString("com.reports.operationFailed"));
}
}
示例10: 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);
}
}
示例11: 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");
}
示例12: 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";
}
}
示例13: 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
//.........这里部分代码省略.........
示例14: 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");
//.........这里部分代码省略.........
示例15: 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;
}
}