/// <summary> /// Convert current product price to other currency using currency exchange rate /// </summary> /// <param name="currency"></param> /// <returns></returns> public ProductPrice ConvertTo(Currency currency) { var retVal = new ProductPrice(currency); retVal.ListPrice = ListPrice.ConvertTo(currency); retVal.SalePrice = SalePrice.ConvertTo(currency); retVal.SalePriceWithTax = SalePriceWithTax.ConvertTo(currency); retVal.ListPriceWithTax = ListPriceWithTax.ConvertTo(currency); retVal.ProductId = ProductId; if (ActiveDiscount != null) { retVal.ActiveDiscount = ActiveDiscount.ConvertTo(currency); } if (PotentialDiscount != null) { retVal.PotentialDiscount = PotentialDiscount.ConvertTo(currency); } return(retVal); }
public override object Clone() { var result = base.Clone() as LineItem; result.ListPrice = ListPrice?.Clone() as Money; result.SalePrice = SalePrice?.Clone() as Money; result.DiscountAmount = DiscountAmount?.Clone() as Money; result.DiscountAmountWithTax = DiscountAmountWithTax?.Clone() as Money; result.DiscountTotal = DiscountTotal?.Clone() as Money; result.DiscountTotalWithTax = DiscountTotalWithTax?.Clone() as Money; result.ListPriceWithTax = ListPriceWithTax?.Clone() as Money; result.SalePriceWithTax = SalePriceWithTax?.Clone() as Money; result.PlacedPrice = PlacedPrice?.Clone() as Money; result.PlacedPriceWithTax = PlacedPriceWithTax?.Clone() as Money; result.ExtendedPrice = ExtendedPrice?.Clone() as Money; result.ExtendedPriceWithTax = ExtendedPriceWithTax?.Clone() as Money; result.TaxTotal = TaxTotal?.Clone() as Money; if (Discounts != null) { result.Discounts = new List <Discount>(Discounts.Select(x => x.Clone() as Discount)); } if (TaxDetails != null) { result.TaxDetails = new List <TaxDetail>(TaxDetails.Select(x => x.Clone() as TaxDetail)); } if (DynamicProperties != null) { result.DynamicProperties = new MutablePagedList <DynamicProperty>(DynamicProperties.Select(x => x.Clone() as DynamicProperty)); } if (ValidationErrors != null) { result.ValidationErrors = new List <ValidationError>(ValidationErrors.Select(x => x.Clone() as ValidationError)); } return(result); }