public override bool Equals(object obj)
        {
            LookupFieldValue other = obj as LookupFieldValue;

            if (other != null)
            {
                return(DisplayText == other.DisplayText && LinkUrl == other.LinkUrl);
            }
            return(base.Equals(obj));
        }
Exemplo n.º 2
0
        private void writeLookupFieldValue(LookupFieldValue lookupFieldValue)
        {
            if (lookupFieldValue == null)
            {
                return;
            }

            writer.WriteStartElement("LookupFieldValue", Namespaces[Constants.esriMappingPrefix]);
            if (!string.IsNullOrEmpty(lookupFieldValue.DisplayText))
            {
                writer.WriteAttributeString("DisplayText", lookupFieldValue.DisplayText);
            }
            if (!string.IsNullOrEmpty(lookupFieldValue.LinkUrl))
            {
                writer.WriteAttributeString("LinkUrl", lookupFieldValue.LinkUrl);
            }
            writer.WriteEndElement();
        }
        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);
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
        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 writeLookupFieldValue(LookupFieldValue lookupFieldValue)
        {
            if (lookupFieldValue == null)
                return;

            writer.WriteStartElement("LookupFieldValue", Namespaces[Constants.esriMappingPrefix]);
            if (!string.IsNullOrEmpty(lookupFieldValue.DisplayText))
                writer.WriteAttributeString("DisplayText", lookupFieldValue.DisplayText);
            if (!string.IsNullOrEmpty(lookupFieldValue.LinkUrl))
                writer.WriteAttributeString("LinkUrl", lookupFieldValue.LinkUrl);
            writer.WriteEndElement();
        }