Ejemplo n.º 1
0
        private void GetTimesheetData()
        {
            if ((_tabControlService.TabItemSelected as TimesheetViewModel) != null)
            {
                var timeSheetData = _timesheetService.GetTimesheetData(EmailAddress, StartDate, EndDate);
                _eventAggregator.GetEvent <TimesheetUpdatedEvent>().Publish(timeSheetData);

                if (timeSheetData.Count() > 0)
                {
                    _eventAggregator.GetEvent <StatusUpdatedEvent>().Publish(string.Format("Timesheet information for {0} updated. Total Records: {1}", EmailAddress, timeSheetData.Count()));
                }
                else
                {
                    NotificationRequest.Raise(new Notification {
                        Title = "Timesheet data empty", Content = "Response from service doesn't have data to show."
                    });
                }
            }
            else if ((_tabControlService.TabItemSelected as DailySummaryViewModel) != null)
            {
                var dailySummary = _timesheetService.GetDailySummary(EmailAddress, StartDate, EndDate);
                _eventAggregator.GetEvent <DailySummaryUpdatedEvent>().Publish(dailySummary);

                if (dailySummary.Count() > 0)
                {
                    _eventAggregator.GetEvent <StatusUpdatedEvent>().Publish(string.Format("Daily Summary information for {0} updated. Total Records: {1}", EmailAddress, dailySummary.Count()));
                }
                else
                {
                    NotificationRequest.Raise(new Notification {
                        Title = "Daily Summary data empty", Content = "Response from service doesn't have data to show."
                    });
                }
            }
        }