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); }
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( )); } }