protected bool Equals(LomadeeCoupon other) { return(Id == other.Id && Description == other.Description && FriendlyDescription == other.FriendlyDescription && Remark == other.Remark && Code == other.Code && Discount == other.Discount && Equals(Store, other.Store) && Equals(Category, other.Category) && Vigency.Equals(other.Vigency) && Equals(Link, other.Link) && New == other.New && IsPercentage == other.IsPercentage && Shipping == other.Shipping); }
private static decimal TryGetDiscountFromDescriptionProperty(LomadeeCoupon source) { var description = source.Description.Replace("R$", string.Empty) .Replace(" ", string.Empty).Trim(); var builder = new StringBuilder(); foreach (var str in description) { if (!char.IsDigit(str) && str != ',') { break; // When I find any non-decimal characters, I end the operation. } builder.Append(str == ',' ? '.' : str); } var number = builder.ToString(); return(string.IsNullOrWhiteSpace(number) ? 0 : decimal.Parse(number)); }