private void RaiseTeamMemberNotifications(List <NotificationListener> notificationListeners, List <TimeLog> workitems)
        {
            var teamMemberNotificationListeners = notificationListeners.Where(p => p.ListenerType == NotificationListenerType.PerTeamMember).ToList();

            var developers = workitems.Select(p => p.AssignedTo).Distinct().ToList();

            foreach (var developer in developers)
            {
                TimeLogData data = new TimeLogData
                {
                    ServiceContext = Context,
                    TeamMember     = Context.TeamProfiles.Where(p => p.Fullname == developer).SingleOrDefault(),
                    Workitems      = workitems.Where(p => p.AssignedTo == developer).ToList()
                };
                string devEmail = Context.TeamProfiles.Where(p => p.Fullname == developer).Select(p => p.Email).SingleOrDefault();
                if (string.IsNullOrEmpty(devEmail) == false)
                {
                    teamMemberNotificationListeners.ForEach(p =>
                    {
                        try
                        {
                            p.Notify(new TeamMemberNotificationContext {
                                Data = data
                            });
                        }
                        catch (Exception ex)
                        {
                            //Log exception
                            Console.WriteLine("Error occured: {0}", ex.Message);
                        }
                    });
                }
            }
        }
示例#2
0
 public abstract string FormatTitle(TimeLogData data);
示例#3
0
 public abstract string FormatData(TimeLogData data);