Ejemplo n.º 1
0
 public static void writeEvent(LMComDataContext ctx, WebBaseEvent ev) {
   EventsLog log = new EventsLog();
   ctx.EventsLogs.InsertOnSubmit(log);
   if (ev is CommerceEvent)
     log.Type = (short)EventCategory.Commerce;
   else if (ev is MailEvent)
     log.Type = (short)EventCategory.Mail;
   else if (ev is ErrorEvent)
     log.Type = (short)EventCategory.Error;
   else if (ev is TraceEvent)
     log.Type = (short)EventCategory.Trace;
   else if (ev is WebBaseErrorEvent)
     log.Type = (short)EventCategory.WebError;
   else if (ev is IntranetEvent)
     log.Type = (short)EventCategory.Intranet;
   else if (ev is SeznamRpcEvent)
     log.Type = (short)EventCategory.SeznamRPC;
   else if (ev is DownloadEvent)
     log.Type = (short)EventCategory.DownloadMP3;
   //else if (ev is DownloadMoodleEvent)
   //  log.Type = (short)EventCategory.DownloadMoodle;
   else if (ev is DebugEvent)
     log.Type = (short)EventCategory.debug;
   //else if (ev is PayPalEvent)
     //log.Type = (short)EventCategory.PayPal;
   else
     log.Type = (short)EventCategory.no;
   log.UtcTime = ev.EventTimeUtc;
   log.Code = ev.EventCode;
   log.DetailCode = ev.EventDetailCode;
   log.Message = ev.Message != null && ev.Message.Length > 1024 ? ev.Message.Substring(0, 1024) : ev.Message;
   log.MachineName = System.Environment.MachineName;
   string det = ev.ToString();
   if (ev is LMEvent) {
     LMEvent lme = (LMEvent)ev;
     if (lme.info != null) {
       log.App = (short)lme.info.AppId;
       log.Site = (short)lme.info.SiteId;
     }
     if (lme.cook != null && lme.cook.id > 0)
       log.UserId = lme.cook.id;
     if (ev is CommerceEvent)
       log.OrderId = ((CommerceEvent)ev).OrderId;
     if (ev is MailEvent)
       log.OrderId = ((MailEvent)ev).OrderId;
     if (lme.RequestUrl != null)
       log.RequestUrl = lme.RequestUrl!=null && lme.RequestUrl.Length>1024 ? lme.RequestUrl.Substring(0, 1024) : lme.RequestUrl;
     if (ev is PayPalEvent)
       log.OrderId = ((PayPalEvent)ev).OrderId;
   } else {
     LMCookie cook = LMStatus.CookieLow;
     if (cook != null)
       log.UserId = cook.id;
     if (HttpContext.Current != null)
       log.RequestUrl = HttpContext.Current.Request.Url.AbsolutePath;
   }
   log.Details = det;// != null && det.Length > 500 ? det.Substring(0, 500) : det;
 }
Ejemplo n.º 2
0
 public static void writeEvent(LMComDataContext ctx, WebBaseEvent ev) { }