Пример #1
0
        public static void MapFromDB(DBEntity from, ThisEntity to, bool includingComponents, bool includingExtra = true)
        {
            MapFromDB_Basic(from, to, includingComponents);

            to.CredentialRegistryId = from.CredentialRegistryId;

            //=============================
            if (includingExtra)
            {
                to.Subject = Entity_ReferenceManager.GetAll(to.RowId, CodesManager.PROPERTY_CATEGORY_SUBJECT);

                to.Keyword = Entity_ReferenceManager.GetAll(to.RowId, CodesManager.PROPERTY_CATEGORY_KEYWORD);
                //properties

                try
                {
                    to.OccupationType         = Reference_FrameworksManager.FillEnumeration(to.RowId, CodesManager.PROPERTY_CATEGORY_SOC);
                    to.AlternativeOccupations = Entity_ReferenceManager.GetAll(to.RowId, CodesManager.PROPERTY_CATEGORY_SOC);

                    to.IndustryType          = Reference_FrameworksManager.FillEnumeration(to.RowId, CodesManager.PROPERTY_CATEGORY_NAICS);
                    to.AlternativeIndustries = Entity_ReferenceManager.GetAll(to.RowId, CodesManager.PROPERTY_CATEGORY_NAICS);
                }
                catch (Exception ex)
                {
                    LoggingHelper.LogError(ex, thisClassName + string.Format(".MapFromDB_B(), Name: {0} ({1})", to.Name, to.Id));
                    to.StatusMessage = FormatExceptions(ex);
                }
            }
        }
Пример #2
0
        public static void CredentialMinimumMap(EM.Credential from, Credential to)
        {
            CredentialRequest cr = new CredentialRequest();

            //probably too much
            cr.IsDetailRequest();

            to.Id    = from.Id;
            to.RowId = from.RowId;

            to.Name        = from.Name;
            to.Description = from.Description;

            to.SubjectWebpage = from.SubjectWebpage;
            to.CTID           = from.CTID;
            to.EntityStateId  = (int)from.EntityStateId;
            // 16-06-15 mp - always include credential type
            //can be null for a pending record
            to.CredentialTypeId = ( int )(from.CredentialTypeId ?? 0);
            if (to.CredentialTypeId > 0)
            {
                CodeItem ct = CodesManager.Codes_PropertyValue_Get(to.CredentialTypeId);
                if (ct != null && ct.Id > 0)
                {
                    to.CredentialType       = ct.Title;
                    to.CredentialTypeSchema = ct.SchemaName;
                }

                to.CredentialTypeEnum = EntityPropertyManager.FillEnumeration(to.RowId, CodesManager.PROPERTY_CATEGORY_CREDENTIAL_TYPE);
                to.CredentialTypeEnum.Items.Add(new EnumeratedItem()
                {
                    Id = to.CredentialTypeId, Name = ct.Name, SchemaName = ct.SchemaName
                });
            }

            if (from.ImageUrl != null && from.ImageUrl.Trim().Length > 0)
            {
                to.Image = from.ImageUrl;
            }
            else
            {
                to.Image = null;
            }

            if (IsValidDate(from.Created))
            {
                to.Created = ( DateTime )from.Created;
            }

            to.AudienceLevelType = EntityPropertyManager.FillEnumeration(to.RowId, CodesManager.PROPERTY_CATEGORY_AUDIENCE_LEVEL);

            //to.Occupation = Entity_FrameworkItemManager.FillEnumeration( to.RowId, CodesManager.PROPERTY_CATEGORY_SOC );
            to.Occupation       = Reference_FrameworksManager.FillEnumeration(to.RowId, CodesManager.PROPERTY_CATEGORY_SOC);
            to.OtherOccupations = Entity_ReferenceManager.GetAll(to.RowId, CodesManager.PROPERTY_CATEGORY_SOC);

            //to.Industry = Entity_FrameworkItemManager.FillEnumeration( to.RowId, CodesManager.PROPERTY_CATEGORY_NAICS );
            to.Industry        = Reference_FrameworksManager.FillEnumeration(to.RowId, CodesManager.PROPERTY_CATEGORY_NAICS);
            to.OtherIndustries = Entity_ReferenceManager.GetAll(to.RowId, CodesManager.PROPERTY_CATEGORY_NAICS);

            to.InstructionalProgramType = Reference_FrameworksManager.FillEnumeration(to.RowId, CodesManager.PROPERTY_CATEGORY_CIP);

            to.Subject = Entity_ReferenceManager.GetAllSubjects(to.RowId);

            to.Keyword = Entity_ReferenceManager.GetAll(to.RowId, CodesManager.PROPERTY_CATEGORY_KEYWORD);

            //Added these because they were needed on the detail page - NA 6/1/2017
            to.OwningAgentUid     = from.OwningAgentUid ?? Guid.Empty;
            to.OwningOrganization = OrganizationManager.GetForSummary(to.OwningAgentUid);
        }
Пример #3
0
        public static void MapFromDB(DBEntity input, ThisEntity output,
                                     bool includingParts)
        {
            output.Id                    = input.Id;
            output.RowId                 = input.RowId;
            output.EntityStateId         = input.EntityStateId;
            output.Description           = input.Description == null ? "" : input.Description;
            output.CTID                  = input.CTID;
            output.DataSuppressionPolicy = input.DataSuppressionPolicy;
            output.SubjectIdentification = input.SubjectIdentification;
            output.Source                = GetUrlData(input.Source);
            //
            if (IsGuidValid(input.DataProviderUID))
            {
                output.DataProviderUID = ( Guid )input.DataProviderUID;
                output.DataProvider    = OrganizationManager.GetForSummary(output.DataProviderUID);
            }
            //
            output.InstructionalProgramType = Reference_FrameworksManager.FillEnumeration(output.RowId, CodesManager.PROPERTY_CATEGORY_CIP);
            //
            if (input.DistributionFile != null)
            {
                var list = input.DistributionFile.Split('|');
                foreach (var item in list)
                {
                    if (!string.IsNullOrWhiteSpace(item))
                    {
                        output.DistributionFile.Add(item);
                    }
                }
            }
            else
            {
                output.DistributionFile = new List <string>();
            }

            //
            if (IsValidDate(input.Created))
            {
                output.Created = ( DateTime )input.Created;
            }
            if (IsValidDate(input.LastUpdated))
            {
                output.LastUpdated = ( DateTime )input.LastUpdated;
            }


            if (string.IsNullOrWhiteSpace(output.CTID) || output.EntityStateId < 3)
            {
                output.IsReferenceVersion = true;
                return;
            }
            //=====
            var relatedEntity = EntityManager.GetEntity(output.RowId, false);

            if (relatedEntity != null && relatedEntity.Id > 0)
            {
                output.EntityLastUpdated = relatedEntity.LastUpdated;
            }

            //components
            if (includingParts)
            {
                var processProfiles = Entity_ProcessProfileManager.GetAll(input.RowId);
                foreach (ProcessProfile item in processProfiles)
                {
                    if (item.ProcessTypeId == Entity_ProcessProfileManager.ADMIN_PROCESS_TYPE)
                    {
                        output.AdministrationProcess.Add(item);
                    }
                }
                //
                output.Jurisdiction = Entity_JurisdictionProfileManager.Jurisdiction_GetAll(output.RowId);
                //get DataSetTimePeriod
                output.DataSetTimePeriod = DataSetTimeFrameManager.GetAll(output.Id);
            }
        }         //