public async Task AddWatchingTest()
        {
            const string eventId   = "eventId";
            const string projectId = "projectId";
            var          dateTime  = new DateTime(2013, 2, 13);

            var domain            = new DomainActionData();
            var httpMessageEntity = new StatHttpMessageV2Entity();
            var watchingEntity    = new StatWatchingV2Entity();

            var guidWrapper           = new Mock <IGuidWrapper>();
            var dateTimeWrapper       = new Mock <IDateTimeWrapper>();
            var httpMessageRepository = new Mock <IRepository <StatHttpMessageV2Entity> >();
            var watchingRepository    = new Mock <IRepository <StatWatchingV2Entity> >();
            var repositoryFactory     = new Mock <IRepositoryFactory>();
            var statEntityFactory     = new Mock <IStatEntityFactory>();

            guidWrapper.Setup(m => m.Generate()).Returns(eventId);
            dateTimeWrapper.Setup(m => m.CurrentDateTime()).Returns(dateTime);

            repositoryFactory.Setup(m => m.Create <StatHttpMessageV2Entity>(Tables.StatHttpMessageV2)).Returns(httpMessageRepository.Object);
            repositoryFactory.Setup(m => m.Create <StatWatchingV2Entity>(Tables.StatWatchingV2)).Returns(watchingRepository.Object);

            statEntityFactory.Setup(m => m.CreateHttpMessageEntity(eventId, dateTime, domain)).Returns(httpMessageEntity);
            statEntityFactory.Setup(m => m.CreateWatchingEntity(eventId, dateTime, domain, projectId)).Returns(watchingEntity);
            httpMessageRepository.Setup(m => m.AddAsync(httpMessageEntity, It.IsAny <CancellationToken>())).Returns(async() => httpMessageEntity);
            watchingRepository.Setup(m => m.AddAsync(watchingEntity, It.IsAny <CancellationToken>())).Returns(async() => watchingEntity);

            var watchingService = new StatWatchingService(repositoryFactory.Object, statEntityFactory.Object, guidWrapper.Object, dateTimeWrapper.Object);

            //Act & Assert
            await watchingService.AddWatching(domain, projectId);
        }
