/// <summary> /// Compares two PAs by their Ids and PAs values. /// </summary> /// <param name="self">A PA to compare.</param> /// <param name="attribute">Another PA to compare.</param> /// <returns></returns> public static bool IsEqualTo(this NdDocumentAttribute self, NdDocumentAttribute attribute) { if (self == null || attribute == null) { throw new ArgumentNullException("Aguments shouldn't be null."); } return(self.Id.Equals(attribute.Id) && self.Values.Count.Equals(attribute.Values.Count) && self.Values.SequenceEqual(attribute.Values) && self.DateValue.Equals(attribute.DateValue)); }
/// <summary> /// Converts NetDocuments.Rest.Client.DTO.NdDocumentAttribute object to NetDocuments.Client.COM.Models.ProfileAttribute. /// </summary> /// <param name="attribute">NetDocuments.Rest.Client.DTO.NdDocumentAttribute object to convert.</param> /// <returns>NetDocuments.Client.COM.Models.ProfileAttribute object.</returns> public static ProfileAttribute ToProfileAttribute(this NdDocumentAttribute attribute) { var profileAttribute = new ProfileAttribute { Id = attribute.Id }; if (attribute.Values?.FirstOrDefault() != null) { profileAttribute.Value = attribute.Values.FirstOrDefault(); } else if (attribute.Value != null) { profileAttribute.Value = attribute.Value; } else { profileAttribute.Value = attribute.DateValue.ToShortDateString(); } return(profileAttribute); }