Example #1
0
        private void HandleNewReport(ITrackingReport report)
        {
            if (report.Code == "xx")
            {
                TrackingService.AppendLog("do not send report to xx");
                return;
            }

            TrackingService.AppendLog("generating mail");

            var messageLines = new List <String>();

            messageLines.Add($"Login code '{report.Code}' from: {report.Ip} at {report.StartTime} for {FormatDuration(report.Duration)}");
            messageLines.Add(String.Empty);
            messageLines.AddRange(report.Topics.Select(x => $"{x.Url}/{x.TopicDetail}/{x.Title} for { FormatDuration(x.ImpressionTimeSpan)}"));

            var mail = new MailMessage("*****@*****.**", "*****@*****.**");

            mail.Subject = $"CV report for {report.Code}, duration {report.Duration}";

            mail.Body       = String.Join("\r\n", messageLines);
            mail.IsBodyHtml = false;
            var client = new SmtpClient("mrxn.de", 587);

            client.Send(mail);

            TrackingService.AppendLog("mail sent");
        }
Example #2
0
            public void RecordUrl(UrlTrackingEvent urlTrackingEvent)
            {
                this.urlTrackEvents.Add(Tuple.Create(this.timeSource.Now, urlTrackingEvent));
                this.IsDirty = true;

                var lineText = DateTime.Now.ToString() + $" ({this.Code}/{this.ip}): {urlTrackingEvent.Url}/{urlTrackingEvent.Detail}";

                TrackingService.AppendLog(lineText);
            }
Example #3
0
            public void RecordTopics(TrackTopicsEvent e)
            {
                this.topicEvents.Add(Tuple.Create(this.timeSource.Now, e));
                this.IsDirty = true;

                var topics   = String.Join(",", e.Topics.Select(x => x.Topic + FormatVisibility(x)));
                var lineText = DateTime.Now.ToString() + $" ({this.Code}/{this.ip}): {e.Url}/{e.Detail} {topics}";

                TrackingService.AppendLog(lineText);
            }