Exemple #2
0
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            base.OnActionExecuted(filterContext);

            if (filterContext == null)
            {
                Trace.TraceError("StatUserRegistrationMvcAttribute: an ActionExecutedContext is NULL.");
                return;
            }

            if (!(filterContext.Result is RedirectToRouteResult || filterContext.Result is RedirectResult))
            {
                return;
            }

            bool isRegister = filterContext.HttpContext.Items.Contains("isRegister");

            if (!isRegister)
            {
                return;
            }

            try
            {
                string           userAgent  = filterContext.HttpContext.Request.UserAgent;
                int              statusCode = filterContext.HttpContext.Response.StatusCode;
                DomainActionData actionData = ActionDataService.GetActionData(userAgent, statusCode);

                this.Publish(new UserRegistrationEventArg(actionData).AsTask());
            }
            catch (Exception ex)
            {
                Trace.TraceError("Failed to log user registration: {0}", ex);
            }
        }
        public async Task AddUserLoginTest()
        {
            //Arrange
            const string eventId  = "eventId";
            var          dateTime = new DateTime(2013, 2, 13);

            var domain            = new DomainActionData();
            var httpMessageEntity = new StatHttpMessageV2Entity();
            var userLoginEntity   = new StatUserLoginV2Entity();

            var guidWrapper           = new Mock <IGuidWrapper>();
            var dateTimeWrapper       = new Mock <IDateTimeWrapper>();
            var httpMessageRepository = new Mock <IRepository <StatHttpMessageV2Entity> >();
            var userLoginRepository   = new Mock <IRepository <StatUserLoginV2Entity> >();
            var repositoryFactory     = new Mock <IRepositoryFactory>();
            var statEntityFactory     = new Mock <IStatEntityFactory>();

            guidWrapper.Setup(m => m.Generate()).Returns(eventId);
            dateTimeWrapper.Setup(m => m.CurrentDateTime()).Returns(dateTime);

            repositoryFactory.Setup(m => m.Create <StatHttpMessageV2Entity>(Tables.StatHttpMessageV2)).Returns(httpMessageRepository.Object);
            repositoryFactory.Setup(m => m.Create <StatUserLoginV2Entity>(Tables.StatUserLoginV2)).Returns(userLoginRepository.Object);

            statEntityFactory.Setup(m => m.CreateHttpMessageEntity(eventId, dateTime, domain)).Returns(httpMessageEntity);
            statEntityFactory.Setup(m => m.CreateUserLoginEntity(eventId, dateTime, domain)).Returns(userLoginEntity);
            httpMessageRepository.Setup(m => m.AddAsync(httpMessageEntity, It.IsAny <CancellationToken>())).Returns(async() => httpMessageEntity);
            userLoginRepository.Setup(m => m.AddAsync(userLoginEntity, It.IsAny <CancellationToken>())).Returns(async() => userLoginEntity);

            var userRegistrationService = new StatUserLoginService(repositoryFactory.Object, statEntityFactory.Object, guidWrapper.Object, dateTimeWrapper.Object);

            //Act & Assert
            await userRegistrationService.AddUserLogin(domain);
        }
        public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
        {
            base.OnActionExecuted(actionExecutedContext);

            if (!CheckActionContext(actionExecutedContext, "StatUserRegistrationWebApiAttribute"))
            {
                return;
            }

            if (actionExecutedContext.Response.StatusCode != HttpStatusCode.Created)
            {
                return;
            }

            try
            {
                string           userAgent  = actionExecutedContext.Request.Headers.UserAgent.ToString();
                HttpStatusCode   statusCode = actionExecutedContext.Response.StatusCode;
                DomainActionData actionData = ActionDataService.GetActionData(userAgent, (int)statusCode);

                this.Publish(new UserRegistrationEventArg(actionData).AsTask());
            }
            catch (Exception ex)
            {
                Trace.TraceError("Failed to log use registration: {0}", ex);
            }
        }
        public void AddProjectCreatingCatchConflictExceptionTest()
        {
            const string projectId  = "projectId";
            const string actionType = "actionType";
            var          dateTime   = new DateTime(2013, 2, 13);

            var domain = new DomainActionData();
            var statProjectStateV2Entity = new StatProjectStateV3Entity();

            var dateTimeWrapper            = new Mock <IDateTimeWrapper>();
            var statProjectStateRepository = new Mock <IRepository <StatProjectStateV3Entity> >();
            var repositoryFactory          = new Mock <IRepositoryFactory>();
            var statEntityFactory          = new Mock <IStatEntityFactory>();

            dateTimeWrapper.Setup(m => m.CurrentDateTime()).Returns(dateTime);

            repositoryFactory.Setup(m => m.Create <StatProjectStateV3Entity>(Tables.StatProjectStateV3)).Returns(statProjectStateRepository.Object);

            statEntityFactory.Setup(m => m.CreateProjectCreatingEntity(dateTime, domain, projectId, actionType)).Returns(statProjectStateV2Entity);
            statProjectStateRepository.Setup(m => m.AddAsync(statProjectStateV2Entity, It.IsAny <CancellationToken>())).Throws(new ConflictException());

            var statProjectCreatingService = new StatProjectStateService(repositoryFactory.Object, statEntityFactory.Object, dateTimeWrapper.Object);

            //Act & Assert
            ExceptionAssert.NotThrows <ConflictException>(() => statProjectCreatingService.AddProjectState(domain, projectId, actionType).Wait());
        }
        public void LogProjectUploadingTest()
        {
            //Arrange
            const string         projectId      = "projectId";
            const string         projectName    = "projectName";
            const ProjectType    projectType    = ProjectType.Tag;
            const ProjectSubtype projectSubtype = ProjectSubtype.Friend;

            var timeSpan     = new DateTime(2013, 7, 16);
            var actionDomain = new DomainActionData();
            var project      = new FakeDomainStatProject();

            var eventLogger       = new Mock <IEventLogger>();
            var statDomainFactory = new Mock <IStatDomainFactory>();
            var dateTimeWrapper   = new Mock <IDateTimeWrapper>();

            var projectUploadingEventService = new ProjectUploadingEventService(eventLogger.Object, statDomainFactory.Object, dateTimeWrapper.Object);

            statDomainFactory.Setup(m => m.CreateProject(actionDomain, projectId, projectName, projectType.ToString(), projectSubtype.ToString())).Returns(project);
            dateTimeWrapper.Setup(m => m.CurrentDateTime()).Returns(timeSpan);

            //Act
            projectUploadingEventService.LogProjectUploading(actionDomain, projectId, projectName, projectType, projectSubtype);

            //Assert
            eventLogger.Verify(m => m.TrackProjectUploadingEvent(project, timeSpan), Times.Once());
        }
 public ProjectUploadingEventArg(DomainActionData actionData, string projectId, string projectName, ProjectType projectType, ProjectSubtype projectSubtype)
     : base(actionData)
 {
     ProjectId      = projectId;
     ProjectName    = projectName;
     ProjectType    = projectType;
     ProjectSubtype = projectSubtype;
 }
        public Task AddProjectUploading(DomainActionData actionData, string projectId, string projectName, ProjectType projectType, ProjectSubtype projectSubtype)
        {
            string   eventId     = GuidWraper.Generate();
            DateTime curDateTime = DateTimeWrapper.CurrentDateTime();

            StatProjectUploadingV2Entity projectUploadingEntity = StatEntityFactory.CreateProjectUploadingEntity(eventId, curDateTime, actionData, projectId, projectName, projectType, projectSubtype);
            ITableRepository <StatProjectUploadingV2Entity> projectUploadingRepository = RepositoryFactory.Create <StatProjectUploadingV2Entity>();

            return(projectUploadingRepository.AddAsync(projectUploadingEntity));
        }
