private bool UpdateParts(ThisEntity entity, ref SaveStatus status) { bool isAllValid = true; //EntityPropertyManager mgr = new EntityPropertyManager(); Entity_ReferenceManager erm = new Entity_ReferenceManager(); if (erm.AddTextValue(entity.SocialMediaPages, entity.RowId, ref status, CodesManager.PROPERTY_CATEGORY_ORGANIZATION_SOCIAL_MEDIA) == false) { isAllValid = false; } if (erm.AddTextValue(entity.Emails, entity.RowId, ref status, CodesManager.PROPERTY_CATEGORY_EMAIL_TYPE) == false) { isAllValid = false; } if (erm.AddTextValue(entity.PhoneNumbers, entity.RowId, ref status, CodesManager.PROPERTY_CATEGORY_PHONE_TYPE) == false) { isAllValid = false; } return(isAllValid); }
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); } } }
public static void MapFromDB(DBEntity from, ThisEntity to, bool includingItems = true) { to.Id = from.Id; to.RowId = from.RowId; to.ParentId = from.ParentEntityId; if (from.Entity != null) { to.ParentRowId = from.Entity.EntityUid; } to.ProfileName = from.Name; to.ContactType = from.ContactType; //to.ContactOption = from.ContactOption; string summary = "Contact Point "; if (string.IsNullOrWhiteSpace(to.ProfileName)) { if (!string.IsNullOrWhiteSpace(to.ContactType)) { to.ProfileName = to.ContactType; to.ContactType = ""; } } if (string.IsNullOrWhiteSpace(to.ProfileName)) { if (string.IsNullOrWhiteSpace(to.ProfileName) && from.Entity != null) { to.ProfileName = from.Entity.EntityBaseName ?? "Contact Point"; } else { to.ProfileName = summary; } } if (includingItems) { to.SocialMedia = Entity_ReferenceManager.GetAll(to.RowId, CodesManager.PROPERTY_CATEGORY_ORGANIZATION_SOCIAL_MEDIA); to.PhoneNumber = Entity_ReferenceManager.GetAll(to.RowId, CodesManager.PROPERTY_CATEGORY_PHONE_TYPE); to.Email = Entity_ReferenceManager.GetAll(to.RowId, CodesManager.PROPERTY_CATEGORY_EMAIL_TYPE); to.FaxNumber = Entity_ReferenceManager.GetAllToList(to.RowId, CodesManager.PROPERTY_CATEGORY_PHONE_TYPE_FAX); } if (IsValidDate(from.Created)) { to.Created = ( DateTime )from.Created; } if (IsValidDate(from.LastUpdated)) { to.LastUpdated = ( DateTime )from.LastUpdated; } }
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); }
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) { 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); } }