public static void recordEvent(TimelineEvent evt, DateTime startTime) { var _ctx = DbCtx.Get(); var pers = _ctx.Person.FirstOrDefault(p0 => p0.Id == evt.userId); var disc = _ctx.Discussion.FirstOrDefault(d0 => d0.Id == evt.discussionId); if (disc == null) { return; } var topic = _ctx.Topic.FirstOrDefault(t0 => t0.Id == evt.topicId); var s = new StatsEvent(); s.DiscussionId = evt.discussionId; s.DiscussionName = disc.Subject; s.TopicId = evt.topicId; if (topic != null) s.TopicName = topic.Name; else s.TopicName = ""; s.UserId = evt.userId; s.UserName = pers.Name; s.Event = (int) evt.e; s.Time = startTime.Add(evt.Span); s.DeviceType = (int) evt.devType; _ctx.AddToStatsEvent(s); }
private void AddEvent_Click_1(object sender, RoutedEventArgs e) { var ev = new TimelineEvent(StEvent.BadgeEdited, 1, 1, _timelineModel, TimeSpan.FromSeconds(4), 1, DeviceType.Wpf); _timelineModel.AddEvent(ev); }
private bool FireStatsEvent(StEvent e, int personId = -2) { if (cbxTopics.SelectedItem == null) { MessageDlg.Show("Please first select topic"); return false; } if (personId == -2) { if (lstUsers.SelectedItem == null) { MessageDlg.Show("Please first select user who initiates the event"); return false; } personId = ((Person) lstUsers.SelectedItem).Id; } else { //we use given personId } var newEvent = new TimelineEvent(e, personId, login.discussion.Id, _timelineModel, _timelineModel.CurrentTime, ((Topic) cbxTopics.SelectedItem).Id, login.devType); EventGen.timeline.CommandManager.Instance.RegisterDoneCommand(new CreateEventCommand(newEvent, true)); UpdateEventCounts(); return true; }