private void TraceRequest(XElement traceXml)
        {
            var parametersXml = new XElement("Root");

            this.WriteParameters(parametersXml);

            WebInitializer.Initialize();
            using (var db = new DBTraceTimingRequestsDataContext(SpecificInstances.DbFactory.CreateConnection()))
            {
                var page      = string.Empty;
                var tableName = string.Empty;
                var pageType  = string.Empty;
                var traceKey  = (Guid?)HttpContext.Current.Items["TraceTimingRegeusts.TraceKey"];
                if (traceKey == null)
                {
                    traceKey = Guid.NewGuid();
                }
                long?id    = null;
                var  match = pageRegex.Match(HttpContext.Current.Request.Url.AbsolutePath);
                if (match.Success)
                {
                    page = match.Value;
                }
                match = tableNameAndPageTypeRegex.Match(HttpContext.Current.Request.Url.AbsolutePath);
                if (match.Success)
                {
                    if (match.Groups["TableName"].Success)
                    {
                        tableName = match.Groups["TableName"].Value;
                    }
                    if (match.Groups["PageType"].Success)
                    {
                        pageType = match.Groups["PageType"].Value;
                    }
                }

                var personInfo = User.GetPersonInfo();
                db.P_LOG_InsertTraceTimingRequest(
                    page,
                    HttpContext.Current.Request.Url.ToString(),
                    HttpContext.Current.Timestamp,
                    (DateTime.Now.Ticks - HttpContext.Current.Timestamp.Ticks) / 10000,
                    User.GetSID(),
                    personInfo?.refRegion,
                    tableName,
                    HttpContext.Current.Request.QueryString["mode"],
                    pageType,
                    parametersXml,
                    traceXml,
                    traceKey,
                    ref id);
            }
        }
        public void TraceDestination(string key)
        {
            if (string.IsNullOrEmpty(key))
            {
                return;
            }
            var guid = new Guid(key);

            if (HttpContext.Current.Session[guid.ToString("N")] == null)
            {
                return;
            }
            var dateTime = (DateTime)HttpContext.Current.Session[guid.ToString("N")];

            WebInitializer.Initialize();
            using (var db = new DBTraceTimingRequestsDataContext(SpecificInstances.DbFactory.CreateConnection()))
                db.P_LOG_UpdateTraceTimingRequest(guid, (DateTime.Now.Ticks - dateTime.Ticks) / 10000);
            HttpContext.Current.Session.Remove(guid.ToString("N"));
        }