Exemple #9
0
        public Task AddUserRegistration(DomainActionData domain)
        {
            string   eventId     = GuidWraper.Generate();
            DateTime curDateTime = DateTimeWrapper.CurrentDateTime();

            StatUserRegistrationV2Entity userRegistrationEntity = StatEntityFactory.CreateUserRegistrationEntity(eventId, curDateTime, domain);
            ITableRepository <StatUserRegistrationV2Entity> userRegistrationRepository = RepositoryFactory.Create <StatUserRegistrationV2Entity>();

            return(userRegistrationRepository.AddAsync(userRegistrationEntity));
        }
Exemple #10
0
        public Task AddProjectDeletion(DomainActionData domain, string projectId)
        {
            string   eventId     = GuidWraper.Generate();
            DateTime curDateTime = DateTimeWrapper.CurrentDateTime();

            StatProjectDeletionV2Entity statProjectDeletionEntity = StatEntityFactory.CreateProjectDeletionEntity(eventId, curDateTime, domain, projectId);
            ITableRepository <StatProjectDeletionV2Entity> projectDeletionRepository = RepositoryFactory.Create <StatProjectDeletionV2Entity>();

            return(projectDeletionRepository.AddAsync(statProjectDeletionEntity));
        }
        public Task AddWatching(DomainActionData domain, string projectId)
        {
            string   eventId     = GuidWraper.Generate();
            DateTime curDateTime = DateTimeWrapper.CurrentDateTime();

            StatWatchingV2Entity watchingEntity = StatEntityFactory.CreateWatchingEntity(eventId, curDateTime, domain, projectId);
            ITableRepository <StatWatchingV2Entity> watchingRepository = RepositoryFactory.Create <StatWatchingV2Entity>();

            return(watchingRepository.AddAsync(watchingEntity));
        }
        public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
        {
            base.OnActionExecuted(actionExecutedContext);

            if (!CheckActionContext(actionExecutedContext, "StatProjectExternalAttribute"))
            {
                return;
            }

            if (actionExecutedContext.Response.StatusCode != HttpStatusCode.Created)
            {
                return;
            }

            var objectContent = actionExecutedContext.Response.Content as ObjectContent;

            if (objectContent == null)
            {
                return;
            }

            var project = objectContent.Value as Project;

            if (project == null)
            {
                return;
            }

            bool isAvsx       = actionExecutedContext.Request.Properties.ContainsKey("isAvsx");
            bool isScreenshot = actionExecutedContext.Request.Properties.ContainsKey("isScreenshot");

            try
            {
                string           projectId  = project.Id;
                string           userAgent  = actionExecutedContext.Request.Headers.UserAgent.ToString();
                HttpStatusCode   statusCode = actionExecutedContext.Response.StatusCode;
                DomainActionData actionData = ActionDataService.GetActionData(userAgent, (int)statusCode);

                this.Publish(new StatProjectStateEventArg(actionData, projectId, StatActionType.Project).AsTask());
                this.Publish(new StatProjectStateEventArg(actionData, projectId, StatActionType.Video).AsTask());
                if (isAvsx)
                {
                    this.Publish(new StatProjectStateEventArg(actionData, projectId, StatActionType.Avsx).AsTask());
                }
                if (isScreenshot)
                {
                    this.Publish(new StatProjectStateEventArg(actionData, projectId, StatActionType.Screenshot).AsTask());
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError("Failed to log external project: {0}", ex);
            }
        }
        public StatUserLoginV2Entity CreateUserLoginEntity(DomainActionData domain)
        {
            string productName = _tableValueConverter.UserAgentToProductName(domain.UserAgent);

            return(new StatUserLoginV2Entity
            {
                IdentityProvider = domain.IdentityProvider,
                ProductName = productName,
                UserId = domain.UserId
            });
        }
        public async Task AddProjectState(DomainActionData domain, string projectId, string actionType)
        {
            DateTime curDateTime = _dateTimeWrapper.CurrentDateTime();

            StatProjectStateV3Entity statProjectStateEntity = _statEntityFactory.CreateProjectCreatingEntity(curDateTime, domain, projectId, actionType);
            ITableRepository <StatProjectStateV3Entity> statProjectStateRepository = _repositoryFactory.Create <StatProjectStateV3Entity>();

            try
            {
                await statProjectStateRepository.AddAsync(statProjectStateEntity);
            }
            catch (ConflictException)
            {
            }
        }
Exemple #15
0
        public void Initialize()
        {
            _domain = new DomainActionData()
            {
                UserAgent        = UserAgent,
                UserId           = UserId,
                UserEmail        = UserEmail,
                UserName         = UserName,
                IdentityProvider = IdentityProvider
            };

            _tableValueConverter = new Mock <ITableValueConverter>();
            _tableValueConverter.Setup(m => m.UserAgentToProductName(UserAgent)).Returns(ProductName);
            _tableValueConverter.Setup(m => m.UserAgentToVersion(UserAgent)).Returns(ProductVersion);
        }
Exemple #16
0
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            base.OnActionExecuted(filterContext);

            if (filterContext == null)
            {
                Trace.TraceError("StatWatchingMvcAttribute: an ActionExecutedContext is NULL.");
                return;
            }

            if (!(filterContext.Result is ViewResult))
            {
                return;
            }
            if ((filterContext.Result as ViewResult).Model == null)
            {
                return;
            }

            bool isReady = filterContext.HttpContext.Items.Contains("isReady") &&
                           (bool)filterContext.HttpContext.Items["isReady"];

            if (!isReady)
            {
                return;
            }

            ValueProviderResult result = filterContext.Controller.ValueProvider.GetValue("id");
            string projectId           = result != null ? result.RawValue as string : null;

            if (projectId == null)
            {
                return;
            }

            try
            {
                string           userAgent  = filterContext.HttpContext.Request.UserAgent;
                int              statusCode = filterContext.HttpContext.Response.StatusCode;
                DomainActionData actionData = ActionDataService.GetActionData(userAgent, statusCode);

                this.Publish(new WatchingEventArg(actionData, projectId).AsTask());
            }
            catch (Exception ex)
            {
                Trace.TraceError("Failed to log video watching: {0}", ex);
            }
        }
        public void Initialize()
        {
            var httpMessageEntity = new StatHttpMessageV2Entity();

            _dateTime              = new DateTime(2013, 2, 13);
            _domain                = new DomainActionData();
            _guidWrapper           = new Mock <IGuidWrapper>();
            _dateTimeWrapper       = new Mock <IDateTimeWrapper>();
            _httpMessageRepository = new Mock <IRepository <StatHttpMessageV2Entity> >();
            _statEntityFactory     = new Mock <IStatEntityFactory>();
            _repositoryFactory     = new Mock <IRepositoryFactory>();

            _httpMessageRepository.Setup(m => m.AddAsync(httpMessageEntity, It.IsAny <CancellationToken>())).Returns(async() => httpMessageEntity);
            _repositoryFactory.Setup(m => m.Create <StatHttpMessageV2Entity>(Tables.StatHttpMessageV2)).Returns(_httpMessageRepository.Object);
            _statEntityFactory.Setup(m => m.CreateHttpMessageEntity(EventId, _dateTime, _domain)).Returns(httpMessageEntity);
            _guidWrapper.Setup(m => m.Generate()).Returns(EventId);
            _dateTimeWrapper.Setup(m => m.CurrentDateTime()).Returns(_dateTime);
        }
        public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
        {
            base.OnActionExecuted(actionExecutedContext);

            if (!CheckActionContext(actionExecutedContext, "StatWatchingWebApiAttribute"))
            {
                return;
            }

            if (actionExecutedContext.Response.StatusCode != HttpStatusCode.OK)
            {
                return;
            }

            var isReady = (bool)actionExecutedContext.Request.Properties["isReady"];

            if (!isReady)
            {
                return;
            }

            object obj;

            actionExecutedContext.ActionContext.ActionArguments.TryGetValue("projectId", out obj);
            var projectId = obj as string;

            if (projectId == null)
            {
                return;
            }

            try
            {
                string           userAgent  = actionExecutedContext.Request.Headers.UserAgent.ToString();
                HttpStatusCode   statusCode = actionExecutedContext.Response.StatusCode;
                DomainActionData actionData = ActionDataService.GetActionData(userAgent, (int)statusCode);

                this.Publish(new WatchingEventArg(actionData, projectId).AsTask());
            }
            catch (Exception ex)
            {
                Trace.TraceError("Failed to log video watching: {0}", ex);
            }
        }
