Beispiel #1
0
        /// <summary>
        /// Exports the certificates classes.
        /// </summary>
        /// <param name="group">The group.</param>
        /// <returns></returns>
        private static IEnumerable <SerializableCertificateClass> ExportCertificateClasses(IHasID group)
        {
            List <SerializableCertificateClass> listOfCertClasses = new List <SerializableCertificateClass>();

            // Exclude unused classes
            foreach (CrtClasses certClass in Database.CrtClassesTable)
            {
                Util.UpdatePercentDone(Database.CertificatesTotalCount);

                SerializableCertificateClass crtClass = new SerializableCertificateClass
                {
                    ID          = certClass.ID,
                    Name        = certClass.ClassName,
                    Description = certClass.Description
                };

                // Export certificate
                SerializableCertificate certificate = Database.CrtCertificatesTable
                                                      .Where(x => x.ClassID == certClass.ID && x.GroupID == group.ID).Select(ExportCertificate).FirstOrDefault();

                if (certificate == null)
                {
                    continue;
                }

                // Add certificate to class
                crtClass.Certificate = certificate;

                // Add certificate class to classes
                listOfCertClasses.Add(crtClass);
            }
            return(listOfCertClasses);
        }
 /// <summary>
 /// Deserialization constructor.
 /// </summary>
 /// <param name="group"></param>
 /// <param name="src"></param>
 internal StaticCertificateClass(StaticCertificateGroup group, SerializableCertificateClass src)
 {
     ID          = src.ID;
     Name        = src.Name;
     Description = src.Description;
     Group       = group;
     Certificate = new StaticCertificate(this, src.Certificate);
 }
        /// <summary>
        /// Deserialization constructor
        /// </summary>
        /// <param name="category"></param>
        /// <param name="element"></param>
        internal StaticCertificateClass(StaticCertificateCategory category, SerializableCertificateClass src)
        {
            this.m_id          = src.ID;
            this.m_name        = src.Name;
            this.m_description = src.Description;
            this.m_category    = category;

            foreach (var srcCert in src.Certificates)
            {
                var cert = new StaticCertificate(this, srcCert);
                this.m_certificates[(int)cert.m_grade] = cert;
            }
        }