Example #1
0
 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);
 }
Example #2
0
        public void UpdateProperties()
        {
            // Update description and remark
            var(description, remark) = ExtractDescriptionAndRemark(Description);
            Description = description;
            Remark      = remark;
            // Update discount
            var parsed = decimal.TryParse(OriginalDiscount, out var discount);

            Discount = parsed && discount > 0 ? discount : TryGetDiscountFromDescriptionProperty(this);

            // Friendly name
            FriendlyDescription = description.ToFriendlyName();

            IsPercentage = string.IsNullOrWhiteSpace(Description) || !Description.Contains("$");
            Shipping     = !string.IsNullOrWhiteSpace(Description) && Description.Contains("frete", StringComparison.OrdinalIgnoreCase);

            Vigency = Vigency.ToUniversalTime();
        }
Example #3
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id.GetHashCode();
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FriendlyDescription != null ? FriendlyDescription.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Remark != null ? Remark.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Code != null ? Code.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Discount.GetHashCode();
         hashCode = (hashCode * 397) ^ (Store != null ? Store.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Category != null ? Category.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Vigency.GetHashCode();
         hashCode = (hashCode * 397) ^ (Link != null ? Link.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ New.GetHashCode();
         hashCode = (hashCode * 397) ^ IsPercentage.GetHashCode();
         hashCode = (hashCode * 397) ^ Shipping.GetHashCode();
         return(hashCode);
     }
 }