Example #1
0
    /// <summary>
    /// Loads data of specific EventLog from DB.
    /// </summary>
    protected void LoadData()
    {
        EventLogInfo ev = EventInfo;

        //Set edited object
        EditedObject = ev;

        if (ev != null)
        {
            // Rewrite event type text.
            lblEventTypeValue.Text = EventLogHelper.GetEventTypeText(ev.EventType);
            lblEventIDValue.Text   = ev.EventID.ToString();
            lblEventTimeValue.Text = ev.EventTime.ToString();
            lblSourceValue.Text    = HTMLHelper.HTMLEncode(ev.Source);
            lblEventCodeValue.Text = HTMLHelper.HTMLEncode(ev.EventCode);

            lblUserIDValue.Text = ev.UserID.ToString();
            plcUserID.Visible   = (ev.UserID > 0);

            lblUserNameValue.Text = HTMLHelper.HTMLEncode(Functions.GetFormattedUserName(ev.UserName));
            plcUserName.Visible   = !string.IsNullOrEmpty(lblUserNameValue.Text);

            lblIPAddressValue.Text = ev.IPAddress;

            lblNodeIDValue.Text = ev.NodeID.ToString();
            plcNodeID.Visible   = (ev.NodeID > 0);

            lblNodeNameValue.Text = HTMLHelper.HTMLEncode(ev.DocumentName);
            plcNodeName.Visible   = !string.IsNullOrEmpty(lblNodeNameValue.Text);

            // Replace HTML except line endings (<br /> or \r\n)
            var    newLineRegex = RegexHelper.GetRegex(@"(<br[ ]?/>)|([\r]?\n)");
            string description  = TruncateDescription(ev.EventDescription);
            description = HTMLHelper.StripTags(newLineRegex.Replace(description, EOL_REPLACEMENT));
            lblEventDescriptionValue.Text = HTMLHelper.HTMLEncode(description).Replace(EOL_REPLACEMENT, "<br />");

            if (ev.SiteID > 0)
            {
                SiteInfo si = SiteInfoProvider.GetSiteInfo(ev.SiteID);
                if (si != null)
                {
                    lblSiteNameValue.Text = HTMLHelper.HTMLEncode(si.DisplayName);
                }
            }
            else
            {
                plcSite.Visible = false;
            }

            lblMachineNameValue.Text = HTMLHelper.HTMLEncode(ev.EventMachineName);
            lblEventUrlValue.Text    = HTMLHelper.HTMLEncode(ev.EventUrl);
            lblUrlReferrerValue.Text = HTMLHelper.HTMLEncode(ev.EventUrlReferrer);
            lblUserAgentValue.Text   = HTMLHelper.HTMLEncode(ev.EventUserAgent);
        }
    }
    /// <summary>
    /// Loads data of specific EventLog from DB.
    /// </summary>
    protected void LoadData()
    {
        EventLogInfo ev = EventLogProvider.GetEventLogInfo(eventId);

        //Set edited object
        EditedObject = ev;

        if (ev != null)
        {
            string eventType = ValidationHelper.GetString(ev.GetValue("EventType"), string.Empty);

            // Rewrite event type text.
            lblEventTypeValue.Text = EventLogHelper.GetEventTypeText(eventType);
            lblEventIDValue.Text   = ValidationHelper.GetString(ev.GetValue("EventID"), string.Empty);
            lblEventTimeValue.Text = ValidationHelper.GetString(ev.GetValue("EventTime"), string.Empty);
            lblSourceValue.Text    = HTMLHelper.HTMLEncode(ValidationHelper.GetString(ev.GetValue("Source"), string.Empty));
            lblEventCodeValue.Text = HTMLHelper.HTMLEncode(ValidationHelper.GetString(ev.GetValue("EventCode"), string.Empty));

            lblUserIDValue.Text = ValidationHelper.GetString(ev.GetValue("UserID"), string.Empty);
            plcUserID.Visible   = (lblUserIDValue.Text != string.Empty);

            lblUserNameValue.Text = HTMLHelper.HTMLEncode(Functions.GetFormattedUserName(ValidationHelper.GetString(ev.GetValue("UserName"), string.Empty)));
            plcUserName.Visible   = (lblUserNameValue.Text != string.Empty);

            lblIPAddressValue.Text = ValidationHelper.GetString(ev.GetValue("IPAddress"), string.Empty);

            lblNodeIDValue.Text = ValidationHelper.GetString(ev.GetValue("NodeID"), string.Empty);
            plcNodeID.Visible   = (lblNodeIDValue.Text != string.Empty);

            lblNodeNameValue.Text = HTMLHelper.HTMLEncode(ValidationHelper.GetString(ev.GetValue("DocumentName"), string.Empty));
            plcNodeName.Visible   = (lblNodeNameValue.Text != string.Empty);

            string description = HTMLHelper.StripTags(ValidationHelper.GetString(ev.GetValue("EventDescription"), string.Empty).Replace("<br />", "\r\n").Replace("<br/>", "\r\n"));
            lblEventDescriptionValue.Text = HTMLHelper.EnsureLineEnding(HTMLHelper.HTMLEncode(description), "<br />");

            if (!DataHelper.IsEmpty(ev.GetValue("SiteID")))
            {
                SiteInfo si = SiteInfoProvider.GetSiteInfo(Convert.ToInt32(ev.GetValue("SiteID")));
                if (si != null)
                {
                    lblSiteNameValue.Text = HTMLHelper.HTMLEncode(si.DisplayName);
                }
            }
            else
            {
                plcSite.Visible = false;
            }

            lblMachineNameValue.Text = HTMLHelper.HTMLEncode(ValidationHelper.GetString(ev.GetValue("EventMachineName"), string.Empty));
            lblEventUrlValue.Text    = HTMLHelper.HTMLEncode(ValidationHelper.GetString(ev.GetValue("EventUrl"), string.Empty));
            lblUrlReferrerValue.Text = HTMLHelper.HTMLEncode(ValidationHelper.GetString(ev.GetValue("EventUrlReferrer"), string.Empty));
            lblUserAgentValue.Text   = HTMLHelper.HTMLEncode(ValidationHelper.GetString(ev.GetValue("EventUserAgent"), string.Empty));
        }
    }
