public Calculation(XmlNode xmlNode) { XmlNodeList notionalScheduleNodeList = xmlNode.SelectNodes("notionalSchedule"); if (notionalScheduleNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in notionalScheduleNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { notionalScheduleIDRef = item.Attributes["id"].Name; Notional ob = Notional(); IDManager.SetID(notionalScheduleIDRef, ob); } else if (item.Attributes.ToString() == "href") { notionalScheduleIDRef = item.Attributes["href"].Name; } else { notionalSchedule = new Notional(item); } } } XmlNodeList fxLinkedNotionalScheduleNodeList = xmlNode.SelectNodes("fxLinkedNotionalSchedule"); if (fxLinkedNotionalScheduleNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in fxLinkedNotionalScheduleNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { fxLinkedNotionalScheduleIDRef = item.Attributes["id"].Name; FxLinkedNotionalSchedule ob = FxLinkedNotionalSchedule(); IDManager.SetID(fxLinkedNotionalScheduleIDRef, ob); } else if (item.Attributes.ToString() == "href") { fxLinkedNotionalScheduleIDRef = item.Attributes["href"].Name; } else { fxLinkedNotionalSchedule = new FxLinkedNotionalSchedule(item); } } } XmlNodeList fixedRateScheduleNodeList = xmlNode.SelectNodes("fixedRateSchedule"); if (fixedRateScheduleNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in fixedRateScheduleNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { fixedRateScheduleIDRef = item.Attributes["id"].Name; Schedule ob = Schedule(); IDManager.SetID(fixedRateScheduleIDRef, ob); } else if (item.Attributes.ToString() == "href") { fixedRateScheduleIDRef = item.Attributes["href"].Name; } else { fixedRateSchedule = new Schedule(item); } } } XmlNodeList futureValueNotionalNodeList = xmlNode.SelectNodes("futureValueNotional"); if (futureValueNotionalNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in futureValueNotionalNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { futureValueNotionalIDRef = item.Attributes["id"].Name; FutureValueAmount ob = FutureValueAmount(); IDManager.SetID(futureValueNotionalIDRef, ob); } else if (item.Attributes.ToString() == "href") { futureValueNotionalIDRef = item.Attributes["href"].Name; } else { futureValueNotional = new FutureValueAmount(item); } } } XmlNodeList rateCalculationNodeList = xmlNode.SelectNodes("rateCalculation"); if (rateCalculationNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in rateCalculationNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { rateCalculationIDRef = item.Attributes["id"].Name; Rate ob = Rate(); IDManager.SetID(rateCalculationIDRef, ob); } else if (item.Attributes.ToString() == "href") { rateCalculationIDRef = item.Attributes["href"].Name; } else { rateCalculation = new Rate(item); } } } XmlNodeList floatingRateCalculationNodeList = xmlNode.SelectNodes("floatingRateCalculation"); if (floatingRateCalculationNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in floatingRateCalculationNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { floatingRateCalculationIDRef = item.Attributes["id"].Name; FloatingRateCalculation ob = FloatingRateCalculation(); IDManager.SetID(floatingRateCalculationIDRef, ob); } else if (item.Attributes.ToString() == "href") { floatingRateCalculationIDRef = item.Attributes["href"].Name; } else { floatingRateCalculation = new FloatingRateCalculation(item); } } } XmlNodeList inflationRateCalculationNodeList = xmlNode.SelectNodes("inflationRateCalculation"); if (inflationRateCalculationNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in inflationRateCalculationNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { inflationRateCalculationIDRef = item.Attributes["id"].Name; InflationRateCalculation ob = InflationRateCalculation(); IDManager.SetID(inflationRateCalculationIDRef, ob); } else if (item.Attributes.ToString() == "href") { inflationRateCalculationIDRef = item.Attributes["href"].Name; } else { inflationRateCalculation = new InflationRateCalculation(item); } } } XmlNodeList dayCountFractionNodeList = xmlNode.SelectNodes("dayCountFraction"); if (dayCountFractionNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in dayCountFractionNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { dayCountFractionIDRef = item.Attributes["id"].Name; DayCountFraction ob = DayCountFraction(); IDManager.SetID(dayCountFractionIDRef, ob); } else if (item.Attributes.ToString() == "href") { dayCountFractionIDRef = item.Attributes["href"].Name; } else { dayCountFraction = new DayCountFraction(item); } } } XmlNodeList discountingNodeList = xmlNode.SelectNodes("discounting"); if (discountingNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in discountingNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { discountingIDRef = item.Attributes["id"].Name; Discounting ob = Discounting(); IDManager.SetID(discountingIDRef, ob); } else if (item.Attributes.ToString() == "href") { discountingIDRef = item.Attributes["href"].Name; } else { discounting = new Discounting(item); } } } XmlNodeList compoundingMethodNodeList = xmlNode.SelectNodes("compoundingMethod"); if (compoundingMethodNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in compoundingMethodNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { compoundingMethodIDRef = item.Attributes["id"].Name; CompoundingMethodEnum ob = CompoundingMethodEnum(); IDManager.SetID(compoundingMethodIDRef, ob); } else if (item.Attributes.ToString() == "href") { compoundingMethodIDRef = item.Attributes["href"].Name; } else { compoundingMethod = new CompoundingMethodEnum(item); } } } }
public Calculation(XmlNode xmlNode) { XmlNodeList notionalScheduleNodeList = xmlNode.SelectNodes("notionalSchedule"); if (notionalScheduleNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in notionalScheduleNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { notionalScheduleIDRef = item.Attributes["id"].Name; Notional ob = Notional(); IDManager.SetID(notionalScheduleIDRef, ob); } else if (item.Attributes.ToString() == "href") { notionalScheduleIDRef = item.Attributes["href"].Name; } else { notionalSchedule = new Notional(item); } } } XmlNodeList fxLinkedNotionalScheduleNodeList = xmlNode.SelectNodes("fxLinkedNotionalSchedule"); if (fxLinkedNotionalScheduleNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in fxLinkedNotionalScheduleNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { fxLinkedNotionalScheduleIDRef = item.Attributes["id"].Name; FxLinkedNotionalSchedule ob = FxLinkedNotionalSchedule(); IDManager.SetID(fxLinkedNotionalScheduleIDRef, ob); } else if (item.Attributes.ToString() == "href") { fxLinkedNotionalScheduleIDRef = item.Attributes["href"].Name; } else { fxLinkedNotionalSchedule = new FxLinkedNotionalSchedule(item); } } } XmlNodeList fixedRateScheduleNodeList = xmlNode.SelectNodes("fixedRateSchedule"); if (fixedRateScheduleNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in fixedRateScheduleNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { fixedRateScheduleIDRef = item.Attributes["id"].Name; Schedule ob = Schedule(); IDManager.SetID(fixedRateScheduleIDRef, ob); } else if (item.Attributes.ToString() == "href") { fixedRateScheduleIDRef = item.Attributes["href"].Name; } else { fixedRateSchedule = new Schedule(item); } } } XmlNodeList futureValueNotionalNodeList = xmlNode.SelectNodes("futureValueNotional"); if (futureValueNotionalNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in futureValueNotionalNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { futureValueNotionalIDRef = item.Attributes["id"].Name; FutureValueAmount ob = FutureValueAmount(); IDManager.SetID(futureValueNotionalIDRef, ob); } else if (item.Attributes.ToString() == "href") { futureValueNotionalIDRef = item.Attributes["href"].Name; } else { futureValueNotional = new FutureValueAmount(item); } } } XmlNodeList rateCalculationNodeList = xmlNode.SelectNodes("rateCalculation"); if (rateCalculationNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in rateCalculationNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { rateCalculationIDRef = item.Attributes["id"].Name; Rate ob = Rate(); IDManager.SetID(rateCalculationIDRef, ob); } else if (item.Attributes.ToString() == "href") { rateCalculationIDRef = item.Attributes["href"].Name; } else { rateCalculation = new Rate(item); } } } XmlNodeList floatingRateCalculationNodeList = xmlNode.SelectNodes("floatingRateCalculation"); if (floatingRateCalculationNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in floatingRateCalculationNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { floatingRateCalculationIDRef = item.Attributes["id"].Name; FloatingRateCalculation ob = FloatingRateCalculation(); IDManager.SetID(floatingRateCalculationIDRef, ob); } else if (item.Attributes.ToString() == "href") { floatingRateCalculationIDRef = item.Attributes["href"].Name; } else { floatingRateCalculation = new FloatingRateCalculation(item); } } } XmlNodeList inflationRateCalculationNodeList = xmlNode.SelectNodes("inflationRateCalculation"); if (inflationRateCalculationNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in inflationRateCalculationNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { inflationRateCalculationIDRef = item.Attributes["id"].Name; InflationRateCalculation ob = InflationRateCalculation(); IDManager.SetID(inflationRateCalculationIDRef, ob); } else if (item.Attributes.ToString() == "href") { inflationRateCalculationIDRef = item.Attributes["href"].Name; } else { inflationRateCalculation = new InflationRateCalculation(item); } } } XmlNodeList dayCountFractionNodeList = xmlNode.SelectNodes("dayCountFraction"); if (dayCountFractionNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in dayCountFractionNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { dayCountFractionIDRef = item.Attributes["id"].Name; DayCountFraction ob = DayCountFraction(); IDManager.SetID(dayCountFractionIDRef, ob); } else if (item.Attributes.ToString() == "href") { dayCountFractionIDRef = item.Attributes["href"].Name; } else { dayCountFraction = new DayCountFraction(item); } } } XmlNodeList discountingNodeList = xmlNode.SelectNodes("discounting"); if (discountingNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in discountingNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { discountingIDRef = item.Attributes["id"].Name; Discounting ob = Discounting(); IDManager.SetID(discountingIDRef, ob); } else if (item.Attributes.ToString() == "href") { discountingIDRef = item.Attributes["href"].Name; } else { discounting = new Discounting(item); } } } XmlNodeList compoundingMethodNodeList = xmlNode.SelectNodes("compoundingMethod"); if (compoundingMethodNodeList.Count > 1 ) { throw new Exception(); } foreach (XmlNode item in compoundingMethodNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { compoundingMethodIDRef = item.Attributes["id"].Name; CompoundingMethodEnum ob = CompoundingMethodEnum(); IDManager.SetID(compoundingMethodIDRef, ob); } else if (item.Attributes.ToString() == "href") { compoundingMethodIDRef = item.Attributes["href"].Name; } else { compoundingMethod = new CompoundingMethodEnum(item); } } } }
public Calculation(XmlNode xmlNode) { XmlNode notionalScheduleNode = xmlNode.SelectSingleNode("notionalSchedule"); if (notionalScheduleNode != null) { if (notionalScheduleNode.Attributes["href"] != null || notionalScheduleNode.Attributes["id"] != null) { if (notionalScheduleNode.Attributes["id"] != null) { notionalScheduleIDRef_ = notionalScheduleNode.Attributes["id"].Value; Notional ob = new Notional(notionalScheduleNode); IDManager.SetID(notionalScheduleIDRef_, ob); } else if (notionalScheduleNode.Attributes["href"] != null) { notionalScheduleIDRef_ = notionalScheduleNode.Attributes["href"].Value; } else { notionalSchedule_ = new Notional(notionalScheduleNode); } } else { notionalSchedule_ = new Notional(notionalScheduleNode); } } XmlNode fxLinkedNotionalScheduleNode = xmlNode.SelectSingleNode("fxLinkedNotionalSchedule"); if (fxLinkedNotionalScheduleNode != null) { if (fxLinkedNotionalScheduleNode.Attributes["href"] != null || fxLinkedNotionalScheduleNode.Attributes["id"] != null) { if (fxLinkedNotionalScheduleNode.Attributes["id"] != null) { fxLinkedNotionalScheduleIDRef_ = fxLinkedNotionalScheduleNode.Attributes["id"].Value; FxLinkedNotionalSchedule ob = new FxLinkedNotionalSchedule(fxLinkedNotionalScheduleNode); IDManager.SetID(fxLinkedNotionalScheduleIDRef_, ob); } else if (fxLinkedNotionalScheduleNode.Attributes["href"] != null) { fxLinkedNotionalScheduleIDRef_ = fxLinkedNotionalScheduleNode.Attributes["href"].Value; } else { fxLinkedNotionalSchedule_ = new FxLinkedNotionalSchedule(fxLinkedNotionalScheduleNode); } } else { fxLinkedNotionalSchedule_ = new FxLinkedNotionalSchedule(fxLinkedNotionalScheduleNode); } } XmlNode fixedRateScheduleNode = xmlNode.SelectSingleNode("fixedRateSchedule"); if (fixedRateScheduleNode != null) { if (fixedRateScheduleNode.Attributes["href"] != null || fixedRateScheduleNode.Attributes["id"] != null) { if (fixedRateScheduleNode.Attributes["id"] != null) { fixedRateScheduleIDRef_ = fixedRateScheduleNode.Attributes["id"].Value; Schedule ob = new Schedule(fixedRateScheduleNode); IDManager.SetID(fixedRateScheduleIDRef_, ob); } else if (fixedRateScheduleNode.Attributes["href"] != null) { fixedRateScheduleIDRef_ = fixedRateScheduleNode.Attributes["href"].Value; } else { fixedRateSchedule_ = new Schedule(fixedRateScheduleNode); } } else { fixedRateSchedule_ = new Schedule(fixedRateScheduleNode); } } XmlNode futureValueNotionalNode = xmlNode.SelectSingleNode("futureValueNotional"); if (futureValueNotionalNode != null) { if (futureValueNotionalNode.Attributes["href"] != null || futureValueNotionalNode.Attributes["id"] != null) { if (futureValueNotionalNode.Attributes["id"] != null) { futureValueNotionalIDRef_ = futureValueNotionalNode.Attributes["id"].Value; FutureValueAmount ob = new FutureValueAmount(futureValueNotionalNode); IDManager.SetID(futureValueNotionalIDRef_, ob); } else if (futureValueNotionalNode.Attributes["href"] != null) { futureValueNotionalIDRef_ = futureValueNotionalNode.Attributes["href"].Value; } else { futureValueNotional_ = new FutureValueAmount(futureValueNotionalNode); } } else { futureValueNotional_ = new FutureValueAmount(futureValueNotionalNode); } } XmlNode rateCalculationNode = xmlNode.SelectSingleNode("rateCalculation"); if (rateCalculationNode != null) { if (rateCalculationNode.Attributes["href"] != null || rateCalculationNode.Attributes["id"] != null) { if (rateCalculationNode.Attributes["id"] != null) { rateCalculationIDRef_ = rateCalculationNode.Attributes["id"].Value; Rate ob = new Rate(rateCalculationNode); IDManager.SetID(rateCalculationIDRef_, ob); } else if (rateCalculationNode.Attributes["href"] != null) { rateCalculationIDRef_ = rateCalculationNode.Attributes["href"].Value; } else { rateCalculation_ = new Rate(rateCalculationNode); } } else { rateCalculation_ = new Rate(rateCalculationNode); } } XmlNode floatingRateCalculationNode = xmlNode.SelectSingleNode("floatingRateCalculation"); if (floatingRateCalculationNode != null) { if (floatingRateCalculationNode.Attributes["href"] != null || floatingRateCalculationNode.Attributes["id"] != null) { if (floatingRateCalculationNode.Attributes["id"] != null) { floatingRateCalculationIDRef_ = floatingRateCalculationNode.Attributes["id"].Value; FloatingRateCalculation ob = new FloatingRateCalculation(floatingRateCalculationNode); IDManager.SetID(floatingRateCalculationIDRef_, ob); } else if (floatingRateCalculationNode.Attributes["href"] != null) { floatingRateCalculationIDRef_ = floatingRateCalculationNode.Attributes["href"].Value; } else { floatingRateCalculation_ = new FloatingRateCalculation(floatingRateCalculationNode); } } else { floatingRateCalculation_ = new FloatingRateCalculation(floatingRateCalculationNode); } } XmlNode inflationRateCalculationNode = xmlNode.SelectSingleNode("inflationRateCalculation"); if (inflationRateCalculationNode != null) { if (inflationRateCalculationNode.Attributes["href"] != null || inflationRateCalculationNode.Attributes["id"] != null) { if (inflationRateCalculationNode.Attributes["id"] != null) { inflationRateCalculationIDRef_ = inflationRateCalculationNode.Attributes["id"].Value; InflationRateCalculation ob = new InflationRateCalculation(inflationRateCalculationNode); IDManager.SetID(inflationRateCalculationIDRef_, ob); } else if (inflationRateCalculationNode.Attributes["href"] != null) { inflationRateCalculationIDRef_ = inflationRateCalculationNode.Attributes["href"].Value; } else { inflationRateCalculation_ = new InflationRateCalculation(inflationRateCalculationNode); } } else { inflationRateCalculation_ = new InflationRateCalculation(inflationRateCalculationNode); } } XmlNode dayCountFractionNode = xmlNode.SelectSingleNode("dayCountFraction"); if (dayCountFractionNode != null) { if (dayCountFractionNode.Attributes["href"] != null || dayCountFractionNode.Attributes["id"] != null) { if (dayCountFractionNode.Attributes["id"] != null) { dayCountFractionIDRef_ = dayCountFractionNode.Attributes["id"].Value; DayCountFraction ob = new DayCountFraction(dayCountFractionNode); IDManager.SetID(dayCountFractionIDRef_, ob); } else if (dayCountFractionNode.Attributes["href"] != null) { dayCountFractionIDRef_ = dayCountFractionNode.Attributes["href"].Value; } else { dayCountFraction_ = new DayCountFraction(dayCountFractionNode); } } else { dayCountFraction_ = new DayCountFraction(dayCountFractionNode); } } XmlNode discountingNode = xmlNode.SelectSingleNode("discounting"); if (discountingNode != null) { if (discountingNode.Attributes["href"] != null || discountingNode.Attributes["id"] != null) { if (discountingNode.Attributes["id"] != null) { discountingIDRef_ = discountingNode.Attributes["id"].Value; Discounting ob = new Discounting(discountingNode); IDManager.SetID(discountingIDRef_, ob); } else if (discountingNode.Attributes["href"] != null) { discountingIDRef_ = discountingNode.Attributes["href"].Value; } else { discounting_ = new Discounting(discountingNode); } } else { discounting_ = new Discounting(discountingNode); } } XmlNode compoundingMethodNode = xmlNode.SelectSingleNode("compoundingMethod"); if (compoundingMethodNode != null) { if (compoundingMethodNode.Attributes["href"] != null || compoundingMethodNode.Attributes["id"] != null) { if (compoundingMethodNode.Attributes["id"] != null) { compoundingMethodIDRef_ = compoundingMethodNode.Attributes["id"].Value; CompoundingMethodEnum ob = new CompoundingMethodEnum(compoundingMethodNode); IDManager.SetID(compoundingMethodIDRef_, ob); } else if (compoundingMethodNode.Attributes["href"] != null) { compoundingMethodIDRef_ = compoundingMethodNode.Attributes["href"].Value; } else { compoundingMethod_ = new CompoundingMethodEnum(compoundingMethodNode); } } else { compoundingMethod_ = new CompoundingMethodEnum(compoundingMethodNode); } } }