protected FormField GetMetadataSetField(string metadatasetGuid, string fieldName) { CFMetadataSet metadataSet = MetadataSets.Where(ms => ms.Guid == metadatasetGuid).FirstOrDefault(); if (metadataSet == null) { return(null); } FormField field = metadataSet.Fields.Where(f => f.Name == fieldName).FirstOrDefault(); return(field); }
protected void SetAttributeMappingValue(string name, string val, string lang = null, bool removePrevious = false) { CFEntityTypeAttributeMapping mapping = EntityType.AttributeMappings.Where(m => m.Name == name).FirstOrDefault(); if (mapping == null) { throw new Exception(string.Format("{0} mapping metadata set is not specified for this entity type", name)); } if (string.IsNullOrEmpty(mapping.FieldName)) { throw new Exception(string.Format("Field is not specified in the {0} Mapping of this entity type", name)); } CFMetadataSet metadataSet = MetadataSets.Where(ms => ms.Guid == mapping.MetadataSet.Guid).FirstOrDefault(); metadataSet.SetFieldValue(mapping.FieldName, val, lang, removePrevious); }