/// <summary>
 /// Deprecated Method for adding a new object to the SiteLogs EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSiteLogs(SiteLog siteLog)
 {
     base.AddObject("SiteLogs", siteLog);
 }
Beispiel #2
0
        public static void InsertLog(int _ClientHeight, int _ClientWidth, string _FileName, bool _Ajax)
        {
            try
            {

                string _Host = HttpContext.Current.Request.Url.Host;

                int _UserID = 0;
                HttpBrowserCapabilities r = HttpContext.Current.Request.Browser;
                if (HttpContext.Current.Session["UserID"] != null)
                {
                    _UserID = (int)HttpContext.Current.Session["UserID"];
                }
                using (EntitiesContext context = new EntitiesContext())
                {
                    DAL.SiteLog L = new DAL.SiteLog
                    {
                        PortalID = SiteLog.PortalID,
                        CreateDate = DateTime.Now,
                        UserID = _UserID,
                        Ajax = _Ajax,
                        Host = _Host,
                        FileName = _FileName.Replace("ACTION=", "/"),
                        RequestRequestType = HttpContext.Current.Request.RequestType,
                        RequestUserHostAddress = HttpContext.Current.Request.UserHostAddress,
                        RequestUserHostName = HttpContext.Current.Request.UserHostName,
                        RequestHttpMethod = HttpContext.Current.Request.HttpMethod,
                        ClientHeight = _ClientHeight,
                        ClientWidth = _ClientWidth,
                        Browser = r.Browser,
                        BrowserType = r.Type,
                        BrowserVersion = decimal.Parse(r.Version),
                        BrowserMajorVersion = r.MajorVersion,
                        BrowserPlatform = r.Platform,
                        BrowserCrawler = r.Crawler,
                        BrowserFrames = r.Frames,
                        BrowserTables = r.Tables,
                        BrowserCookies = r.Cookies,
                        BrowserVBScript = r.VBScript,
                        BrowserEcmaScriptVersion = decimal.Parse(r.EcmaScriptVersion.ToString()),
                        BrowserJavaApplets = r.JavaApplets,
                        BrowserActiveXControls = r.ActiveXControls,
                        BrowserJavaScriptVersion = decimal.Parse(r["JavaScriptVersion"])
                    };
                    context.SiteLogs.AddObject(L);
                    context.SaveChanges();
                }

            }
            catch (Exception ex)
            {
                ElmahExtension.LogToElmah(ex);
            }
        }
 /// <summary>
 /// Create a new SiteLog object.
 /// </summary>
 /// <param name="siteLogID">Initial value of the SiteLogID property.</param>
 /// <param name="createDate">Initial value of the CreateDate property.</param>
 /// <param name="portalID">Initial value of the PortalID property.</param>
 public static SiteLog CreateSiteLog(global::System.Int32 siteLogID, global::System.DateTime createDate, global::System.Int32 portalID)
 {
     SiteLog siteLog = new SiteLog();
     siteLog.SiteLogID = siteLogID;
     siteLog.CreateDate = createDate;
     siteLog.PortalID = portalID;
     return siteLog;
 }