Exemple #19
0
 public void Initialize()
 {
     _domain = new DomainActionData()
     {
         UserAgent        = UserAgent,
         HttpMethod       = HttpMethod,
         IsAuthenticated  = IsAuthenticated,
         StatusCode       = StatusCode,
         Url              = Url,
         UrlReferrer      = UrlReferrer,
         UserHostAddress  = UserHostAddress,
         UserHostName     = UserHostName,
         UserId           = UserId,
         UserLanguages    = _userLanguages,
         AnonymousId      = AnonymousId,
         UserEmail        = Email,
         UserName         = UserName,
         IdentityProvider = IdentityProvider
     };
 }
        public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
        {
            base.OnActionExecuted(actionExecutedContext);

            if (!CheckActionContext(actionExecutedContext, "StatProjectUploadingWebApiAttribute"))
            {
                return;
            }

            if (actionExecutedContext.Response.StatusCode != HttpStatusCode.Created)
            {
                return;
            }

            var objectContent = actionExecutedContext.Response.Content as ObjectContent;

            if (objectContent == null)
            {
                return;
            }

            var project = objectContent.Value as Project;

            if (project == null)
            {
                return;
            }

            try
            {
                string           userAgent  = actionExecutedContext.Request.Headers.UserAgent.ToString();
                HttpStatusCode   statusCode = actionExecutedContext.Response.StatusCode;
                DomainActionData actionData = ActionDataService.GetActionData(userAgent, (int)statusCode);

                this.Publish(new ProjectUploadingEventArg(actionData, project.Id, project.Name, project.ProjectType, project.ProjectSubtype).AsTask());
            }
            catch (Exception ex)
            {
                Trace.TraceError("Failed to log project uploading: {0}", ex);
            }
        }
