/// <summary> /// Create a new UserActionEvent object. /// </summary> /// <param name="userActionEventId">Initial value of the UserActionEventId property.</param> /// <param name="userActionEventDate">Initial value of the UserActionEventDate property.</param> /// <param name="sessionId">Initial value of the SessionId property.</param> /// <param name="userId">Initial value of the UserId property.</param> /// <param name="userActionId">Initial value of the UserActionId property.</param> public static UserActionEvent CreateUserActionEvent(global::System.Int64 userActionEventId, global::System.DateTime userActionEventDate, global::System.String sessionId, global::System.Int32 userId, global::System.Int32 userActionId) { UserActionEvent userActionEvent = new UserActionEvent(); userActionEvent.UserActionEventId = userActionEventId; userActionEvent.UserActionEventDate = userActionEventDate; userActionEvent.SessionId = sessionId; userActionEvent.UserId = userId; userActionEvent.UserActionId = userActionId; return userActionEvent; }
// ************************************** //LogUserActionEvent // ************************************** private static void LogEvent(UserActionEvent logEvent) { using (var ctx = new SongSearchContext()) { ctx.ContextOptions.LazyLoadingEnabled = false; try { ctx.UserActionEvents.AddObject(logEvent); ctx.SaveChanges(); } catch (Exception ex) { Log.Error(ex); } } }
/// <summary> /// Deprecated Method for adding a new object to the UserActionEvents EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUserActionEvents(UserActionEvent userActionEvent) { base.AddObject("UserActionEvents", userActionEvent); }
//delegate void EndInvokeDelegate(IAsyncResult result); // ************************************** // LogUserEvent: UserActionEvent // ************************************** public static void LogUserEvent(UserActions action) { var user = Account.User(); if (SystemConfig.LogUserActions && user != null) { var actionEvent = new UserActionEvent() { UserActionId = (int)action, UserId = user.UserId, UserActionEventDate = DateTime.Now, SessionId = CurrentSessionId() }; LogActionEventDelegate<UserActionEvent> logActionEventDelegate = new LogActionEventDelegate<UserActionEvent>(LogEvent); logActionEventDelegate.BeginInvoke(actionEvent, null, null); } }