public static List <CertificateData> GenerateCertificates(ACompetitor Competitor, AEvent Event) { // All error checking moved to hasEarnedCertificate() for efficacy. //if ( Event == null ) // throw new ArgumentNullException ( "Event can not be null when generating certificates" ); //if ( Competitor == null ) // throw new ArgumentNullException ( "Competitor can not be null when generating certificates" ); //if ( Competitor.CompetingIn != Event ) // throw new ArgumentException ( "Competitor must be competing for the Event used as a parameter" ); //if ( Event.Results.Count ( ) == 0 ) // // There are not results to process certificates for // return new List<CertificateData> ( ); //if ( Event.Results.Where ( r => r.Competitor == Competitor ).Count ( ) == 0 ) // // This competitor does not appear in this events results // return new List<CertificateData> ( ); if (Competitor?.Result?.CertificateEarned == true) { return(Event.getCertificateData( ).Where(c => c.Competitor == Competitor).ToList( )); } else { return(new List <CertificateData> ( )); } }
public static List <CertificateData> GenerateCertificates(AEvent Event) { if (!Event.IsFinal) { return(new List <CertificateData> ( )); } List <CertificateData> temp; //List<CertificateData> temp = new List<CertificateData>(); Stopwatch sw2 = new Stopwatch(); sw2.Start( ); // generates certificate data based on individuals //foreach ( ACompetitor Competitor in Event.getEnteredCompetitors ( ) ) // temp.AddRange ( GenerateCertificates ( Competitor , Event ) ); temp = Event.getCertificateData( ); sw2.Stop( ); return(temp); }