Exemple #21
0
        public void IdentifyUserTest()
        {
            //Arrange
            var timeSpan     = new DateTime(2013, 7, 16);
            var actionDomain = new DomainActionData();
            var user         = new FakeDomainStatUser();

            var eventLogger       = new Mock <IEventLogger>();
            var statDomainFactory = new Mock <IStatDomainFactory>();
            var dateTimeWrapper   = new Mock <IDateTimeWrapper>();

            var userRegistrationEventService = new UserIdentifyEventService(eventLogger.Object, statDomainFactory.Object, dateTimeWrapper.Object);

            statDomainFactory.Setup(m => m.CreateUser(actionDomain)).Returns(user);
            dateTimeWrapper.Setup(m => m.CurrentDateTime()).Returns(timeSpan);

            //Act
            userRegistrationEventService.IdentifyUser(actionDomain);

            //Assert
            eventLogger.Verify(m => m.Identify(user, timeSpan), Times.Once());
        }
        public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
        {
            base.OnActionExecuted(actionExecutedContext);

            if (!CheckActionContext(actionExecutedContext, "StatProjectStateAttribute"))
            {
                return;
            }

            if (actionExecutedContext.Response.StatusCode != HttpStatusCode.Created)
            {
                return;
            }

            object obj;

            actionExecutedContext.ActionContext.ActionArguments.TryGetValue("id", out obj);
            var projectId = obj as string;

            if (projectId == null)
            {
                return;
            }

            try
            {
                string           userAgent  = actionExecutedContext.Request.Headers.UserAgent.ToString();
                HttpStatusCode   statusCode = actionExecutedContext.Response.StatusCode;
                DomainActionData actionData = ActionDataService.GetActionData(userAgent, (int)statusCode);

                this.Publish(new StatProjectStateEventArg(actionData, projectId, _actionType).AsTask());
            }
            catch (Exception ex)
            {
                Trace.TraceError("Failed to log project state: {0}", ex);
            }
        }
        public async Task AddProjectUploadingTest()
        {
            const string         eventId        = "eventId";
            const string         projectId      = "projectId";
            const string         projectName    = "projectName";
            const ProjectType    projectType    = ProjectType.Tag;
            const ProjectSubtype projectSubtype = ProjectSubtype.Friend;

            var dateTime = new DateTime(2013, 2, 13);

            var domain                 = new DomainActionData();
            var httpMessageEntity      = new StatHttpMessageV2Entity();
            var projectUploadingEntity = new StatProjectUploadingV2Entity();

            var guidWrapper                = new Mock <IGuidWrapper>();
            var dateTimeWrapper            = new Mock <IDateTimeWrapper>();
            var httpMessageRepository      = new Mock <IRepository <StatHttpMessageV2Entity> >();
            var projectUploadingRepository = new Mock <IRepository <StatProjectUploadingV2Entity> >();
            var repositoryFactory          = new Mock <IRepositoryFactory>();
            var statEntityFactory          = new Mock <IStatEntityFactory>();

            guidWrapper.Setup(m => m.Generate()).Returns(eventId);
            dateTimeWrapper.Setup(m => m.CurrentDateTime()).Returns(dateTime);

            repositoryFactory.Setup(m => m.Create <StatHttpMessageV2Entity>(Tables.StatHttpMessageV2)).Returns(httpMessageRepository.Object);
            repositoryFactory.Setup(m => m.Create <StatProjectUploadingV2Entity>(Tables.StatProjectUploadingV2)).Returns(projectUploadingRepository.Object);

            statEntityFactory.Setup(m => m.CreateHttpMessageEntity(eventId, dateTime, domain)).Returns(httpMessageEntity);
            statEntityFactory.Setup(m => m.CreateProjectUploadingEntity(eventId, dateTime, domain, projectId, projectName, projectType, projectSubtype)).Returns(projectUploadingEntity);
            httpMessageRepository.Setup(m => m.AddAsync(httpMessageEntity, It.IsAny <CancellationToken>())).Returns(async() => httpMessageEntity);
            projectUploadingRepository.Setup(m => m.AddAsync(projectUploadingEntity, It.IsAny <CancellationToken>())).Returns(async() => projectUploadingEntity);

            var userRegistrationService = new StatProjectUploadingService(repositoryFactory.Object, statEntityFactory.Object, guidWrapper.Object, dateTimeWrapper.Object);

            //Act & Assert
            await userRegistrationService.AddProjectUploading(domain, projectId, projectName, projectType, projectSubtype);
        }
 public ActionDataEventArg(DomainActionData actionData)
 {
     ActionData = actionData;
 }
