// public bool DoesEntityExist(string ctid, ref Framework entity) { bool exists = false; entity = EntityServices.GetCompetencyFrameworkByCtid(ctid); if (entity != null && entity.Id > 0) { return(true); } return(exists); }
/// <summary> /// Retrieve an resource from the registry by ctid and do import /// </summary> /// <param name="ctid"></param> /// <param name="status"></param> /// <returns></returns> public bool ImportByCtid(string ctid, SaveStatus status) { if (string.IsNullOrWhiteSpace(ctid)) { status.AddError(thisClassName + ".ImportByCtid - a valid ctid must be provided"); return(false); } //this is currently specific, assumes envelop contains a credential //can use the hack for GetResourceType to determine the type, and then call the appropriate import method string statusMessage = ""; EntityServices mgr = new EntityServices(); string ctdlType = ""; try { //probably always want to get by envelope ReadEnvelope envelope = RegistryServices.GetEnvelopeByCtid(ctid, ref statusMessage, ref ctdlType); if (envelope != null && !string.IsNullOrWhiteSpace(envelope.EnvelopeIdentifier)) { return(CustomProcessEnvelope(envelope, status)); } else { return(false); } } catch (Exception ex) { LoggingHelper.LogError(ex, thisClassName + string.Format(".ImportByCtid(). CTID: {0}", ctid)); status.AddError(ex.Message); if (ex.Message.IndexOf("Path '@context', line 1") > 0) { status.AddWarning("The referenced registry document is using an old schema. Please republish it with the latest schema!"); } return(false); } }