using System.Collections.Generic;
namespace Api.Framework.Data.TB
{
///
/// 优惠券信息数据
///
public class CouponData
{
///
/// 优惠券金额
///
public decimal CouponPrice { get; set; }
///
/// 优惠券条件金额
///
public decimal ConditionPrice { get; set; }
///
/// 优惠券地址
///
public string CouponUrl { get; set; }
///
/// 优惠券ID
///
public string ActivityId { get; set; }
}
public class CouponDataComparer : IComparer
{
public int Compare(CouponData x, CouponData y)
{
if (x == null || y == null)
{
return 0;
}
if (x.ConditionPrice == y.ConditionPrice)
{
var result = x.CouponPrice - y.CouponPrice;
if (result == 0)
{
return 0;
}
if (result > 0)
{
return -1;
}
else
{
return 1;
}
}
else if (x.ConditionPrice > y.ConditionPrice)
{
return -1;
}
else if (x.ConditionPrice < y.ConditionPrice)
{
return 1;
}
return -1;
}
}
}