Esempio n. 1
0
 /// <summary>Removes null and zero prices</summary>
 /// <param name="prices"></param>
 /// <param name="allZero">Directs to remove also prices with amounts 0</param>
 public static PriceList Clean(this PriceList prices, bool allZero = true)
 {
     prices.RemoveAll(p => Price.Z(p).IsZero || allZero && Price.Z(p) == Price.Zero);
     return(prices);
 }
 /// <summary>Reminder</summary>
 /// <exception cref = "PriceException">Thrown when currency units are not equal</exception>
 /// <exception cref = "PriceException">Thrown when VAT rates are not equal</exception>
 public static PriceList Rem(this PriceList prices, Price p)
 {
     prices.ForEach(pp => pp.Rem(p));
     return(prices);
 }
 /// <summary>Multiply a price</summary>
 public static PriceList Mul(this PriceList prices, decimal n)
 {
     prices.ForEach(p => p.Mul(n));
     return(prices);
 }
 /// <summary>Negation of prices</summary>
 public static PriceList Neg(this PriceList prices)
 {
     prices.ForEach(p => p.Neg());
     return(prices);
 }
 /// <summary>Absolute values of prices</summary>
 public static PriceList Abs(this PriceList prices)
 {
     prices.ForEach(p => p.Abs());
     return(prices);
 }
 /// <summary>Reverse sign</summary>
 public static PriceList ReverseSign(this PriceList prices)
 {
     prices.ForEach(p => p.ReverseSign());
     return(prices);
 }
 /// <summary>Replace "substring" with "replacement" in description; void for Zero price</summary>
 public static PriceList ReplaceInDescription(this PriceList prices, string substring, string replacement)
 {
     prices.ForEach(p => p.ReplaceInDescription(substring, replacement));
     return(prices);
 }
 /// <summary>Prepend "extension" to "description"; void for Zero prices</summary>
 public static PriceList PrependToDescription(this PriceList prices, string extension)
 {
     prices.ForEach(p => p.PrependToDescription(extension));
     return(prices);
 }
 /// <summary>Divide a price</summary>
 public static PriceList Div(this PriceList prices, double n) => prices.Mul(1 / (decimal)n);
 /// <summary>Multiply a price</summary>
 public static PriceList Mul(this PriceList prices, double n) => prices.Mul((decimal)n);