private bool UpdateParts(ThisEntity entity, ref SaveStatus status) { bool isAllValid = true; EntityPropertyManager mgr = new EntityPropertyManager(); if (mgr.AddProperties(entity.ClaimType, entity.RowId, CodesManager.ENTITY_TYPE_PROCESS_PROFILE, CodesManager.PROPERTY_CATEGORY_CLAIM_TYPE, false, ref status) == false) { isAllValid = false; } //CostProfile CostProfileManager cpm = new Factories.CostProfileManager(); cpm.SaveList(entity.EstimatedCost, entity.RowId, ref status); int newId = 0; if (entity.TargetCredentialIds != null && entity.TargetCredentialIds.Count > 0) { Entity_CredentialManager ecm = new Entity_CredentialManager(); foreach (int id in entity.TargetCredentialIds) { ecm.Add(entity.RowId, id, ref newId, ref status); } } return(isAllValid); }
public static void MapFromDB(DBEntity from, ThisEntity to) { to.Id = from.Id; to.RowId = from.RowId; to.ParentId = from.EntityId; to.Name = GetData(from.Name); to.SubjectWebpage = GetData(from.SubjectWebpage); to.Description = GetData(from.Description); to.FinancialAssistanceType = EntityPropertyManager.FillEnumeration(to.RowId, CodesManager.PROPERTY_CATEGORY_FINANCIAL_ASSISTANCE); to.FinancialAssistanceValueJson = from.FinancialAssistanceValue; if (!string.IsNullOrWhiteSpace(to.FinancialAssistanceValueJson)) { to.FinancialAssistanceValue = JsonConvert.DeserializeObject <List <QuantitativeValue> >(to.FinancialAssistanceValueJson); to.FinancialAssistanceValueSummary = SummarizeFinancialAssistanceValue(to.FinancialAssistanceValue); } if (IsValidDate(from.Created)) { to.Created = ( DateTime )from.Created; } if (IsValidDate(from.LastUpdated)) { to.LastUpdated = ( DateTime )from.LastUpdated; } }
private 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); } EntityPropertyManager mgr = new EntityPropertyManager(); //first clear all properties mgr.DeleteAll(relatedEntity, ref status); // if (mgr.AddProperties(entity.ExternalInputType, entity.RowId, CodesManager.ENTITY_TYPE_PROCESS_PROFILE, CodesManager.PROPERTY_CATEGORY_EXTERNAL_INPUT_TYPE, false, ref status) == false) { isAllValid = false; } if (mgr.AddProperties(entity.DataCollectionMethodType, entity.RowId, CodesManager.ENTITY_TYPE_PROCESS_PROFILE, CodesManager.PROPERTY_CATEGORY_DATA_COLLECTION_METHOD_TYPE, false, ref status) == false) { isAllValid = false; } if (HandleTargets(entity, relatedEntity, ref status) == false) { isAllValid = false; } // return(isAllValid); }
public bool UpdateProperties(ThisEntity entity, Entity relatedEntity, ref SaveStatus status) { bool isAllValid = true; EntityPropertyManager mgr = new EntityPropertyManager(); //first clear all propertiesd //mgr.DeleteAll( relatedEntity, ref status ); //Entity_ReferenceManager erm = new Entity_ReferenceManager(); //already did a deleteAll in UpdateParts return(isAllValid); }
public static void MapFromDB(DBEntity from, ThisEntity to, bool includingProperties) { to.Id = from.Id; to.RowId = from.RowId; to.CostProfileId = from.CostProfileId; to.CostTypeId = from.CostTypeId; if (from.Codes_PropertyValue != null) { to.CostTypeName = from.Codes_PropertyValue.Title; to.CostTypeSchema = from.Codes_PropertyValue.SchemaName; to.ProfileName = from.Codes_PropertyValue.Title; EnumeratedItem item = new EnumeratedItem(); item.Id = to.CostTypeId; item.Value = to.CostTypeId.ToString(); item.Selected = true; item.Name = to.CostTypeName; item.SchemaName = to.CostTypeSchema; to.DirectCostType.Items.Add(item); } //NA 3/17/2017 - Need this to fix null errors in publishing and detail page, but it isn't working: no item is selected, and it's not clear why. //mp 18-11-02 - COPIED this from publisher: no item, because the Fill method looks for data in Entity.Property, and the cost type id is stored on CostProfileItem ==> NOW HANDLED ABOVE //to.DirectCostType = EntityPropertyManager.FillEnumeration( to.RowId, CodesManager.PROPERTY_CATEGORY_CREDENTIAL_ATTAINMENT_COST ); to.Price = from.Price == null ? 0 : ( decimal )from.Price; to.PaymentPattern = from.PaymentPattern; if (IsValidDate(from.Created)) { to.Created = ( DateTime )from.Created; } if (IsValidDate(from.LastUpdated)) { to.LastUpdated = ( DateTime )from.LastUpdated; } //properties if (includingProperties) { to.ApplicableAudienceType = EntityPropertyManager.FillEnumeration(to.RowId, CodesManager.PROPERTY_CATEGORY_AUDIENCE_TYPE); to.ResidencyType = EntityPropertyManager.FillEnumeration(to.RowId, CodesManager.PROPERTY_CATEGORY_RESIDENCY_TYPE); } }
private bool UpdateParts(ThisEntity entity, ref SaveStatus status) { bool isAllValid = true; EntityPropertyManager mgr = new EntityPropertyManager(); if (mgr.AddProperties(entity.ApplicableAudienceType, entity.RowId, CodesManager.ENTITY_TYPE_COST_PROFILE_ITEM, CodesManager.PROPERTY_CATEGORY_AUDIENCE_TYPE, false, ref status) == false) { isAllValid = false; } if (mgr.AddProperties(entity.ResidencyType, entity.RowId, CodesManager.ENTITY_TYPE_COST_PROFILE_ITEM, CodesManager.PROPERTY_CATEGORY_RESIDENCY_TYPE, false, ref status) == false) { isAllValid = false; } return(isAllValid); }
private bool UpdateParts(ThisEntity entity, ref SaveStatus status) { bool isAllValid = true; EntityPropertyManager mgr = new EntityPropertyManager(); if (mgr.AddProperties(entity.ExternalInput, entity.RowId, CodesManager.ENTITY_TYPE_PROCESS_PROFILE, CodesManager.PROPERTY_CATEGORY_EXTERNAL_INPUT_TYPE, false, ref status) == false) { isAllValid = false; } if (HandleTargets(entity, ref status) == false) { isAllValid = false; } // return(isAllValid); }
public static void MapFromDB(DBEntity from, ThisEntity to) { to.Id = from.Id; to.RowId = from.RowId; to.ParentId = from.EntityId; to.Name = GetData(from.Name); to.SubjectWebpage = GetData(from.SubjectWebpage); to.Description = GetData(from.Description); to.FinancialAssistanceType = EntityPropertyManager.FillEnumeration(to.RowId, CodesManager.PROPERTY_CATEGORY_FINANCIAL_ASSISTANCE); if (IsValidDate(from.Created)) { to.Created = ( DateTime )from.Created; } if (IsValidDate(from.LastUpdated)) { to.LastUpdated = ( DateTime )from.LastUpdated; } }
public bool UpdateParts(ThisEntity entity, bool isAdd, ref SaveStatus status) { bool isValid = true; EntityPropertyManager mgr = new EntityPropertyManager(); if (mgr.AddProperties(entity.JurisdictionAssertion, entity.RowId, CodesManager.ENTITY_TYPE_JURISDICTION_PROFILE, CodesManager.PROPERTY_CATEGORY_JurisdictionAssertionType, false, ref status) == false) { isValid = false; } int id = GeoCoordinates_Add(entity.MainJurisdiction, entity.Id, ref status); if (entity.JurisdictionException != null) { foreach (var gc in entity.JurisdictionException) { GeoCoordinates_Add(gc, entity.Id, ref status); } } return(isValid); }
private 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); } EntityPropertyManager mgr = new EntityPropertyManager(); //first clear all properties mgr.DeleteAll(relatedEntity, ref status); // if (mgr.AddProperties(entity.ClaimType, entity.RowId, CodesManager.ENTITY_TYPE_PROCESS_PROFILE, CodesManager.PROPERTY_CATEGORY_CLAIM_TYPE, false, ref status) == false) { isAllValid = false; } //CostProfile CostProfileManager cpm = new Factories.CostProfileManager(); cpm.SaveList(entity.EstimatedCost, entity.RowId, ref status); int newId = 0; Entity_CredentialManager ecm = new Entity_CredentialManager(); ecm.DeleteAll(relatedEntity, ref status); if (entity.TargetCredentialIds != null && entity.TargetCredentialIds.Count > 0) { foreach (int id in entity.TargetCredentialIds) { ecm.Add(entity.RowId, id, BaseFactory.RELATIONSHIP_TYPE_HAS_PART, ref newId, ref status); } } return(isAllValid); }
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 for financial assistance profile."); return(false); } EntityPropertyManager mgr = new EntityPropertyManager(); //first clear all properties mgr.DeleteAll(relatedEntity, ref status); if (mgr.AddProperties(entity.FinancialAssistanceType, entity.RowId, CodesManager.ENTITY_TYPE_FINANCIAL_ASST_PROFILE, CodesManager.PROPERTY_CATEGORY_FINANCIAL_ASSISTANCE, false, ref status) == false) { isAllValid = false; } return(isAllValid); } //
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); }
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; } }