Пример #1
0
        /// <summary>
        /// Method LogGNGJoinEvent logs when a user joins an event to partake in. The log
        /// tracks the event ID and the user who attempts to join the event. If the log was failed to be made,
        /// it will increment the errorCounter.
        /// </summary>
        /// <param name="usersID">User ID of the person attempting to join event</param>
        /// <param name="eventID">Event ID</param>
        /// <param name="ip">IP Address</param>
        /// <returns>Returns true or false if the log was successfully made</returns>
        public bool LogGNGJoinEvent(string usersID, int eventID, string ip)
        {
            _gngLoggerService.CreateNewLog(logFileName, configurations.GetLogDirectory());
            var logMade = false;
            var log     = new GNGLog
            {
                LogID       = "EventJoined",
                UserID      = usersID,
                IpAddress   = ip,
                DateTime    = DateTime.UtcNow.ToString(),
                Description = "User " + usersID + " joined Event " + eventID
            };

            logList = _gngLoggerService.FillCurrentLogsList();
            logList.Add(log);

            logMade = _gngLoggerService.WriteGNGLogToFile(logList);

            return(logMade);
        }
Пример #2
0
        /// <summary>
        /// Method LogEntryToWebsite logs when a user first enters GreetNGroup. The log
        /// will keep track of the url that the user landed on as an entrypoint. If the log was failed to be made,
        /// it will increment the errorCounter.
        /// </summary>
        /// <param name="usersID">user ID (empty if not a registered user)</param>
        /// <param name="urlEntered">URL entry point</param>
        /// <param name="ip">IP Address</param>
        /// <returns>Returns true or false if log was successfully made</returns>
        public bool LogEntryToWebsite(string usersID, string urlEntered, string ip)
        {
            var fileName = DateTime.UtcNow.ToString(configurations.GetDateTimeFormat()) + configurations.GetLogExtention();

            _gngLoggerService.CreateNewLog(fileName, configurations.GetLogDirectory());
            var logMade = false;
            var log     = new GNGLog
            {
                LogID       = "EntryToWebsite",
                UserID      = usersID,
                IpAddress   = ip,
                DateTime    = DateTime.UtcNow.ToString(),
                Description = "User " + usersID + " entered at " + urlEntered
            };
            var logList = _gngLoggerService.FillCurrentLogsList();

            logList.Add(log);

            logMade = _gngLoggerService.WriteGNGLogToFile(logList);

            return(logMade);
        }