public virtual void Clone(BaseOffer offer) { var properties = typeof(BaseOffer).GetProperties().Where(p => p.CanRead && p.CanWrite); foreach (var property in properties) { var value = property.GetValue(offer, null); property.SetValue(this, value, null); } }
public static decimal Calculate(IEnumerable <MarkupConfig> markups, BaseOffer offer, User user, Address address) { if (offer == null) { return(0); } if (address == null) { return(0); } var type = offer.GetMarkupType(); var cost = user.IsDelayOfPaymentEnabled && !user.ShowSupplierCost ? offer.GetResultCost() : offer.Cost; return((Calculate(markups, type, cost, address)?.Markup).GetValueOrDefault()); }
protected BaseOffer(BaseOffer offer) { Clone(offer); }