} // !_readProductId() private static ProductPriceFix _readProductPriceFix(XmlNode node, XmlNamespaceManager nsmgr = null) { if (node == null) { return(null); } PriceBaseFix priceBaseFix = default; XmlNode priceBaseFixRefNode = node.SelectSingleNode("./*[local-name()='PRICE_BASE_FIX']", nsmgr); if (priceBaseFixRefNode != null) { priceBaseFix = new PriceBaseFix { PriceUnitValue = XmlUtils.NodeAsDecimal(priceBaseFixRefNode, "./*[local-name()='PRICE_UNIT_VALUE']", nsmgr) ?? 0, PriceUnit = QuantityCode.FromString(XmlUtils.NodeAsString(priceBaseFixRefNode, "./*[local-name()='PRICE_UNIT']", nsmgr)), PriceUnitFactor = XmlUtils.NodeAsDecimal(priceBaseFixRefNode, "./*[local-name()='PRICE_UNIT_FACTOR']", nsmgr), }; } return(new ProductPriceFix { PriceAmount = XmlUtils.NodeAsDecimal(node, "./*[local-name()='PRICE_AMOUNT']", nsmgr) ?? 0, PriceQuantity = XmlUtils.NodeAsDecimal(node, "./*[local-name()='PRICE_QUANTITY']", nsmgr) ?? 0, PriceBaseFix = priceBaseFix, }); } // !_readProductId()
} // !_readDateTime() protected static OrderItem _readItem(XmlNode node, XmlNamespaceManager nsmgr = null) { if (node == null) { return(null); } List <Feature> features = new List <Feature>(); XmlNodeList featureNodes = node.SelectNodes("./*[local-name()='PRODUCT_FEATURES']/*[local-name()='FEATURE']", nsmgr); foreach (XmlNode featureNode in featureNodes) { features.Add(_readFeature(featureNode, nsmgr)); } List <string> remarks = new List <string>(); foreach (XmlNode remarkNode in node.SelectNodes("./*[local-name()='REMARKS']", nsmgr)) { remarks.Add(XmlUtils.NodeAsString(remarkNode, ".", nsmgr)); } DeliveryDate deliveryDate = default; XmlNode deliveryDateRefNode = node.SelectSingleNode("./*[local-name()='DELIVERY_DATE']", nsmgr); if (deliveryDateRefNode != null) { deliveryDate = new DeliveryDate { StartDate = _nodeAsDateTime(deliveryDateRefNode, "./*[local-name()='DELIVERY_START_DATE']", nsmgr), EndDate = _nodeAsDateTime(deliveryDateRefNode, "./*[local-name()='DELIVERY_END_DATE']", nsmgr), Type = default(DeliveryDateTypes).FromString(XmlUtils.AttributeText(deliveryDateRefNode, "type")) }; } OrderItem item = new OrderItem() { LineItemId = XmlUtils.NodeAsString(node, "./*[local-name()='LINE_ITEM_ID']", nsmgr), ProductId = _readProductId(node.SelectSingleNode("./*[local-name()='PRODUCT_ID']", nsmgr), nsmgr), Quantity = XmlUtils.NodeAsDecimal(node, "./*[local-name()='QUANTITY']", nsmgr), OrderUnit = QuantityCode.FromString(XmlUtils.NodeAsString(node, "./*[local-name()='ORDER_UNIT']", nsmgr)), LineAmount = XmlUtils.NodeAsDecimal(node, "./*[local-name()='PRICE_LINE_AMOUNT']", nsmgr), DeliveryDate = deliveryDate, ProductFeatures = features, ProductPriceFix = _readProductPriceFix(node.SelectSingleNode("./*[local-name()='PRODUCT_PRICE_FIX']", nsmgr), nsmgr), Remarks = remarks }; return(item); } // !_readItem()
} // !_readItem() protected static Feature _readFeature(XmlNode node, XmlNamespaceManager nsmgr = null) { if (node == null) { return(null); } return(new Feature { Name = XmlUtils.NodeAsString(node, "./*[local-name()='FNAME']", nsmgr), Value = XmlUtils.NodeAsString(node, "./*[local-name()='FVALUE']", nsmgr), Description = XmlUtils.NodeAsString(node, "./*[local-name()='FDESCRIPTION']", nsmgr), Order = XmlUtils.NodeAsString(node, "./*[local-name()='FORDER']", nsmgr), Template = XmlUtils.NodeAsString(node, "./*[local-name()='FTEMPLATE']", nsmgr), Unit = QuantityCode.FromString(XmlUtils.NodeAsString(node, "./*[local-name()='FUNIT']", nsmgr)), }); } // !_readFeature()