Example #3
0
    /// <summary>
    /// Loads data of specific EventLog from DB.
    /// </summary>
    protected void LoadData()
    {
        EventLogInfo ev = EventInfo;

        //Set edited object
        EditedObject = ev;

        if (ev != null)
        {
            // Rewrite event type text.
            lblEventTypeValue.Text = EventLogHelper.GetEventTypeText(ev.EventType);
            lblEventIDValue.Text   = ev.EventID.ToString();
            lblEventTimeValue.Text = ev.EventTime.ToString();
            lblSourceValue.Text    = HTMLHelper.HTMLEncode(ev.Source);
            lblEventCodeValue.Text = HTMLHelper.HTMLEncode(ev.EventCode);

            lblUserIDValue.Text = ev.UserID.ToString();
            plcUserID.Visible   = (ev.UserID > 0);

            lblUserNameValue.Text = HTMLHelper.HTMLEncode(Functions.GetFormattedUserName(ev.UserName));
            plcUserName.Visible   = !string.IsNullOrEmpty(lblUserNameValue.Text);

            lblIPAddressValue.Text = ev.IPAddress;

            lblNodeIDValue.Text = ev.NodeID.ToString();
            plcNodeID.Visible   = (ev.NodeID > 0);

            lblNodeNameValue.Text = HTMLHelper.HTMLEncode(ev.DocumentName);
            plcNodeName.Visible   = !string.IsNullOrEmpty(lblNodeNameValue.Text);

            string description = HTMLHelper.StripTags(ev.EventDescription.Replace("<br />", "\r\n").Replace("<br/>", "\r\n"));
            lblEventDescriptionValue.Text = HTMLHelper.EnsureLineEnding(HTMLHelper.HTMLEncode(description), "<br />");

            if (ev.SiteID > 0)
            {
                SiteInfo si = SiteInfoProvider.GetSiteInfo(ev.SiteID);
                if (si != null)
                {
                    lblSiteNameValue.Text = HTMLHelper.HTMLEncode(si.DisplayName);
                }
            }
            else
            {
                plcSite.Visible = false;
            }

            lblMachineNameValue.Text = HTMLHelper.HTMLEncode(ev.EventMachineName);
            lblEventUrlValue.Text    = HTMLHelper.HTMLEncode(ev.EventUrl);
            lblUrlReferrerValue.Text = HTMLHelper.HTMLEncode(ev.EventUrlReferrer);
            lblUserAgentValue.Text   = HTMLHelper.HTMLEncode(ev.EventUserAgent);
        }
    }
Example #4
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        // Initialize filter dropdownlist
        if (!RequestHelper.IsPostBack())
        {
            if (drpType.Items.Count <= 0)
            {
                drpType.Items.Add(new ListItem(GetString("general.selectall"), ""));
                foreach (string eventType in new string[] { "e", "i", "w" })
                {
                    drpType.Items.Add(new ListItem(EventLogHelper.GetEventTypeText(eventType), eventType));
                }
            }
            this.drpType.SelectedValue = mSelectedValue;
        }
    }
    protected object gridEvents_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        switch (sourceName)
        {
        case "eventtype":
        {
            string evetType = ValidationHelper.GetString(parameter, "");
            return("<div style=\"width:100%;text-align:center;cursor:help;\" title=\"" + HTMLHelper.HTMLEncode(EventLogHelper.GetEventTypeText(evetType)) + "\">" + evetType + " </div>");
        }

        case "formattedusername":
            return(HTMLHelper.HTMLEncode(Functions.GetFormattedUserName(Convert.ToString(parameter))));

        case "view":
        {
            if (sender is CMSGridActionButton)
            {
                CMSGridActionButton img = sender as CMSGridActionButton;
                DataRowView         drv = UniGridFunctions.GetDataRowView(img.Parent as DataControlFieldCell);
                int eventId             = ValidationHelper.GetInteger(drv["EventID"], 0);
                //img.AlternateText = GetString("Unigrid.EventLog.Actions.Display");
                img.ToolTip       = GetString("Unigrid.EventLog.Actions.Display");
                img.OnClientClick = "eventDialogParams_" + ClientID + " = '" + eventId + "';" + Page.ClientScript.GetCallbackEventReference(this, "eventDialogParams_" + ClientID, "OpenEventDetail", null) + ";return false;";
            }
            return(sender);
        }
        }

        return(parameter);
    }