예제 #1
0
        private Certificate Map(CertificatePrintSummary certificateToBePrinted)
        {
            var certificate = new Certificate
            {
                Uln           = certificateToBePrinted.Uln,
                StandardCode  = certificateToBePrinted.StandardCode,
                ProviderUkPrn = certificateToBePrinted.ProviderUkPrn,
                EndPointAssessorOrganisationId   = certificateToBePrinted.EndPointAssessorOrganisationId,
                EndPointAssessorOrganisationName = certificateToBePrinted.EndPointAssessorOrganisationName,
                CertificateReference             = certificateToBePrinted.CertificateReference,
                LearnerGivenNames   = certificateToBePrinted.LearnerGivenNames,
                LearnerFamilyName   = certificateToBePrinted.LearnerFamilyName,
                StandardName        = certificateToBePrinted.StandardName,
                StandardLevel       = certificateToBePrinted.StandardLevel,
                ContactName         = certificateToBePrinted.ContactName,
                ContactOrganisation = certificateToBePrinted.ContactOrganisation,
                ContactAddLine1     = certificateToBePrinted.ContactAddLine1,
                ContactAddLine2     = certificateToBePrinted.ContactAddLine2,
                ContactAddLine3     = certificateToBePrinted.ContactAddLine3,
                ContactAddLine4     = certificateToBePrinted.ContactAddLine4,
                ContactPostCode     = certificateToBePrinted.ContactPostCode,
                AchievementDate     = certificateToBePrinted.AchievementDate,
                CourseOption        = certificateToBePrinted.CourseOption,
                OverallGrade        = certificateToBePrinted.OverallGrade,
                Department          = certificateToBePrinted.Department,
                FullName            = certificateToBePrinted.FullName,
                Status = certificateToBePrinted.Status
            };

            return(certificate);
        }
예제 #2
0
        public async Task <List <CertificatePrintSummary> > GetCertificatesForBatch(int batchNumber)
        {
            var sql =
                @"SELECT 
                    c.[Uln], 
                    c.[StandardCode], 
                    c.[ProviderUkPrn], 
                    c.[CertificateReference], 
                    c.[BatchNumber], 
                    c.[Status], 
                    o.[EndPointAssessorOrganisationId], 
                    o.[EndPointAssessorName], 
                    c.[CertificateData] 
                FROM 
                    [CertificateBatchLogs] cbl INNER JOIN [Certificates] c 
                       ON cbl.CertificateReference = c.CertificateReference INNER JOIN [Organisations] o 
                       ON c.OrganisationId = o.Id 
                WHERE 
                    cbl.BatchNumber = @batchNumber";

            var certificates = await _unitOfWork.Connection.QueryAsync <Certificate, Organisation, CertificateData, CertificatePrintSummary>(
                sql, (certificate, organisation, certificateData) =>
            {
                var certificatePrintSummary = new CertificatePrintSummary()
                {
                    Uln           = certificate.Uln,
                    StandardCode  = certificate.StandardCode,
                    ProviderUkPrn = certificate.ProviderUkPrn,
                    EndPointAssessorOrganisationId   = organisation.EndPointAssessorOrganisationId,
                    EndPointAssessorOrganisationName = organisation.EndPointAssessorName,
                    CertificateReference             = certificate.CertificateReference,
                    BatchNumber         = certificate.BatchNumber.GetValueOrDefault().ToString(),
                    LearnerGivenNames   = certificateData.LearnerGivenNames,
                    LearnerFamilyName   = certificateData.LearnerFamilyName,
                    StandardName        = certificateData.StandardName,
                    StandardLevel       = certificateData.StandardLevel,
                    ContactName         = certificateData.ContactName,
                    ContactOrganisation = certificateData.ContactOrganisation,
                    ContactAddLine1     = certificateData.ContactAddLine1,
                    ContactAddLine2     = certificateData.ContactAddLine2,
                    ContactAddLine3     = certificateData.ContactAddLine3,
                    ContactAddLine4     = certificateData.ContactAddLine4,
                    ContactPostCode     = certificateData.ContactPostCode,
                    AchievementDate     = certificateData.AchievementDate,
                    CourseOption        = certificateData.CourseOption,
                    OverallGrade        = certificateData.OverallGrade,
                    Department          = certificateData.Department,
                    FullName            = certificateData.FullName,
                    Status = certificate.Status
                };
                return(certificatePrintSummary);
            },
                splitOn : "Uln, EndPointAssessorOrganisationId, CertificateData",
                param : new { batchNumber },
                transaction : _unitOfWork.Transaction);

            return(certificates.ToList());
        }