public bool UpdateParts(ThisEntity entity, ref SaveStatus status) { bool isAllValid = true; Entity_AgentRelationshipManager mgr = new Entity_AgentRelationshipManager(); Entity relatedEntity = EntityManager.GetEntity(entity.RowId); if (relatedEntity == null || relatedEntity.Id == 0) { status.AddError("Error - the related Entity was not found."); return(false); } mgr.DeleteAll(relatedEntity, ref status); mgr.SaveList(relatedEntity.Id, Entity_AgentRelationshipManager.ROLE_TYPE_OWNER, entity.OwnedBy, ref status); //initial plan is store whole payload as json Entity_ReferenceFrameworkManager erfm = new Entity_ReferenceFrameworkManager(); erfm.DeleteAll(relatedEntity, ref status); if (erfm.SaveList(relatedEntity.Id, CodesManager.PROPERTY_CATEGORY_SOC, entity.Occupations, ref status) == false) { isAllValid = false; } if (erfm.SaveList(relatedEntity.Id, CodesManager.PROPERTY_CATEGORY_NAICS, entity.Industries, ref status) == false) { isAllValid = false; } // Entity_ReferenceManager erm = new Entity_ReferenceManager(); erm.DeleteAll(relatedEntity, ref status); if (erm.Add(entity.Subject, entity.RowId, CodesManager.ENTITY_TYPE_PATHWAY, ref status, CodesManager.PROPERTY_CATEGORY_SUBJECT, false) == false) { isAllValid = false; } if (erm.Add(entity.Keyword, entity.RowId, CodesManager.ENTITY_TYPE_PATHWAY, ref status, CodesManager.PROPERTY_CATEGORY_KEYWORD, false) == false) { isAllValid = false; } return(isAllValid); }
/// <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); }