Exemple #1
0
        public void Integration_1554MSBS()
        {
            string dbFilename = TestUtilities.CreateWorkingFileFrom(testContextInstance.TestDeploymentDir, @"1554MSBS.mdb");

            RaceHorologyLib.Database db = new RaceHorologyLib.Database();
            db.Connect(dbFilename);
            AppDataModel model = new AppDataModel(db);

            Race race = model.GetRace(0);

            {
                IPDFReport report = new StartListReport(race.GetRun(0));
                Assert.IsTrue(TestUtilities.GenerateAndCompareAgainstPdf(TestContext, report, @"1554MSBS - Startliste 1. Durchgang.pdf", 4));
            }
            {
                IPDFReport report = new StartListReport2ndRun(race.GetRun(1));
                Assert.IsTrue(TestUtilities.GenerateAndCompareAgainstPdf(TestContext, report, @"1554MSBS - Startliste 2. Durchgang.pdf", 3));
            }
            {
                IPDFReport report = new RaceRunResultReport(race.GetRun(0));
                Assert.IsTrue(TestUtilities.GenerateAndCompareAgainstPdf(TestContext, report, @"1554MSBS - Ergebnis 1. Durchgang.pdf", 5));
            }
            {
                IPDFReport report = new RaceRunResultReport(race.GetRun(1));
                Assert.IsTrue(TestUtilities.GenerateAndCompareAgainstPdf(TestContext, report, @"1554MSBS - Ergebnis 2. Durchgang.pdf", 3));
            }
            {
                IPDFReport report = new RaceResultReport(race);
                Assert.IsTrue(TestUtilities.GenerateAndCompareAgainstPdf(TestContext, report, @"1554MSBS - Ergebnis Gesamt.pdf", 2));
            }
        }
        private void BtnPrint_Click(object sender, RoutedEventArgs e)
        {
            PDFReport report = null;

            if (cmbTotalResult.SelectedValue is CBItem selected)
            {
                CBObjectTotalResults selObj = selected.Value as CBObjectTotalResults;
                if (selObj == null ||             // Fallback
                    selObj.Type == "raceresults") // ResultList
                {
                    if (_thisRace.GetResultViewProvider() is DSVSchoolRaceResultViewProvider)
                    {
                        report = new DSVSchoolRaceResultReport(_thisRace);
                    }
                    else
                    {
                        report = new RaceResultReport(_thisRace);
                    }
                }
                else if (selObj.Type == "raceresults")
                {
                    displayView(_thisRace.GetResultViewProvider());
                }
                else if (selObj.Type == "results_run")
                {
                    report = new RaceRunResultReport(selObj.RaceRun);
                }
                else if (selObj.Type == "startlist_run")
                {
                    if (selObj.RaceRun.GetStartListProvider() is BasedOnResultsFirstRunStartListViewProvider)
                    {
                        report = new StartListReport2ndRun(selObj.RaceRun);
                    }
                    else
                    {
                        report = new StartListReport(selObj.RaceRun);
                    }
                }
            }

            if (report != null)
            {
                report.WithDiagram    = chkPrintOptionWithDiagram.IsChecked == true;
                report.WithRaceHeader = chkPrintOptionWithRaceHeader.IsChecked == true;
                CreateAndOpenReport(report);
            }
        }