/// <summary> /// Output all properties /// </summary> /// <returns>A string</returns> public override string ToString() { var toString = new StringBuilder(); toString.Append("Id: ").AppendLine(Id); toString.Append("Title: ").AppendLine(Title); toString.Append("Description: ").AppendLine(Description); toString.Append("FreeAtPrice: ").AppendLine(FreeAtPrice.ToString(CultureInfo.InvariantCulture)); toString.Append("Price: ").AppendLine(Price.ToString(CultureInfo.InvariantCulture)); toString.Append("Currency: ").AppendLine(Currency); toString.Append("MinimumDeliveryDays: ").AppendLine(MinimumDeliveryDays.ToString(CultureInfo.InvariantCulture)); toString.Append("MaximumDeliveryDays: ").AppendLine(MaximumDeliveryDays.ToString(CultureInfo.InvariantCulture)); toString.Append("Regions: ").AppendLine(Regions.Count.ToString(CultureInfo.InvariantCulture)); foreach (var region in Regions) { toString.Append("Region:").AppendLine(region); } toString.Append("CreatedAt: ").AppendLine(CreatedAt.ToString(CultureInfo.InvariantCulture)); if (ModifiedAt.HasValue) { toString.Append("ModifiedAt: ").AppendLine(ModifiedAt.Value.ToString(CultureInfo.InvariantCulture)).AppendLine(); } toString.Append("Currency: ").AppendLine(Currency); return(toString.ToString()); }
/// <summary> /// Converts the current object to an Xml representation /// </summary> /// <returns>System.String containing an Xml representation of the current object</returns> public string ToXml() { var xml = new XElement(_objectName, new XElement("id", Id), Name != null ? new XElement("name", Name) : null, !MinimumDeliveryDays.IsNullOrZero() ? new XElement("min_delivery_days", MinimumDeliveryDays.ToString()) : null, !MaximumDeliveryDays.IsNullOrZero() ? new XElement("max_delivery_days", MaximumDeliveryDays.ToString()) : null, Test == true ? new XElement("test", Test.ToInt()) : null, !CreatedDttm.IsNullOrDefault() ? new XElement("created", ((DateTime)CreatedDttm).ToString("yyyy-MM-dd HH:mm:ss")) : null, !UpdatedDttm.IsNullOrDefault() ? new XElement("updated", ((DateTime)UpdatedDttm).ToString("yyyy-MM-dd HH:mm:ss")) : null, !DeletedDttm.IsNullOrDefault() ? new XElement("deleted", ((DateTime)DeletedDttm).ToString("yyyy-MM-dd HH:mm:ss")) : null ); return(xml.ToString()); }