public async Task AddSiteCreateLogAsync(int siteId, int channelId, int contentId, Administrator adminInfo, string ipAddress, string filePath) { var config = await _configRepository.GetAsync(); if (!config.IsLogSite || !config.IsLogSiteCreate) { return; } try { await DeleteIfThresholdAsync(); var siteLogInfo = new SiteLog { Id = 0, SiteId = siteId, ChannelId = channelId, ContentId = contentId, AdminId = adminInfo.Id, IpAddress = ipAddress, Action = Constants.ActionsCreate, Summary = filePath }; await InsertAsync(siteLogInfo); } catch (Exception ex) { await _errorLogRepository.AddErrorLogAsync(ex); } }
public void OnException(ExceptionContext filterContext) { SiteLogManager siteLogManager = new SiteLogManager(); filterContext.ExceptionHandled = true; string exeption = filterContext.Exception.Message; SiteLog siteLog = new SiteLog(); siteLog.ActionName = filterContext.RouteData.Values["action"].ToString(); siteLog.ControllerName = filterContext.RouteData.Values["controller"].ToString(); if (CurrentSession.shareBookUser != null) { siteLog.Username = CurrentSession.shareBookUser.Username; } else { siteLog.Username = "******"; } siteLog.LogDate = DateTime.Now; siteLog.Info = "Site Error :" + exeption; siteLogManager.Insert(siteLog); filterContext.Result = new RedirectResult("/Home/ErrorPage"); }
private void _timerTick(object sender, EventArgs e) { if (FetchContent.GetPageHash(osoite) != contentToBeChecked) { string message = osoite + " was checked at " + DateTime.Now.ToString("h:mm:ss tt") + " and the site has updates \n"; SiteLog.Text += message; if (writeToFile) { WriteLogs(message); } this.nIcon.ShowBalloonTip(5000, osoite, "Changes have been found", ToolTipIcon.Info); StopTimer(); } else { string message = osoite + " was checked at " + DateTime.Now.ToString("h:mm:ss tt") + " and there was no changes \n"; SiteLog.Text += message; if (writeToFile) { WriteLogs(message); } lines++; if (lines > 15) { SiteLog.Text = SiteLog.Text.Substring(lineLength, SiteLog.Text.Length - lineLength); } } SiteLog.ScrollToEnd(); }
private object GetLog(dynamic parameters) { SiteLog siteLog = this._siteLogRepository.GetSiteLog(parameters.SiteId); logManager.Write($"[GET]-> GetLog Id: {siteLog.SiteId}"); return(Response.AsJson(siteLog)); }
private object PostLog(dynamic parameters) { SiteLog newLog = this.Bind <SiteLog>(); int result = _siteLogRepository.PostSiteLog(newLog); logManager.Write($"[POST]-> PostLog Id: {result}"); return(Response.AsJson(result)); }
public async Task AddSiteLogAsync(int siteId, int channelId, int contentId, Administrator adminInfo, string ipAddress, string action, string summary) { var config = await _configRepository.GetAsync(); if (!config.IsLogSite) { return; } if (siteId <= 0) { await _logRepository.AddAdminLogAsync(adminInfo, ipAddress, action, summary); } else { try { await DeleteIfThresholdAsync(); if (!string.IsNullOrEmpty(action)) { action = StringUtils.MaxLengthText(action, 250); } if (!string.IsNullOrEmpty(summary)) { summary = StringUtils.MaxLengthText(summary, 250); } if (channelId < 0) { channelId = -channelId; } var siteLogInfo = new SiteLog { Id = 0, SiteId = siteId, ChannelId = channelId, ContentId = contentId, AdminId = adminInfo.Id, IpAddress = ipAddress, Action = action, Summary = summary }; await InsertAsync(siteLogInfo); await _administratorRepository.UpdateLastActivityDateAsync(adminInfo); } catch (Exception ex) { await _errorLogRepository.AddErrorLogAsync(ex); } } }
public static void LoqReq(System.Web.HttpRequest Request) { var db = DBService.Data; var rec = new SiteLog(); var addr = Request.ServerVariables["REMOTE_ADDR"]; var user = Request.ServerVariables["HTTP_USER_AGENT"]; var referer = Request.ServerVariables["http_referer"]; string RawUrl = Request.RawUrl; rec.ReqestIp = addr; rec.Date = DateTime.Now; rec.UserAgent = CheckLen(user, 130); rec.RequestedUrl = CheckLen(RawUrl, 100); rec.Referer = CheckLen(referer, 200); db.Insert(rec); }
public static void LogSiteAction(HttpRequestBase request, NTGPrincipal user, string action, int?pageId, string pageName, int?moduleId, string moduleType, NTGDBTransactional transaction = null) { try { var log = new SiteLog { AdminId = user.Id, Date = DateTime.UtcNow, Action = action, IPAddress = HttpContext.Current.Request.UserHostAddress, Page = pageId != null ? ((!string.IsNullOrEmpty(pageName) ? "Page: " + pageName + ", " : string.Empty) + "Id:" + pageId) : string.Empty, Module = moduleId != null ? ((!string.IsNullOrEmpty(moduleType) ? "Module: " + moduleType + ", " : string.Empty) + "Id:" + moduleId) : string.Empty, }; log.Save(transaction); } catch (Exception ex) { LogError(request, ex); } }
public int PostSiteLog(SiteLog siteLog) { return(DataVault .Post(DapperMethod.CoreServices.PostSiteEventLog, siteLog)); }
public static SiteLog PostSiteLog(SiteLog item) { return(WebOperations .WebPost(item, WebOperations.WebMethod.POST_TRANSACTION, _authToken)); }
public async Task InsertAsync(SiteLog log) { await _repository.InsertAsync(log); }