protected override async Task SaveUserActionAsync( TaskCreatedEvent data, MobileAppType?mobileAppType, long channelAttributesId, AttributionDataHashes attributionDataHashes, CancellationToken cancellation) { if (mobileAppType != null) { // обрабатываем создание заданий только из веба return; } var userAction = new UserAction { UserId = data.NewTaskEntity.CreatorId, Type = UserActionType.TaskCreated, ActionDateTimeUtc = data.Context.Timestamp, ObjectType = ObjectType.Task, ObjectId = data.NewTaskEntity.Id, ObjectGuid = data.NewTaskEntity.Attributes?.TaskGuid, InitiatorId = data.Context.Initiator?.Id, InitiatorType = data.Context.Initiator?.Type, ChannelAttributesId = channelAttributesId, ActualHash = attributionDataHashes.ActualHash, LingeringHash = attributionDataHashes.LingeringHash }; await _userActionManager.SaveUserActionAsync(userAction); }
protected override async Task SaveUserActionAsync( UserRegisteredEvent data, MobileAppType?mobileAppType, long channelAttributesId, AttributionDataHashes attributionDataHashes, CancellationToken cancellation) { if (mobileAppType == null) { var userAction = new UserAction { UserId = data.UserId, Type = UserActionType.UserRegistered, ActionDateTimeUtc = data.Context.Timestamp, ObjectType = ObjectType.User, ObjectId = data.UserId, ObjectGuid = data.UserGuid, InitiatorId = data.Context.Initiator?.Id, InitiatorType = data.Context.Initiator?.Type, ChannelAttributesId = channelAttributesId, ActualHash = attributionDataHashes.ActualHash, LingeringHash = attributionDataHashes.LingeringHash }; await _userActionManager.SaveUserActionAsync(userAction); } }
public bool IsInstallRegistered(string userEmail, MobileAppType?appType) { var q = DbContext.MobileAppInstall.Where(r => r.UserEmail == userEmail); if (appType.HasValue) { q = q.Where(r => r.AppType == (int)appType.Value); } return(q.Count() > 0); }
public bool IsInstallRegistered(string userEmail, MobileAppType?appType) { var query = new SqlQuery("mobile_app_install") .SelectCount() .Where("user_email", userEmail); if (appType.HasValue) { query.Where("app_type", (int)appType.Value); } return(DbManager.ExecuteScalar <int>(query) > 0); }
public bool IsInstallRegistered(string userEmail, MobileAppType?appType) { if (string.IsNullOrEmpty(userEmail)) { return(false); } object cachedValue = cache.Get(GetCacheKey(userEmail, appType)); if (cachedValue != null) { return((bool)cachedValue); } var isRegistered = registrator.IsInstallRegistered(userEmail, appType); cache.Insert(GetCacheKey(userEmail, appType), isRegistered, cacheExpiration); return(isRegistered); }
public bool IsInstallRegistered(string userEmail, MobileAppType?appType) { if (string.IsNullOrEmpty(userEmail)) { return(false); } var fromCache = cache.Get <string>(GetCacheKey(userEmail, appType)); if (bool.TryParse(fromCache, out var cachedValue)) { return(cachedValue); } var isRegistered = registrator.IsInstallRegistered(userEmail, appType); cache.Insert(GetCacheKey(userEmail, appType), isRegistered.ToString(), cacheExpiration); return(isRegistered); }
private string GetCacheKey(string userEmail, MobileAppType?appType) { var cacheKey = appType.HasValue ? userEmail + "/" + appType.ToString() : userEmail; return(string.Format("{0}:mobile:{1}", TenantManager.GetCurrentTenant().TenantId, cacheKey)); }
private string GetCacheKey(string userEmail, MobileAppType?appType) { return(appType.HasValue ? userEmail + "/" + appType.ToString() : userEmail); }
protected abstract Task SaveUserActionAsync( TBody data, MobileAppType?mobileAppType, long channelAttributesId, AttributionDataHashes attributionDataHashes, CancellationToken cancellation);