protected override void Run(ServiceContext context)
        {
            Context = context as TimeLogReportingServiceContext;
            if (Context == null)
            {
                throw new Exception("Configuration parameters not found");
            }

            var notificationListeners = PluginService.GetPlugins <NotificationListener>(typeof(NotificationListener).FullName);
            var formatter             = PluginService.GetPlugin <TimeLogDataFormatter>(typeof(TimeLogDataFormatter).FullName);
            var dataProvider          = PluginService.GetPlugin <TimeLogDataProvider>(typeof(TimeLogDataProvider).FullName);
            var analyzers             = PluginService.GetPlugins <TimeLogAnalyzer>(typeof(TimeLogAnalyzer).FullName);

            if (analyzers != null && analyzers.Count > 0)
            {
                analyzers.Sort();
            }
            var workitems = dataProvider.LoadData(Context);

            AnalyzeWorkitems(Context, workitems, analyzers);

            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)
                {
                    notificationListeners.ForEach(p =>
                    {
                        try
                        {
                            p.Notify(new TimeLogNotificationContext {
                                Data = data, DataFormatter = formatter
                            });
                        }
                        catch (Exception ex)
                        {
                            //Log exception
                            Console.WriteLine("Error occured: {0}", ex.Message);
                        }
                    });
                }
            }
        }
Esempio n. 2
0
        public override string FormatData(TimeLogData data)
        {
            var xml = data.Serialize <TimeLogData>();

            return(xml.TransformToTimeReporterFormat(TransformXslFile));
        }
Esempio n. 3
0
 public abstract string FormatData(TimeLogData data);
Esempio n. 4
0
 public override string FormatTitle(TimeLogData data)
 {
     return(string.Format("TimeMachine: {0} - {1}", data.TeamMember.Fullname, data.ServiceContext.IterationPath));
 }
Esempio n. 5
0
 public abstract string FormatTitle(TimeLogData data);