Exemplo n.º 1
0
        //public bool DeleteAll( Entity parent, ref SaveStatus status )
        //{
        //	bool isValid = true;
        //	//Entity parent = EntityManager.GetEntity( parentUid );
        //	if ( parent == null || parent.Id == 0 )
        //	{
        //		status.AddError( thisClassName + ".DeleteAll Error - the provided target parent entity was not provided." );
        //		return false;
        //	}
        //	using ( var context = new EntityContext() )
        //	{
        //		context.HoldersProfile.RemoveRange( context.HoldersProfile.Where( s => s.EntityId == parent.Id ) );
        //		int count = context.SaveChanges();
        //		if ( count > 0 )
        //		{
        //			isValid = true;
        //		}
        //		else
        //		{
        //			//if doing a delete on spec, may not have been any properties
        //		}
        //	}

        //	return isValid;
        //}
        /// <summary>
        /// Parts:
        /// - Jurisdiction
        /// - DataSetProfile
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public bool UpdateParts(ThisEntity entity, ref SaveStatus status)
        {
            bool   isAllValid    = true;
            Entity relatedEntity = EntityManager.GetEntity(entity.RowId);

            if (relatedEntity == null || relatedEntity.Id == 0)
            {
                status.AddError("Error - the related Entity was not found.");
                return(false);
            }

            //JurisdictionProfile
            Entity_JurisdictionProfileManager jpm = new Entity_JurisdictionProfileManager();

            //do deletes - NOTE: other jurisdictions are added in: UpdateAssertedIns
            jpm.DeleteAll(relatedEntity, ref status);
            if (!jpm.SaveList(entity.Jurisdiction, entity.RowId, Entity_JurisdictionProfileManager.JURISDICTION_PURPOSE_SCOPE, ref status))
            {
                isAllValid = false;
            }
            //datasetProfiles
            if (!new DataSetProfileManager().SaveList(entity.RelevantDataSet, relatedEntity, ref status))
            {
                isAllValid = false;
            }

            return(isAllValid);
        }
