/// <summary> /// Constructor of CommValueDetails object /// </summary> /// <param name="detailsToCopy">The object we want to clone from</param> internal CommValueDetails(ICommValueDetails detailsToCopy) { if (detailsToCopy == null || detailsToCopy.CommLines.Count == 0) throw new ApplicationException("It is not possible to clone the commissiondetails when they are null"); foreach (ICommValueBreakupLine line in detailsToCopy.CommLines) { AddLine(line.CalcType, line.CalcValue, line.CalcInfo); } }
/// <summary> /// Constructor of CommValueDetails object /// </summary> /// <param name="detailsToCopy">The object we want to clone from</param> /// <param name="commCurrency">The new currency to convert to</param> /// <param name="detailsToCopy">The ex rate to use</param> internal CommValueDetails(ICommValueDetails detailsToCopy, ICurrency commCurrency, decimal exRate) { Money commission; if (detailsToCopy == null || detailsToCopy.CommLines.Count == 0) throw new ApplicationException("It is not possible to clone the commissiondetails when they are null"); foreach (ICommValueBreakupLine line in detailsToCopy.CommLines) { if (line.CommCurrency.Equals(commCurrency)) commission = line.CalcValue; else commission = line.CalcValue.Convert(exRate, commCurrency); AddLine(line.CalcType, commission, line.CalcInfo); } }