public static string ExtractHyperlinkValue(object value, bool returnUrl) { HyperlinkImageFieldValue hyperlinkImageFieldValue = value as HyperlinkImageFieldValue; if (hyperlinkImageFieldValue != null) { return(returnUrl ? hyperlinkImageFieldValue.ImageUrl : hyperlinkImageFieldValue.ImageTooltip); } else { EntityFieldValue entityFieldValue = value as EntityFieldValue; if (entityFieldValue != null) { return(returnUrl ? entityFieldValue.LinkUrl : entityFieldValue.DisplayText); } else { LookupFieldValue lookupFieldValue = value as LookupFieldValue; if (lookupFieldValue != null) { return(returnUrl ? lookupFieldValue.LinkUrl : lookupFieldValue.DisplayText); } else { HyperlinkFieldValue hyperlinkFieldValue = value as HyperlinkFieldValue; if (hyperlinkFieldValue != null) { return(returnUrl ? hyperlinkFieldValue.LinkUrl : hyperlinkFieldValue.DisplayText); } else { return(value as string); } } } } }
private void writeUniqueValueObj(object uniqueValueInfo) { if (uniqueValueInfo == null) { return; } NumericFieldValue numericFieldValue = uniqueValueInfo as NumericFieldValue; if (numericFieldValue != null) { writer.WriteStartElement("UniqueValueInfoObj.SerializedValue", Namespaces[Constants.esriMappingPrefix]); writeNumericFieldValue(numericFieldValue); writer.WriteEndElement(); return; } AttachmentFieldValue attFieldValue = uniqueValueInfo as AttachmentFieldValue; if (attFieldValue != null) { writer.WriteStartElement("UniqueValueInfoObj.SerializedValue", Namespaces[Constants.esriMappingPrefix]); writeAttachmentFieldValue(attFieldValue); writer.WriteEndElement(); return; } CurrencyFieldValue currFieldValue = uniqueValueInfo as CurrencyFieldValue; if (currFieldValue != null) { writer.WriteStartElement("UniqueValueInfoObj.SerializedValue", Namespaces[Constants.esriMappingPrefix]); writeCurrencyFieldValue(currFieldValue); writer.WriteEndElement(); return; } EntityFieldValue entityFieldValue = uniqueValueInfo as EntityFieldValue; if (entityFieldValue != null) { writer.WriteStartElement("UniqueValueInfoObj.SerializedValue", Namespaces[Constants.esriMappingPrefix]); writeEntityFieldValue(entityFieldValue); writer.WriteEndElement(); return; } HyperlinkFieldValue hyperlinkFieldValue = uniqueValueInfo as HyperlinkFieldValue; if (hyperlinkFieldValue != null) { writer.WriteStartElement("UniqueValueInfoObj.SerializedValue", Namespaces[Constants.esriMappingPrefix]); writeHyperlinkFieldValue(hyperlinkFieldValue); writer.WriteEndElement(); return; } HyperlinkImageFieldValue hyperlinkImageFieldValue = uniqueValueInfo as HyperlinkImageFieldValue; if (hyperlinkImageFieldValue != null) { writer.WriteStartElement("UniqueValueInfoObj.SerializedValue", Namespaces[Constants.esriMappingPrefix]); writeHyperlinkImageFieldValue(hyperlinkImageFieldValue); writer.WriteEndElement(); return; } LookupFieldValue lookupFieldValue = uniqueValueInfo as LookupFieldValue; if (lookupFieldValue != null) { writer.WriteStartElement("UniqueValueInfoObj.SerializedValue", Namespaces[Constants.esriMappingPrefix]); writeLookupFieldValue(lookupFieldValue); writer.WriteEndElement(); return; } DateTimeFieldValue dateTimeFieldValue = uniqueValueInfo as DateTimeFieldValue; if (dateTimeFieldValue != null) { writer.WriteStartElement("UniqueValueInfoObj.SerializedValue", Namespaces[Constants.esriMappingPrefix]); writeDateTimeFieldValue(dateTimeFieldValue); writer.WriteEndElement(); return; } if (uniqueValueInfo is double) { writer.WriteAttributeString("SerializedValue", ((double)uniqueValueInfo).ToString(CultureInfo.InvariantCulture)); } else { writer.WriteAttributeString("SerializedValue", uniqueValueInfo.ToString()); } }
private void writeEntityFieldValue(EntityFieldValue entityFieldValue) { if (entityFieldValue == null) return; writer.WriteStartElement("EntityFieldValue", Namespaces[Constants.esriMappingPrefix]); if (!string.IsNullOrEmpty(entityFieldValue.DisplayText)) writer.WriteAttributeString("DisplayText", entityFieldValue.DisplayText); if (!string.IsNullOrEmpty(entityFieldValue.LinkUrl)) writer.WriteAttributeString("LinkUrl", entityFieldValue.LinkUrl); writer.WriteEndElement(); }