Exemplo n.º 2
0
        //public bool DeleteAll( Entity parent, ref SaveStatus status, DateTime? lastUpdated = null )
        //{
        //	bool isValid = true;
        //	if ( parent == null || parent.Id == 0 )
        //	{
        //		status.AddError( thisClassName + ". Error - the provided target parent entity was not provided." );
        //		return false;
        //	}
        //	int expectedDeleteCount = 0;
        //	try
        //	{
        //		using ( var context = new EntityContext() )
        //		{
        //			var results = context.Entity_CostProfile.Where( s => s.EntityId == parent.Id && ( lastUpdated == null || s.LastUpdated < lastUpdated ) )
        //		.ToList();
        //			if ( results == null || results.Count == 0 )
        //				return true;
        //			expectedDeleteCount = results.Count;

        //			foreach ( var item in results )
        //			{
        //				context.Entity_CostProfile.Remove( item );
        //				var count = context.SaveChanges();
        //				if ( count > 0 )
        //				{

        //				}
        //			}
        //		}
        //	}
        //	catch ( System.Data.Entity.Infrastructure.DbUpdateConcurrencyException dbcex )
        //	{
        //		if ( dbcex.Message.IndexOf( "an unexpected number of rows (0)" ) > 0 )
        //		{
        //			//don't know why this happens, quashing for now.
        //			LoggingHelper.DoTrace( 1, string.Format( thisClassName + ".DeleteAll. Parent type: {0}, ParentId: {1}, expectedDeletes: {2}. Message: {3}", parent.EntityTypeId, parent.EntityBaseId, expectedDeleteCount, dbcex.Message ) );
        //		}
        //		else
        //		{
        //			var msg = BaseFactory.FormatExceptions( dbcex );
        //			LoggingHelper.DoTrace( 1, string.Format( thisClassName + ".DeleteAll. ParentType: {0}, baseId: {1}, DbUpdateConcurrencyException: {2}", parent.EntityType, parent.EntityBaseId, msg ) );
        //		}

        //	}
        //	catch ( Exception ex )
        //	{
        //		var msg = BaseFactory.FormatExceptions( ex );
        //		LoggingHelper.DoTrace( 1, string.Format( thisClassName + ".DeleteAll. ParentType: {0}, baseId: {1}, exception: {2}", parent.EntityType, parent.EntityBaseId, msg ) );
        //	}
        //	return isValid;
        //}
        //
        private bool UpdateParts(ThisEntity entity, ref SaveStatus status)
        {
            bool isAllValid = true;

            //
            try
            {
                if (new Entity_ReferenceManager().Add(entity.Condition, entity.RowId, CodesManager.ENTITY_TYPE_COST_PROFILE, ref status, CodesManager.PROPERTY_CATEGORY_CONDITION_ITEM, false) == false)
                {
                    isAllValid = false;
                }

                //JurisdictionProfile
                Entity_JurisdictionProfileManager jpm = new Entity_JurisdictionProfileManager();
                jpm.SaveList(entity.Jurisdiction, entity.RowId, Entity_JurisdictionProfileManager.JURISDICTION_PURPOSE_SCOPE, ref status);
            }
            catch (Exception ex)
            {
                LoggingHelper.DoTrace(1, thisClassName + ".UpdateParts(). Exception while processing condition/jurisdiction. " + ex.Message);
                status.AddError(ex.Message);
            }


            if (entity.Items != null && entity.Items.Count > 0)
            {
                new CostProfileItemManager().SaveList(entity.Items, entity.Id, ref status);
            }

            return(isAllValid);
        }
        public static void MapFromDB(DBEntity input, ThisEntity output,
                                     bool includingParts)
        {
            output.Id            = input.Id;
            output.RowId         = input.RowId;
            output.EntityStateId = input.EntityStateId;
            output.Name          = input.Name == null ? "" : input.Name;
            output.Description   = input.Description == null ? "" : input.Description;
            output.CTID          = input.CTID;
            if (IsValidDate(input.DateEffective))
            {
                output.DateEffective = (( DateTime )input.DateEffective).ToString("yyyy-MM-dd");
            }
            else
            {
                output.DateEffective = "";
            }
            //
            output.LowEarnings       = input.LowEarnings ?? 0;
            output.MedianEarnings    = input.MedianEarnings ?? 0;
            output.HighEarnings      = input.HighEarnings ?? 0;
            output.PostReceiptMonths = input.PostReceiptMonths ?? 0;
            output.Source            = GetUrlData(input.Source);

            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)
            {
                //
                output.Jurisdiction = Entity_JurisdictionProfileManager.Jurisdiction_GetAll(output.RowId);
                //get datasetprofiles
                output.RelevantDataSet = DataSetProfileManager.GetAll(output.RowId, true);
            }
        }         //
        public static void MapFromDB(DBEntity from, ThisEntity to, bool includingItems = true)
        {
            to.Id       = from.Id;
            to.RowId    = from.RowId;
            to.ParentId = from.EntityId;

            to.Description = from.Description;

            to.RevocationCriteriaDescription = from.RevocationCriteriaDescription;
            to.RevocationCriteriaUrl         = from.RevocationCriteriaUrl;

            if (IsValidDate(from.DateEffective))
            {
                to.DateEffective = (( DateTime )from.DateEffective).ToString("yyyy-MM-dd");
            }
            else
            {
                to.DateEffective = "";
            }

            to.RevocationCriteriaUrl = from.RevocationCriteriaUrl;
            if ((from.Entity.EntityBaseName ?? "").Length > 3)
            {
                to.ParentSummary = from.Entity.EntityBaseName;
            }
            //not used:
            to.ProfileSummary = SetEntitySummary(to);
            //no longer using name, but need for the editor list
            to.ProfileName = to.ProfileSummary;


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

            if (includingItems)
            {
                to.CredentialProfiled = Entity_CredentialManager.GetAll(to.RowId);
                //
                to.Jurisdiction = Entity_JurisdictionProfileManager.Jurisdiction_GetAll(to.RowId);
                to.Region       = Entity_JurisdictionProfileManager.Jurisdiction_GetAll(to.RowId, Entity_JurisdictionProfileManager.JURISDICTION_PURPOSE_RESIDENT);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Parts:
        /// - Jurisdiction
        /// - DataSetProfile
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public bool UpdateParts(ThisEntity entity, ref SaveStatus status)
        {
            bool   isAllValid    = true;
            Entity relatedEntity = EntityManager.GetEntity(entity.RowId);

            if (relatedEntity == null || relatedEntity.Id == 0)
            {
                status.AddError("Error - the related Entity was not found.");
                return(false);
            }

            //ProcessProfile
            Entity_ProcessProfileManager ppm = new Factories.Entity_ProcessProfileManager();

            ppm.DeleteAll(relatedEntity, ref status);
            try
            {
                ppm.SaveList(entity.AdministrationProcess, Entity_ProcessProfileManager.ADMIN_PROCESS_TYPE, entity.RowId, ref status);
            }
            catch (Exception ex)
            {
                string message = FormatExceptions(ex);
                LoggingHelper.LogError(ex, thisClassName + string.Format(".AddProfiles() - ProcessProfiles. id: {0}", entity.Id));
                status.AddWarning(thisClassName + ".AddProfiles(). Exceptions encountered handling ProcessProfiles. " + message);
            }
            //
            Entity_ReferenceFrameworkManager erfm = new Entity_ReferenceFrameworkManager();

            erfm.DeleteAll(relatedEntity, ref status);
            if (erfm.SaveList(relatedEntity.Id, CodesManager.PROPERTY_CATEGORY_CIP, entity.InstructionalProgramTypes, ref status) == false)
            {
                isAllValid = false;
            }

            //JurisdictionProfile
            Entity_JurisdictionProfileManager jpm = new Entity_JurisdictionProfileManager();

            //do deletes - NOTE: other jurisdictions are added in: UpdateAssertedIns
            jpm.DeleteAll(relatedEntity, ref status);
            jpm.SaveList(entity.Jurisdiction, entity.RowId, Entity_JurisdictionProfileManager.JURISDICTION_PURPOSE_SCOPE, ref status);
            //datasetProfiles
            new DataSetTimeFrameManager().SaveList(entity.DataSetTimePeriod, entity.Id, ref status);


            return(isAllValid);
        }
        private bool UpdateParts(ThisEntity entity, ref SaveStatus status)
        {
            bool isAllValid = true;

            if (new Entity_ReferenceManager().Add(entity.Condition, entity.RowId, CodesManager.ENTITY_TYPE_CONDITION_PROFILE, ref status, CodesManager.PROPERTY_CATEGORY_CONDITION_ITEM, false) == false)
            {
                isAllValid = false;
            }

            //JurisdictionProfile
            Entity_JurisdictionProfileManager jpm = new Entity_JurisdictionProfileManager();

            jpm.SaveList(entity.Jurisdiction, entity.RowId, Entity_JurisdictionProfileManager.JURISDICTION_PURPOSE_SCOPE, ref status);

            if (entity.Items != null && entity.Items.Count > 0)
            {
                new CostProfileItemManager().SaveList(entity.Items, entity.Id, ref status);
            }

            return(isAllValid);
        }
Exemplo n.º 7
0
        public static void MapFromDB(DBEntity from, ThisEntity to,
                                     bool includingItems
                                     )
        {
            //TODO - add option for get during import to get less data
            to.Id    = from.Id;
            to.RowId = from.RowId;

            to.Description = (from.Description ?? "");
            //ProfileName is for display purposes
            to.ProfileName = to.Description.Length < 80 ? to.Description : to.Description.Substring(0, 79) + " ...";

            if (from.HolderMustAuthorize != null)
            {
                to.HolderMustAuthorize = ( bool )from.HolderMustAuthorize;
            }

            if (IsValidDate(from.DateEffective))
            {
                to.DateEffective = (( DateTime )from.DateEffective).ToShortDateString();
            }
            else
            {
                to.DateEffective = "";
            }

            to.SubjectWebpage                = from.SubjectWebpage;
            to.VerificationServiceUrl        = from.VerificationService;
            to.VerificationDirectory         = from.VerificationDirectory;
            to.VerificationMethodDescription = from.VerificationMethodDescription;

            if (IsGuidValid(from.OfferedByAgentUid))
            {
                to.OfferedByAgentUid = ( Guid )from.OfferedByAgentUid;
                to.OfferedByAgent    = OrganizationManager.GetBasics(to.OfferedByAgentUid);
            }

            if (includingItems)
            {
                //TODO 170803- need to chg to a list
                //only get if:
                //edit - get profile list
                //detail - get basic
                bool isForDetailPageCredential = true;

                to.TargetCredential = Entity_CredentialManager.GetAll(to.RowId, isForDetailPageCredential);

                to.EstimatedCost = CostProfileManager.GetAll(to.RowId);

                to.ClaimType = EntityPropertyManager.FillEnumeration(to.RowId, CodesManager.PROPERTY_CATEGORY_CLAIM_TYPE);

                to.Jurisdiction = Entity_JurisdictionProfileManager.Jurisdiction_GetAll(to.RowId, Entity_JurisdictionProfileManager.JURISDICTION_PURPOSE_SCOPE);

                to.Region = Entity_JurisdictionProfileManager.Jurisdiction_GetAll(to.RowId, Entity_JurisdictionProfileManager.JURISDICTION_PURPOSE_RESIDENT);
                to.JurisdictionAssertions = Entity_JurisdictionProfileManager.Jurisdiction_GetAll(to.RowId, Entity_JurisdictionProfileManager.JURISDICTION_PURPOSE_OFFERREDIN);

                //to.VerificationStatus = Entity_VerificationStatusManager.GetAll( to.Id );
            }


            if (IsValidDate(from.Created))
            {
                to.Created = ( DateTime )from.Created;
            }
            if (IsValidDate(from.LastUpdated))
            {
                to.LastUpdated = ( DateTime )from.LastUpdated;
            }
        }
        public static void MapFromDB(DBEntity from, ThisEntity to, bool includingItems, bool getForList)
        {
            to.Id    = from.Id;
            to.RowId = from.RowId;
            //HANDLE PROCESS TYPES
            if (from.ProcessTypeId != null && ( int )from.ProcessTypeId > 0)
            {
                to.ProcessTypeId = ( int )from.ProcessTypeId;
            }
            else
            {
                to.ProcessTypeId = 1;
            }

            to.ProfileName = to.ProcessType;
            //need to distinguish if for detail
            to.ProcessProfileType = GetProfileType(to.ProcessTypeId);

            to.Description = from.Description;
            if ((to.Description ?? "").Length > 5)
            {
                //this should just be the type now
                to.ProfileName = GetProfileType(to.ProcessTypeId);

                //to.ProfileName = to.Description.Length > 100 ? to.Description.Substring(0,100) + " . . ." : to.Description;
            }

            if (from.Entity != null)
            {
                to.ParentId = from.Entity.Id;
            }

            to.ProfileSummary = SetEntitySummary(to);

            //- provide minimum option, for lists
            if (getForList)
            {
                return;
            }

            if (IsGuidValid(from.ProcessingAgentUid))
            {
                to.ProcessingAgentUid = ( Guid )from.ProcessingAgentUid;

                to.ProcessingAgent = OrganizationManager.GetBasics(to.ProcessingAgentUid);
            }

            if (IsValidDate(from.DateEffective))
            {
                to.DateEffective = (( DateTime )from.DateEffective).ToString("yyyy-MM-dd");
            }
            else
            {
                to.DateEffective = "";
            }
            to.SubjectWebpage = from.SubjectWebpage;

            to.ProcessFrequency = from.ProcessFrequency;
            //to.TargetCompetencyFramework = from.TargetCompetencyFramework;
            //to.RequiresCompetenciesFrameworks = Entity_CompetencyFrameworkManager.GetAll( to.RowId, "requires" );

            to.ProcessMethod            = from.ProcessMethod;
            to.ProcessMethodDescription = from.ProcessMethodDescription;

            to.ProcessStandards            = from.ProcessStandards;
            to.ProcessStandardsDescription = from.ProcessStandardsDescription;

            to.ScoringMethodDescription        = from.ScoringMethodDescription;
            to.ScoringMethodExample            = from.ScoringMethodExample;
            to.ScoringMethodExampleDescription = from.ScoringMethodExampleDescription;
            to.VerificationMethodDescription   = from.VerificationMethodDescription;

            if (IsValidDate(from.DateEffective))
            {
                to.DateEffective = (( DateTime )from.DateEffective).ToString("yyyy-MM-dd");
            }
            else
            {
                to.DateEffective = "";
            }

            //enumerations
            to.DataCollectionMethodType = EntityPropertyManager.FillEnumeration(to.RowId, CodesManager.PROPERTY_CATEGORY_DATA_COLLECTION_METHOD_TYPE);
            to.ExternalInputType        = EntityPropertyManager.FillEnumeration(to.RowId, CodesManager.PROPERTY_CATEGORY_EXTERNAL_INPUT_TYPE);



            if (includingItems)
            {
                to.Jurisdiction = Entity_JurisdictionProfileManager.Jurisdiction_GetAll(to.RowId);
                //will only be one, but could model with multiple
                to.TargetCredential = Entity_CredentialManager.GetAll(to.RowId, BaseFactory.RELATIONSHIP_TYPE_HAS_PART);
                to.TargetAssessment = Entity_AssessmentManager.GetAll(to.RowId, BaseFactory.RELATIONSHIP_TYPE_HAS_PART);

                to.TargetLearningOpportunity = Entity_LearningOpportunityManager.LearningOpps_GetAll(to.RowId, true);
                to.TargetCompetencyFramework = Entity_CompetencyFrameworkManager.GetAll(to.RowId);
            }


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

            if (IsValidDate(from.LastUpdated))
            {
                to.LastUpdated = ( DateTime )from.LastUpdated;
            }
        }
Exemplo n.º 9
0
        public static void MapFromDB(DBEntity from, ThisEntity to, bool includingItems)
        {
            to.Id       = from.Id;
            to.RowId    = from.RowId;
            to.EntityId = from.EntityId;

            to.ProfileName = from.ProfileName;
            to.Description = from.Description;

            if (IsValidDate(from.ExpirationDate))
            {
                to.EndDate = (( DateTime )from.ExpirationDate).ToString("yyyy-MM-dd");
            }
            else
            {
                to.EndDate = "";
            }

            if (IsValidDate(from.DateEffective))
            {
                to.StartDate = (( DateTime )from.DateEffective).ToString("yyyy-MM-dd");
            }
            else
            {
                to.StartDate = "";
            }

            to.CostDetails = from.DetailsUrl;

            to.CurrencyTypeId = (int)(from.CurrencyTypeId ?? 0);
            Views.Codes_Currency code = CodesManager.GetCurrencyItem(to.CurrencyTypeId);
            if (code != null && code.NumericCode > 0)
            {
                to.Currency       = code.Currency;
                to.CurrencySymbol = code.HtmlCodes;
            }

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

            to.Condition = Entity_ReferenceManager.GetAll(to.RowId, CodesManager.PROPERTY_CATEGORY_CONDITION_ITEM);

            if (includingItems)
            {
                //TODO - the items should be part of the EF record
                if (from.Entity_CostProfileItem != null && from.Entity_CostProfileItem.Count > 0)
                {
                    CostProfileItem row = new CostProfileItem();
                    foreach (EM.Entity_CostProfileItem item in from.Entity_CostProfileItem)
                    {
                        row = new CostProfileItem();
                        //TODO
                        CostProfileItemManager.MapFromDB(item, row, true);
                        to.Items.Add(row);
                    }
                }

                to.Jurisdiction = Entity_JurisdictionProfileManager.Jurisdiction_GetAll(to.RowId);
                to.Region       = Entity_JurisdictionProfileManager.Jurisdiction_GetAll(to.RowId, Entity_JurisdictionProfileManager.JURISDICTION_PURPOSE_RESIDENT);
            }
        }
        public static void MapFromDB(DBEntity input, ThisEntity output,
                                     bool includingParts)
        {
            output.Id            = input.Id;
            output.RowId         = input.RowId;
            output.EntityStateId = input.EntityStateId;
            output.Name          = input.Name == null ? "" : input.Name;
            output.Description   = input.Description == null ? "" : input.Description;
            output.CTID          = input.CTID;
            if (IsValidDate(input.DateEffective))
            {
                output.DateEffective = (( DateTime )input.DateEffective).ToString("yyyy-MM-dd");
            }
            else
            {
                output.DateEffective = "";
            }
            //
            //output.JobsObtained = input.JobsObtained ?? 0;
            if (!string.IsNullOrEmpty(input.JobsObtainedJson))
            {
                var jp = JsonConvert.DeserializeObject <EmploymentOutcomeProfileProperties>(input.JobsObtainedJson);
                if (jp != null)
                {
                    //unpack JobsObtainedList
                    output.JobsObtainedList = jp.JobsObtainedList;
                }
            }

            output.Source = GetUrlData(input.Source);

            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)
            {
                //
                output.Jurisdiction = Entity_JurisdictionProfileManager.Jurisdiction_GetAll(output.RowId);
                //get datasetprofiles
                output.RelevantDataSet = DataSetProfileManager.GetAll(output.RowId, true);
            }
        }         //
Exemplo n.º 11
0
        public static void MapFromDB(DBEntity input, ThisEntity output)
        {
            output.Id                     = input.Id;
            output.RowId                  = input.RowId;
            output.Name                   = input.Name == null ? "" : input.Name;
            output.Description            = input.Description == null ? "" : input.Description;
            output.DemographicInformation = input.DemographicInformation == null ? "" : input.DemographicInformation;
            if (IsValidDate(input.DateEffective))
            {
                output.DateEffective = (( DateTime )input.DateEffective).ToString("yyyy-MM-dd");
            }
            else
            {
                output.DateEffective = "";
            }
            //
            output.NumberAwarded     = (input.NumberAwarded ?? 0);
            output.LowEarnings       = (input.LowEarnings ?? 0);
            output.MedianEarnings    = (input.MedianEarnings ?? 0);
            output.HighEarnings      = (input.HighEarnings ?? 0);
            output.PostReceiptMonths = (input.PostReceiptMonths ?? 0);
            output.Source            = GetUrlData(input.Source);

            output.Currency = input.Currency;
            Views.Codes_Currency code = CodesManager.GetCurrencyItem(output.Currency);
            if (code != null && code.NumericCode > 0)
            {
                output.Currency       = code.Currency;
                output.CurrencySymbol = code.HtmlCodes;
            }

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

            if (!string.IsNullOrEmpty(input.JobsObtainedJson))
            {
                var jobsObtained = JsonConvert.DeserializeObject <List <QuantitativeValue> >(input.JobsObtainedJson);
                if (jobsObtained != null)
                {
                    output.JobsObtained = jobsObtained;
                }
            }

            //=====
            //var relatedEntity = EntityManager.GetEntity( output.RowId, false );
            //if ( relatedEntity != null && relatedEntity.Id > 0 )
            //	output.EntityLastUpdated = relatedEntity.LastUpdated;

            //components

            //
            output.Jurisdiction = Entity_JurisdictionProfileManager.Jurisdiction_GetAll(output.RowId);
            //get datasetprofiles
            output.RelevantDataSet = DataSetProfileManager.GetAll(output.RowId, true);

            //==========
        }         //
Exemplo n.º 12
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);
            }
        }         //