Exemplo n.º 1
0
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        this.Visible = false;

        if (this.Log != null)
        {
            this.Visible = true;

            // Log request values
            RequestHelper.LogRequestValues(true, true, true);

            if (this.Log.ValueCollections != null)
            {
                this.tblResC.Title = GetString("RequestLog.ResponseCookies");
                this.tblResC.Table = this.Log.ValueCollections.Tables["ResponseCookies"];

                this.tblReqC.Title = GetString("RequestLog.RequestCookies");
                this.tblReqC.Table = this.Log.ValueCollections.Tables["RequestCookies"];

                this.tblVal.Title = GetString("RequestLog.Values");
                this.tblVal.Table = this.Log.ValueCollections.Tables["Values"];
            }

            // Get the log table
            DataTable dt = this.Log.LogTable;
            if (!DataHelper.DataSourceIsEmpty(dt))
            {
                RequestProcessLog.EnsureDurationColumn(dt);

                gridCache.Columns[1].HeaderText = GetString("RequestLog.Operation");
                gridCache.Columns[2].HeaderText = GetString("RequestLog.Parameter");
                gridCache.Columns[3].HeaderText = GetString("RequestLog.FromStart");
                gridCache.Columns[4].HeaderText = GetString("RequestLog.Duration");

                if (LogStyle != "")
                {
                    this.ltlInfo.Text = "<div style=\"padding: 2px; font-weight: bold; background-color: #eecccc; border-bottom: solid 1px #ff0000;\">" + GetString("RequestLog.Info") + "</div>";
                }

                this.MaxDuration = DataHelper.GetMaximumValue <double>(dt, "Duration");

                // Bind the data
                gridCache.DataSource = dt;
                gridCache.DataBind();
            }
        }
    }
    protected void ReloadData()
    {
        if (!RequestHelper.DebugRequests)
        {
            this.lblInfo.Text = GetString("DebugRequests.NotConfigured");
        }
        else
        {
            this.plcLogs.Controls.Clear();

            for (int i = RequestHelper.LastLogs.Count - 1; i >= 0; i--)
            {
                try
                {
                    // Get the log
                    RequestLog log = (RequestLog)RequestHelper.LastLogs[i];
                    if (log != null)
                    {
                        // Load the table
                        DataTable dt = log.LogTable;
                        if (!DataHelper.DataSourceIsEmpty(dt))
                        {
                            // Load the control
                            RequestProcessLog logCtrl = (RequestProcessLog)LoadControl("~/CMSAdminControls/Debug/RequestLog.ascx");
                            logCtrl.ID = "requestLog";
                            logCtrl.EnableViewState = false;
                            logCtrl.Log             = log;
                            logCtrl.LogStyle        = "";

                            // Add to the output
                            this.plcLogs.Controls.Add(new LiteralControl("<div>&lrm;<strong>&nbsp;" + GetRequestLink(log.RequestURL, log.RequestGUID) + "</strong> (" + log.RequestTime.ToString("hh:mm:ss") + ")&lrm;<br /><br />"));
                            this.plcLogs.Controls.Add(logCtrl);
                            this.plcLogs.Controls.Add(new LiteralControl("</div><br /><br />"));

                            logs.Add(logCtrl);
                        }
                    }
                }
                catch //(Exception ex)
                {
                }
            }
        }
    }