public void Print(int AthleteID, string Files, string Printer)
        {
            Athlete Athlete = getAthlete((int)AthleteID);

            if (Athlete == null)
            {
                return;
            }

            List <Athlete> athletes = new List <Athlete>()
            {
                Athlete
            };

            List <string> tempFiles = new List <string>();


            foreach (string s in PrintCertificates.SaveIndividualCertificates(
                         ACertificate.GenerateCertificates(Athlete, getCurrentChampionship( )),
                         ((App)Application.Current).CurrentChampionship.getChampionshipExportsDir( )).ToArray( ))
            {
                Printing.PrintPDF(s, Printer);
            }

            PrintAthleteNotes(AthleteID, Printer);
        }
        /// <summary>
        /// Written to produce certificates that were not collected on the day. 2017-01-22
        /// </summary>
        /// <returns></returns>
        public string [] CustomOpenCert( )
        {
            List <CertificateData> certs = new List <CertificateData>();

            //foreach ( ACompetitor a in getCurrentChampionship().ListAllCompetitors().OrderBy(x => x.checkParameter("School")).ToList() )
            //{
            //    if ( a.Result == null ) continue ;

            //    if ( a.result.rank <= 13 ) continue;

            //    if ( a.Result.CertificateEarned )
            //        certs.AddRange ( ACertificate.GenerateCertificates( a ) );
            //}

            foreach (AEvent Event in getCurrentChampionship().listAllEvents())
            {
                certs.AddRange(Event.getCertificateData( ));
            }

            List <string> tempFiles = new List <string>();

            tempFiles.AddRange(PrintCertificates.SaveIndividualCertificates(certs,
                                                                            ((App)Application.Current).CurrentChampionship.getChampionshipExportsDir( )));

            Exports.MergeMultiplePDFIntoSinglePDF(((App)Application.Current).CurrentChampionship.getChampionshipExportsDir( ) + "\\All Certs.pdf", tempFiles.ToArray( ));

            return(tempFiles.ToArray( ));
        }
        public string[] OpenCert(int AthleteID)
        {
            List <string> tempFiles = new List <string>();

            foreach (string s in PrintCertificates.SaveIndividualCertificates(
                         ACertificate.GenerateCertificates(getAthlete(AthleteID), getCurrentChampionship( )),
                         //AppDomain.CurrentDomain.BaseDirectory + @"WebPages\PDFs\").ToArray())
                         ((App)Application.Current).CurrentChampionship.getChampionshipExportsDir( )).ToArray( ))
            {
                tempFiles.Add(@"\exports\" + System.IO.Path.GetFileName(s));
            }

            return(tempFiles.ToArray( ));
        }
        /// <param name="Type">Can be "Team", "Top Individuals" or "Top Lower Year Group"</param>
        /// <returns>Array of file paths</returns>
        public string[] GenerateTempCertificates(AEvent Event, String Type, bool Print = false, bool Open = false, string ExportPath = "")
        {
            if (Event == null)
            {
                return new string[] { }
            }
            ;

            List <string> files;

            if (string.IsNullOrWhiteSpace(ExportPath))
            {
                files =
                    PrintCertificates.SaveAllEventCertificatesByType(
                        ACertificate.GenerateCertificates(Event),
                        ((App)Application.Current).CurrentChampionship.getChampionshipExportsDir( ),
                        new AEvent[] { Event });
            }
            else
            {
                files =
                    PrintCertificates.SaveAllEventCertificatesByType(
                        ACertificate.GenerateCertificates(Event),
                        ExportPath,
                        new AEvent[] { Event });
            }

            // Why am i trying to save here anyway
            // 2016-05-29 !**!
            //saveChangesToDatabase();

            if (Print)
            {
                files.Where(s => s.Contains(Type)).ToList( ).ForEach(file => Printing.PrintPDF(file));
            }
            else if (Open)
            {
                files.Where(s => s.Contains(Type)).ToList( ).ForEach(file => Process.Start(file));
            }

            if (string.IsNullOrWhiteSpace(Type))
            {
                return(files.ToArray( ));
            }
            else
            {
                return(files.Where(s => s.Contains(Type)).ToArray( ));
            }
        }