예제 #1
0
        public void Log(Crash crash)
        {
            Application application = this.applicationRepository.Find(crash.ApplicationId);

            if (application != null)
            {
                DeviceInfo device = this.deviceRepository.Find(crash.DeviceId);

                if (device != null)
                {
                    string lastScreenBeforeCrash      = null;
                    DeviceAppLastScreen appLastScreen =
                        this.eventRepository.GetDeviceAppLastScreenOneBy(crash.DeviceId, crash.ApplicationId);

                    if (appLastScreen != null)
                    {
                        lastScreenBeforeCrash = appLastScreen.ScreenName;
                    }

                    crash.Add(device, lastScreenBeforeCrash);

                    CrashSummary crashSummary = new CrashSummary(crash);

                    this.crashRepository.Save(crash);
                    this.crashRepository.Save(crashSummary);
                }
                else
                {
                    throw new NoDeviceException(crash.DeviceId);
                }
            }
            else
            {
                throw new InactiveApplicationException(crash.ApplicationId);
            }
        }
예제 #2
0
 public void Save(DeviceAppLastScreen deviceAppLastScreen)
 {
     this.eventMapper.Save(deviceAppLastScreen);
 }
예제 #3
0
        public void Log(Event eventItem)
        {
            Application application = this.applicationRepository.Find(eventItem.ApplicationId);

            if (application != null)
            {
                DeviceInfo device = this.deviceRepository.Find(eventItem.DeviceId);

                if (device != null)
                {
                    eventItem.PlatformId = device.PlatformType;

                    switch (eventItem.EventTypeId)
                    {
                    case EventType.ApplicationOpen:
                        Nullable <DateTime> lastDeviceVisit = this.eventRepository
                                                              .GetDateOfDeviceLastVisit(eventItem.DeviceId, eventItem.ApplicationId);

                        AppUsageSummary appUsageSummary = new AppUsageSummary(eventItem, lastDeviceVisit);
                        this.eventRepository.Save(appUsageSummary);
                        break;

                    case EventType.ApplicationClose:
                        AppUsageDurationSummary appUsageSum = new AppUsageDurationSummary(eventItem);
                        this.eventRepository.Save(appUsageSum);

                        DeviceAppLastScreen appLastScreen =
                            this.eventRepository.GetDeviceAppLastScreenOneBy(eventItem.DeviceId, eventItem.ApplicationId);

                        if (appLastScreen != null)
                        {
                            ScreenRouteSummary routeSum =
                                new ScreenRouteSummary(eventItem, appLastScreen.ScreenName, string.Empty);

                            this.eventRepository.Save(routeSum);
                            this.eventRepository.Remove(eventItem.DeviceId, eventItem.ApplicationId);
                        }
                        break;

                    case EventType.Event:
                        EventSummary eventSum = new EventSummary(eventItem);
                        this.eventRepository.Save(eventSum);
                        break;

                    case EventType.ScreenClose:
                        ScreenSummary screenUsageSum = new ScreenSummary(eventItem);
                        this.eventRepository.Save(screenUsageSum);
                        this.eventRepository.Remove(eventItem.DeviceId, eventItem.ApplicationId);
                        this.eventRepository.Save(new DeviceAppLastScreen(eventItem));
                        break;

                    case EventType.ScreenOpen:
                        DeviceAppLastScreen lastScreen =
                            this.eventRepository.GetDeviceAppLastScreenOneBy(eventItem.DeviceId, eventItem.ApplicationId);

                        ScreenRouteSummary routeSum2 = new ScreenRouteSummary(eventItem, string.Empty, eventItem.ScreenName);

                        if (lastScreen != null)
                        {
                            if (lastScreen.SessionId == eventItem.SessionId)
                            {
                                routeSum2 = new ScreenRouteSummary(eventItem, lastScreen.ScreenName, eventItem.ScreenName);
                            }

                            this.eventRepository.Remove(eventItem.DeviceId, eventItem.ApplicationId);
                        }

                        this.eventRepository.Save(routeSum2);
                        this.eventRepository.Save(new DeviceAppLastScreen(eventItem));
                        break;

                    case EventType.ContentLoaded:
                        ContentLoadSummary contentSum = new ContentLoadSummary(eventItem);
                        this.eventRepository.Save(contentSum);
                        break;
                    }

                    if (this.settings.DataLoggingRecordRaw)
                    {
                        this.eventRepository.Save(eventItem);
                    }
                }
                else
                {
                    throw new NoDeviceException(eventItem.DeviceId);
                }
            }
            else
            {
                throw new InactiveApplicationException(eventItem.ApplicationId);
            }
        }
 public void Save(DeviceAppLastScreen deviceAppLastScreen)
 {
     base.Save(deviceAppLastScreen);
 }