Exemple #25
0
 public UserLoginEventArg(DomainActionData actionData)
     : base(actionData)
 {
 }
 public StatProjectStateV3Entity CreateProjectCreatingEntity(DateTime dateTime, DomainActionData domain, string projectId, string actionType)
 {
     return(new StatProjectStateV3Entity
     {
         ProjectId = projectId,
         ActionType = actionType,
         DateTime = dateTime,
         Producer = _tableValueConverter.UserAgentToProductName(domain.UserAgent),
         Version = _tableValueConverter.UserAgentToVersion(domain.UserAgent)
     });
 }
 public StatWatchingV2Entity CreateWatchingEntity(string eventId, DateTime dateTime, DomainActionData domain, string projectId)
 {
     return(new StatWatchingV2Entity
     {
         Tick = _tableValueConverter.DateTimeToTickWithGuid(dateTime),
         EventId = eventId,
         DateTime = dateTime,
         IsAuthenticated = domain.IsAuthenticated,
         UrlReferrer = domain.UrlReferrer,
         UserId = domain.UserId,
         AnonymousId = domain.AnonymousId,
         ProjectId = projectId,
         UserAgent = domain.UserAgent
     });
 }
        public StatUserRegistrationV2Entity CreateUserRegistrationEntity(string eventId, DateTime dateTime, DomainActionData domain)
        {
            string productName = _tableValueConverter.UserAgentToProductName(domain.UserAgent);

            return(new StatUserRegistrationV2Entity
            {
                Tick = _tableValueConverter.DateTimeToTickWithGuid(dateTime),
                EventId = eventId,
                DateTime = dateTime,
                Email = domain.UserEmail,
                UserName = domain.UserName,
                IdentityProvider = domain.IdentityProvider,
                ProductName = productName,
                UserId = domain.UserId
            });
        }
        public StatProjectUploadingV2Entity CreateProjectUploadingEntity(string eventId, DateTime dateTime, DomainActionData domain, string projectId, string projectName, ProjectType projectType,
                                                                         ProjectSubtype projectSubtype)
        {
            string productName    = _tableValueConverter.UserAgentToProductName(domain.UserAgent);
            string productVersion = _tableValueConverter.UserAgentToVersion(domain.UserAgent);

            return(new StatProjectUploadingV2Entity
            {
                Tick = _tableValueConverter.DateTimeToTickWithGuid(dateTime),
                EventId = eventId,
                DateTime = dateTime,
                ProductName = productName,
                UserId = domain.UserId,
                ProjectId = projectId,
                ProjectName = projectName,
                IdentityProvider = domain.IdentityProvider,
                ProductVersion = productVersion,
                ProjectType = (int)projectType,
                TagType = (int)projectSubtype
            });
        }
        public StatProjectDeletionV2Entity CreateProjectDeletionEntity(string eventId, DateTime dateTime, DomainActionData domain, string projectId)
        {
            string productName = _tableValueConverter.UserAgentToProductName(domain.UserAgent);

            return(new StatProjectDeletionV2Entity
            {
                Tick = _tableValueConverter.DateTimeToTickWithGuid(dateTime),
                EventId = eventId,
                DateTime = dateTime,
                ProjectId = projectId,
                ProductName = productName,
                UserId = domain.UserId
            });
        }