public WeatherLegCalculation(XmlNode xmlNode) { XmlNode settlementLevelNode = xmlNode.SelectSingleNode("settlementLevel"); if (settlementLevelNode != null) { if (settlementLevelNode.Attributes["href"] != null || settlementLevelNode.Attributes["id"] != null) { if (settlementLevelNode.Attributes["id"] != null) { settlementLevelIDRef_ = settlementLevelNode.Attributes["id"].Value; WeatherSettlementLevelEnum ob = new WeatherSettlementLevelEnum(settlementLevelNode); IDManager.SetID(settlementLevelIDRef_, ob); } else if (settlementLevelNode.Attributes["href"] != null) { settlementLevelIDRef_ = settlementLevelNode.Attributes["href"].Value; } else { settlementLevel_ = new WeatherSettlementLevelEnum(settlementLevelNode); } } else { settlementLevel_ = new WeatherSettlementLevelEnum(settlementLevelNode); } } XmlNode referenceLevelEqualsZeroNode = xmlNode.SelectSingleNode("referenceLevelEqualsZero"); if (referenceLevelEqualsZeroNode != null) { if (referenceLevelEqualsZeroNode.Attributes["href"] != null || referenceLevelEqualsZeroNode.Attributes["id"] != null) { if (referenceLevelEqualsZeroNode.Attributes["id"] != null) { referenceLevelEqualsZeroIDRef_ = referenceLevelEqualsZeroNode.Attributes["id"].Value; XsdTypeBoolean ob = new XsdTypeBoolean(referenceLevelEqualsZeroNode); IDManager.SetID(referenceLevelEqualsZeroIDRef_, ob); } else if (referenceLevelEqualsZeroNode.Attributes["href"] != null) { referenceLevelEqualsZeroIDRef_ = referenceLevelEqualsZeroNode.Attributes["href"].Value; } else { referenceLevelEqualsZero_ = new XsdTypeBoolean(referenceLevelEqualsZeroNode); } } else { referenceLevelEqualsZero_ = new XsdTypeBoolean(referenceLevelEqualsZeroNode); } } XmlNode calculationDateNode = xmlNode.SelectSingleNode("calculationDate"); if (calculationDateNode != null) { if (calculationDateNode.Attributes["href"] != null || calculationDateNode.Attributes["id"] != null) { if (calculationDateNode.Attributes["id"] != null) { calculationDateIDRef_ = calculationDateNode.Attributes["id"].Value; Period ob = new Period(calculationDateNode); IDManager.SetID(calculationDateIDRef_, ob); } else if (calculationDateNode.Attributes["href"] != null) { calculationDateIDRef_ = calculationDateNode.Attributes["href"].Value; } else { calculationDate_ = new Period(calculationDateNode); } } else { calculationDate_ = new Period(calculationDateNode); } } XmlNode businessDaysNode = xmlNode.SelectSingleNode("businessDays"); if (businessDaysNode != null) { if (businessDaysNode.Attributes["href"] != null || businessDaysNode.Attributes["id"] != null) { if (businessDaysNode.Attributes["id"] != null) { businessDaysIDRef_ = businessDaysNode.Attributes["id"].Value; BusinessCenter ob = new BusinessCenter(businessDaysNode); IDManager.SetID(businessDaysIDRef_, ob); } else if (businessDaysNode.Attributes["href"] != null) { businessDaysIDRef_ = businessDaysNode.Attributes["href"].Value; } else { businessDays_ = new BusinessCenter(businessDaysNode); } } else { businessDays_ = new BusinessCenter(businessDaysNode); } } XmlNode dataCorrectionNode = xmlNode.SelectSingleNode("dataCorrection"); if (dataCorrectionNode != null) { if (dataCorrectionNode.Attributes["href"] != null || dataCorrectionNode.Attributes["id"] != null) { if (dataCorrectionNode.Attributes["id"] != null) { dataCorrectionIDRef_ = dataCorrectionNode.Attributes["id"].Value; XsdTypeBoolean ob = new XsdTypeBoolean(dataCorrectionNode); IDManager.SetID(dataCorrectionIDRef_, ob); } else if (dataCorrectionNode.Attributes["href"] != null) { dataCorrectionIDRef_ = dataCorrectionNode.Attributes["href"].Value; } else { dataCorrection_ = new XsdTypeBoolean(dataCorrectionNode); } } else { dataCorrection_ = new XsdTypeBoolean(dataCorrectionNode); } } XmlNode correctionPeriodNode = xmlNode.SelectSingleNode("correctionPeriod"); if (correctionPeriodNode != null) { if (correctionPeriodNode.Attributes["href"] != null || correctionPeriodNode.Attributes["id"] != null) { if (correctionPeriodNode.Attributes["id"] != null) { correctionPeriodIDRef_ = correctionPeriodNode.Attributes["id"].Value; Period ob = new Period(correctionPeriodNode); IDManager.SetID(correctionPeriodIDRef_, ob); } else if (correctionPeriodNode.Attributes["href"] != null) { correctionPeriodIDRef_ = correctionPeriodNode.Attributes["href"].Value; } else { correctionPeriod_ = new Period(correctionPeriodNode); } } else { correctionPeriod_ = new Period(correctionPeriodNode); } } XmlNode maximumPaymentAmountNode = xmlNode.SelectSingleNode("maximumPaymentAmount"); if (maximumPaymentAmountNode != null) { if (maximumPaymentAmountNode.Attributes["href"] != null || maximumPaymentAmountNode.Attributes["id"] != null) { if (maximumPaymentAmountNode.Attributes["id"] != null) { maximumPaymentAmountIDRef_ = maximumPaymentAmountNode.Attributes["id"].Value; NonNegativeMoney ob = new NonNegativeMoney(maximumPaymentAmountNode); IDManager.SetID(maximumPaymentAmountIDRef_, ob); } else if (maximumPaymentAmountNode.Attributes["href"] != null) { maximumPaymentAmountIDRef_ = maximumPaymentAmountNode.Attributes["href"].Value; } else { maximumPaymentAmount_ = new NonNegativeMoney(maximumPaymentAmountNode); } } else { maximumPaymentAmount_ = new NonNegativeMoney(maximumPaymentAmountNode); } } XmlNode maximumTransactionPaymentAmountNode = xmlNode.SelectSingleNode("maximumTransactionPaymentAmount"); if (maximumTransactionPaymentAmountNode != null) { if (maximumTransactionPaymentAmountNode.Attributes["href"] != null || maximumTransactionPaymentAmountNode.Attributes["id"] != null) { if (maximumTransactionPaymentAmountNode.Attributes["id"] != null) { maximumTransactionPaymentAmountIDRef_ = maximumTransactionPaymentAmountNode.Attributes["id"].Value; NonNegativeMoney ob = new NonNegativeMoney(maximumTransactionPaymentAmountNode); IDManager.SetID(maximumTransactionPaymentAmountIDRef_, ob); } else if (maximumTransactionPaymentAmountNode.Attributes["href"] != null) { maximumTransactionPaymentAmountIDRef_ = maximumTransactionPaymentAmountNode.Attributes["href"].Value; } else { maximumTransactionPaymentAmount_ = new NonNegativeMoney(maximumTransactionPaymentAmountNode); } } else { maximumTransactionPaymentAmount_ = new NonNegativeMoney(maximumTransactionPaymentAmountNode); } } XmlNode roundingNode = xmlNode.SelectSingleNode("rounding"); if (roundingNode != null) { if (roundingNode.Attributes["href"] != null || roundingNode.Attributes["id"] != null) { if (roundingNode.Attributes["id"] != null) { roundingIDRef_ = roundingNode.Attributes["id"].Value; Rounding ob = new Rounding(roundingNode); IDManager.SetID(roundingIDRef_, ob); } else if (roundingNode.Attributes["href"] != null) { roundingIDRef_ = roundingNode.Attributes["href"].Value; } else { rounding_ = new Rounding(roundingNode); } } else { rounding_ = new Rounding(roundingNode); } } }
public WeatherLegCalculation(XmlNode xmlNode) { XmlNodeList settlementLevelNodeList = xmlNode.SelectNodes("settlementLevel"); if (settlementLevelNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in settlementLevelNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { settlementLevelIDRef = item.Attributes["id"].Name; WeatherSettlementLevelEnum ob = WeatherSettlementLevelEnum(); IDManager.SetID(settlementLevelIDRef, ob); } else if (item.Attributes.ToString() == "href") { settlementLevelIDRef = item.Attributes["href"].Name; } else { settlementLevel = new WeatherSettlementLevelEnum(item); } } } XmlNodeList referenceLevelEqualsZeroNodeList = xmlNode.SelectNodes("referenceLevelEqualsZero"); if (referenceLevelEqualsZeroNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in referenceLevelEqualsZeroNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { referenceLevelEqualsZeroIDRef = item.Attributes["id"].Name; XsdTypeBoolean ob = XsdTypeBoolean(); IDManager.SetID(referenceLevelEqualsZeroIDRef, ob); } else if (item.Attributes.ToString() == "href") { referenceLevelEqualsZeroIDRef = item.Attributes["href"].Name; } else { referenceLevelEqualsZero = new XsdTypeBoolean(item); } } } XmlNodeList calculationDateNodeList = xmlNode.SelectNodes("calculationDate"); if (calculationDateNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in calculationDateNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { calculationDateIDRef = item.Attributes["id"].Name; Period ob = Period(); IDManager.SetID(calculationDateIDRef, ob); } else if (item.Attributes.ToString() == "href") { calculationDateIDRef = item.Attributes["href"].Name; } else { calculationDate = new Period(item); } } } XmlNodeList businessDaysNodeList = xmlNode.SelectNodes("businessDays"); if (businessDaysNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in businessDaysNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { businessDaysIDRef = item.Attributes["id"].Name; BusinessCenter ob = BusinessCenter(); IDManager.SetID(businessDaysIDRef, ob); } else if (item.Attributes.ToString() == "href") { businessDaysIDRef = item.Attributes["href"].Name; } else { businessDays = new BusinessCenter(item); } } } XmlNodeList dataCorrectionNodeList = xmlNode.SelectNodes("dataCorrection"); if (dataCorrectionNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in dataCorrectionNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { dataCorrectionIDRef = item.Attributes["id"].Name; XsdTypeBoolean ob = XsdTypeBoolean(); IDManager.SetID(dataCorrectionIDRef, ob); } else if (item.Attributes.ToString() == "href") { dataCorrectionIDRef = item.Attributes["href"].Name; } else { dataCorrection = new XsdTypeBoolean(item); } } } XmlNodeList correctionPeriodNodeList = xmlNode.SelectNodes("correctionPeriod"); if (correctionPeriodNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in correctionPeriodNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { correctionPeriodIDRef = item.Attributes["id"].Name; Period ob = Period(); IDManager.SetID(correctionPeriodIDRef, ob); } else if (item.Attributes.ToString() == "href") { correctionPeriodIDRef = item.Attributes["href"].Name; } else { correctionPeriod = new Period(item); } } } XmlNodeList maximumPaymentAmountNodeList = xmlNode.SelectNodes("maximumPaymentAmount"); if (maximumPaymentAmountNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in maximumPaymentAmountNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { maximumPaymentAmountIDRef = item.Attributes["id"].Name; NonNegativeMoney ob = NonNegativeMoney(); IDManager.SetID(maximumPaymentAmountIDRef, ob); } else if (item.Attributes.ToString() == "href") { maximumPaymentAmountIDRef = item.Attributes["href"].Name; } else { maximumPaymentAmount = new NonNegativeMoney(item); } } } XmlNodeList maximumTransactionPaymentAmountNodeList = xmlNode.SelectNodes("maximumTransactionPaymentAmount"); if (maximumTransactionPaymentAmountNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in maximumTransactionPaymentAmountNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { maximumTransactionPaymentAmountIDRef = item.Attributes["id"].Name; NonNegativeMoney ob = NonNegativeMoney(); IDManager.SetID(maximumTransactionPaymentAmountIDRef, ob); } else if (item.Attributes.ToString() == "href") { maximumTransactionPaymentAmountIDRef = item.Attributes["href"].Name; } else { maximumTransactionPaymentAmount = new NonNegativeMoney(item); } } } XmlNodeList roundingNodeList = xmlNode.SelectNodes("rounding"); if (roundingNodeList.Count > 1) { throw new Exception(); } foreach (XmlNode item in roundingNodeList) { if (item.Attributes["href"] != null || item.Attributes["id"] == null) { if (item.Attributes["id"] != null) { roundingIDRef = item.Attributes["id"].Name; Rounding ob = Rounding(); IDManager.SetID(roundingIDRef, ob); } else if (item.Attributes.ToString() == "href") { roundingIDRef = item.Attributes["href"].Name; } else { rounding = new Rounding(item); } } } }