Example #1
0
        private async Task MakeAReportExecute()
        {
            ReportSettings repSettings = new ReportSettings();

            repSettings.TerminalId    = SelectedTerminal;
            repSettings.StartDateTime = From;
            repSettings.EndDateTime   = To;
            foreach (var propertySetting in EnabledReportProperties)
            {
                if (propertySetting.Enabled)
                {
                    repSettings.Properties.Add(propertySetting.ReportProperty);
                }
            }

            Window wnd = new Window();

            wnd.WindowStyle = WindowStyle.ToolWindow;
            wnd.Content     = new BusyIndicator()
            {
                IsBusy = true
            };
            wnd.SizeToContent = SizeToContent.WidthAndHeight;
            wnd.Show();

            IsWaiting = true;
            var res = ReportDto.Unwrap(await _reportsService.BuildReport(ReportSettingsDto.Wrap(repSettings)));

            IsWaiting = false;

            ReportView z = new ReportView();

            z.DataContext = new ReportViewModel(res);
            wnd.Content   = z;
        }
Example #2
0
        public void TestBoToDto()
        {
            ReportSettings bo = new ReportSettings();

            bo.TerminalId    = "test";
            bo.StartDateTime = new DateTime(1990, 1, 2);
            bo.EndDateTime   = new DateTime(1991, 1, 2, 3, 4, 5);
            bo.Properties.Add(DynamicPropertyManagers.Reports.AvgSpeed);
            bo.Properties.Add(DynamicPropertyManagers.Reports.MaxSpeed);

            var dto = ReportSettingsDto.Wrap(bo);

            Assert.AreEqual(bo.TerminalId, dto.TerminalId);
            Assert.AreEqual(bo.StartDateTime, dto.StartDateTime);
            Assert.AreEqual(bo.EndDateTime, dto.EndDateTime);
            Assert.IsTrue(dto.Properties.Contains(DynamicPropertyManagers.Reports.AvgSpeed.Name));
            Assert.IsTrue(dto.Properties.Contains(DynamicPropertyManagers.Reports.MaxSpeed.Name));
        }