Exemplo n.º 1
0
        public GasProduct(XmlNode xmlNode)
        {
            XmlNodeList typeNodeList = xmlNode.SelectNodes("type");

            if (typeNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in typeNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        typeIDRef = item.Attributes["id"].Name;
                        GasProductTypeEnum ob = GasProductTypeEnum();
                        IDManager.SetID(typeIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        typeIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        type = new GasProductTypeEnum(item);
                    }
                }
            }


            XmlNodeList calorificValueNodeList = xmlNode.SelectNodes("calorificValue");

            if (calorificValueNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in calorificValueNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        calorificValueIDRef = item.Attributes["id"].Name;
                        NonNegativeDecimal ob = NonNegativeDecimal();
                        IDManager.SetID(calorificValueIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        calorificValueIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        calorificValue = new NonNegativeDecimal(item);
                    }
                }
            }


            XmlNodeList qualityNodeList = xmlNode.SelectNodes("quality");

            if (qualityNodeList.Count > 1)
            {
                throw new Exception();
            }

            foreach (XmlNode item in qualityNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        qualityIDRef = item.Attributes["id"].Name;
                        GasQuality ob = GasQuality();
                        IDManager.SetID(qualityIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        qualityIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        quality = new GasQuality(item);
                    }
                }
            }
        }
        public GasProduct(XmlNode xmlNode)
        {
            XmlNode typeNode = xmlNode.SelectSingleNode("type");

            if (typeNode != null)
            {
                if (typeNode.Attributes["href"] != null || typeNode.Attributes["id"] != null)
                {
                    if (typeNode.Attributes["id"] != null)
                    {
                        typeIDRef_ = typeNode.Attributes["id"].Value;
                        GasProductTypeEnum ob = new GasProductTypeEnum(typeNode);
                        IDManager.SetID(typeIDRef_, ob);
                    }
                    else if (typeNode.Attributes["href"] != null)
                    {
                        typeIDRef_ = typeNode.Attributes["href"].Value;
                    }
                    else
                    {
                        type_ = new GasProductTypeEnum(typeNode);
                    }
                }
                else
                {
                    type_ = new GasProductTypeEnum(typeNode);
                }
            }


            XmlNode calorificValueNode = xmlNode.SelectSingleNode("calorificValue");

            if (calorificValueNode != null)
            {
                if (calorificValueNode.Attributes["href"] != null || calorificValueNode.Attributes["id"] != null)
                {
                    if (calorificValueNode.Attributes["id"] != null)
                    {
                        calorificValueIDRef_ = calorificValueNode.Attributes["id"].Value;
                        NonNegativeDecimal ob = new NonNegativeDecimal(calorificValueNode);
                        IDManager.SetID(calorificValueIDRef_, ob);
                    }
                    else if (calorificValueNode.Attributes["href"] != null)
                    {
                        calorificValueIDRef_ = calorificValueNode.Attributes["href"].Value;
                    }
                    else
                    {
                        calorificValue_ = new NonNegativeDecimal(calorificValueNode);
                    }
                }
                else
                {
                    calorificValue_ = new NonNegativeDecimal(calorificValueNode);
                }
            }


            XmlNode qualityNode = xmlNode.SelectSingleNode("quality");

            if (qualityNode != null)
            {
                if (qualityNode.Attributes["href"] != null || qualityNode.Attributes["id"] != null)
                {
                    if (qualityNode.Attributes["id"] != null)
                    {
                        qualityIDRef_ = qualityNode.Attributes["id"].Value;
                        GasQuality ob = new GasQuality(qualityNode);
                        IDManager.SetID(qualityIDRef_, ob);
                    }
                    else if (qualityNode.Attributes["href"] != null)
                    {
                        qualityIDRef_ = qualityNode.Attributes["href"].Value;
                    }
                    else
                    {
                        quality_ = new GasQuality(qualityNode);
                    }
                }
                else
                {
                    quality_ = new GasQuality(qualityNode);
                }
            }
        }
 public GasProduct(XmlNode xmlNode)
 {
     XmlNode typeNode = xmlNode.SelectSingleNode("type");
     
     if (typeNode != null)
     {
         if (typeNode.Attributes["href"] != null || typeNode.Attributes["id"] != null) 
         {
             if (typeNode.Attributes["id"] != null) 
             {
                 typeIDRef_ = typeNode.Attributes["id"].Value;
                 GasProductTypeEnum ob = new GasProductTypeEnum(typeNode);
                 IDManager.SetID(typeIDRef_, ob);
             }
             else if (typeNode.Attributes["href"] != null)
             {
                 typeIDRef_ = typeNode.Attributes["href"].Value;
             }
             else
             {
                 type_ = new GasProductTypeEnum(typeNode);
             }
         }
         else
         {
             type_ = new GasProductTypeEnum(typeNode);
         }
     }
     
 
     XmlNode calorificValueNode = xmlNode.SelectSingleNode("calorificValue");
     
     if (calorificValueNode != null)
     {
         if (calorificValueNode.Attributes["href"] != null || calorificValueNode.Attributes["id"] != null) 
         {
             if (calorificValueNode.Attributes["id"] != null) 
             {
                 calorificValueIDRef_ = calorificValueNode.Attributes["id"].Value;
                 NonNegativeDecimal ob = new NonNegativeDecimal(calorificValueNode);
                 IDManager.SetID(calorificValueIDRef_, ob);
             }
             else if (calorificValueNode.Attributes["href"] != null)
             {
                 calorificValueIDRef_ = calorificValueNode.Attributes["href"].Value;
             }
             else
             {
                 calorificValue_ = new NonNegativeDecimal(calorificValueNode);
             }
         }
         else
         {
             calorificValue_ = new NonNegativeDecimal(calorificValueNode);
         }
     }
     
 
     XmlNode qualityNode = xmlNode.SelectSingleNode("quality");
     
     if (qualityNode != null)
     {
         if (qualityNode.Attributes["href"] != null || qualityNode.Attributes["id"] != null) 
         {
             if (qualityNode.Attributes["id"] != null) 
             {
                 qualityIDRef_ = qualityNode.Attributes["id"].Value;
                 GasQuality ob = new GasQuality(qualityNode);
                 IDManager.SetID(qualityIDRef_, ob);
             }
             else if (qualityNode.Attributes["href"] != null)
             {
                 qualityIDRef_ = qualityNode.Attributes["href"].Value;
             }
             else
             {
                 quality_ = new GasQuality(qualityNode);
             }
         }
         else
         {
             quality_ = new GasQuality(qualityNode);
         }
     }
     
 
 }