コード例 #1
0
        private Certificate MapBasicInfoToCertificate(Certificate certificate, CertificateBasicInfo basicInfo)
        {
            certificate.BuildingsContactTest.FirstOrDefault().BuildingOrganizationResponsible = basicInfo.BuildingOrganizationResponsible;
            certificate.BuildingsContactTest.FirstOrDefault().BuildingRespPersonAddress1      = basicInfo.BuildingRespPersonAddress1;
            certificate.CertDateCreated = basicInfo.CertDateCreated;
            certificate.CertEdition     = basicInfo.CertEdition;
            certificate.CertDescription = basicInfo.CertDescription;
            certificate.BuildingsContactTest.FirstOrDefault().BuildingOccupierName     = basicInfo.BuildingOccupierName;
            certificate.BuildingsContactTest.FirstOrDefault().BuildingOccupierAddress1 = basicInfo.BuildingOccupierAddress1;
            if (basicInfo.BuildingAgeOfInstallation != null)
            {
                certificate.BuildingsTest.FirstOrDefault().BuildingAgeOfInstallation = basicInfo.BuildingAgeOfInstallation.Value;
            }
            certificate.BuildingsTest.FirstOrDefault().InstallationRecordsLocation = basicInfo.InstallationRecordsLocation;
            certificate.BuildingsTest.FirstOrDefault().RecordsHeldBy = basicInfo.RecordsHeldBy;
            certificate.CertificateInspections.FirstOrDefault().CertInspectionBuildingEvidenceOfAlteration = basicInfo.CertInspectionBuildingEvidenceOfAlteration;
            if (basicInfo.CertInspectionBuildingAgeOfAlteration != null)
            {
                certificate.CertificateInspections.FirstOrDefault().CertInspectionBuildingAgeOfAlteration = basicInfo.CertInspectionBuildingAgeOfAlteration.Value;
            }
            certificate.CertificateInspections.FirstOrDefault().CertInspectionPreviousInspectionDate     = basicInfo.CertInspectionPreviousInspectionDate;
            certificate.CertificateInspections.FirstOrDefault().CertInspectionPreviousInspectionComments = basicInfo.CertInspectionPreviousInspectionComments;
            certificate.CertificateInspections.FirstOrDefault().CertInspectionPreviousCertNumber         = basicInfo.CertInspectionPreviousCertNumber;
            certificate.CertificateInspections.FirstOrDefault().CertInspectionExtentCovered = basicInfo.CertInspectionExtentCovered;
            certificate.CertAgreedLimitations      = basicInfo.CertAgreedLimitations;
            certificate.CertAgreedWith             = basicInfo.CertAgreedWith;
            certificate.CertOperationalLimitations = basicInfo.CertOperationalLimitations;
            certificate.ConUserId       = basicInfo.ConUserId;
            certificate.EsUserId        = basicInfo.EsUserId;
            certificate.CertDateAmended = basicInfo.CertDateAmended;

            return(certificate);
        }
コード例 #2
0
        public async Task <ServiceResult> SaveCertificate(CertificateBasicInfo editedCertificate)
        {
            var cert = await DbManager.CertificateRepository.GetCertificate(editedCertificate.CertId);

            //var certificate = AutoMapper.Mapper.Map(editedCertificate, cert);
            var certificate = MapBasicInfoToCertificate(cert, editedCertificate);
            await DbManager.CertificateRepository.UpdateCertificate(certificate);

            cert = await DbManager.CertificateRepository.GetCertificate(editedCertificate.CertId);

            return(new SuccessServiceResult());
        }
コード例 #3
0
 public EditCertificate()
 {
     CertificateBasicInfo        = new CertificateBasicInfo();
     CertificateAssociatedBoards = new CertificateAssociatedBoards();
 }
コード例 #4
0
        private CertificateBasicInfo MapCertificateToBasicInfo(Certificate certificate, CertificateBasicInfo basicInfo)
        {
            basicInfo.CertId = certificate.CertId;
            basicInfo.BuildingOrganizationResponsible = certificate.BuildingsContactTest.FirstOrDefault()?.BuildingOrganizationResponsible;
            basicInfo.BuildingRespPersonAddress1      = certificate.BuildingsContactTest.FirstOrDefault()?.BuildingRespPersonAddress1;
            if (certificate.CertDateCreated != null)
            {
                basicInfo.CertDateCreated = certificate.CertDateCreated.Value;
            }
            basicInfo.CertEdition                 = certificate.CertEdition;
            basicInfo.CertDescription             = certificate.CertDescription;
            basicInfo.BuildingOccupierName        = certificate.BuildingsContactTest.FirstOrDefault()?.BuildingOccupierName;
            basicInfo.BuildingOccupierAddress1    = certificate.BuildingsContactTest.FirstOrDefault()?.BuildingOccupierAddress1;
            basicInfo.BuildingAgeOfInstallation   = certificate.BuildingsTest.FirstOrDefault()?.BuildingAgeOfInstallation;
            basicInfo.InstallationRecordsLocation = certificate.BuildingsTest.FirstOrDefault()?.InstallationRecordsLocation;
            basicInfo.RecordsHeldBy               = certificate.BuildingsTest.FirstOrDefault()?.RecordsHeldBy;
            basicInfo.CertInspectionBuildingEvidenceOfAlteration = certificate.CertificateInspections.FirstOrDefault()?.CertInspectionBuildingEvidenceOfAlteration;
            basicInfo.CertInspectionBuildingAgeOfAlteration      = certificate.CertificateInspections.FirstOrDefault()?.CertInspectionBuildingAgeOfAlteration;
            basicInfo.CertInspectionPreviousInspectionDate       = certificate.CertificateInspections.FirstOrDefault()?.CertInspectionPreviousInspectionDate;
            basicInfo.CertInspectionPreviousInspectionComments   = certificate.CertificateInspections.FirstOrDefault()?.CertInspectionPreviousInspectionComments;
            basicInfo.CertInspectionPreviousCertNumber           = certificate.CertificateInspections.FirstOrDefault()?.CertInspectionPreviousCertNumber;
            basicInfo.CertInspectionExtentCovered = certificate.CertificateInspections.FirstOrDefault()?.CertInspectionExtentCovered;
            basicInfo.CertAgreedLimitations       = certificate.CertAgreedLimitations;
            basicInfo.CertAgreedWith             = certificate.CertAgreedWith;
            basicInfo.CertOperationalLimitations = certificate.CertOperationalLimitations;
            basicInfo.ConUserId       = certificate.ConUserId;
            basicInfo.EsUserId        = certificate.EsUserId;
            basicInfo.CertDateAmended = certificate.CertDateAmended;

            if (certificate.BuildingsTest.Any() && certificate.BuildingsTest.FirstOrDefault() != null)
            {
                var description = certificate.BuildingsTest.FirstOrDefault()?.BuildingPremises;
                var other       = certificate.BuildingsTest.FirstOrDefault()?.BuildingPremisesOther;
                var premises    = "";
                switch (description)
                {
                case "O":
                    premises = "Other " + other;
                    break;

                case "C":
                    premises = "Commercial";
                    break;

                case "D":
                    premises = "Domestic";
                    break;

                case "I":
                    premises = "Industrial";
                    break;
                }
                basicInfo.DescriptionOfPremises = premises;
            }

            return(basicInfo);
        }