Exemplo n.º 1
0
        public CollateralValueAllocation(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;
                        CollateralValueAllocationEnum ob = CollateralValueAllocationEnum();
                        IDManager.SetID(typeIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        typeIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        type = new CollateralValueAllocationEnum(item);
                    }
                }
            }


            XmlNodeList valueNodeList = xmlNode.SelectNodes("value");

            foreach (XmlNode item in valueNodeList)
            {
                if (item.Attributes["href"] != null || item.Attributes["id"] == null)
                {
                    if (item.Attributes["id"] != null)
                    {
                        valueIDRef = item.Attributes["id"].Name;
                        List <Money> ob = new List <Money>();
                        ob.Add(new Money(item));
                        IDManager.SetID(valueIDRef, ob);
                    }
                    else if (item.Attributes.ToString() == "href")
                    {
                        valueIDRef = item.Attributes["href"].Name;
                    }
                    else
                    {
                        value.Add(new Money(item));
                    }
                }
            }
        }
        public CollateralValueAllocation(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;
                        CollateralValueAllocationEnum ob = new CollateralValueAllocationEnum(typeNode);
                        IDManager.SetID(typeIDRef_, ob);
                    }
                    else if (typeNode.Attributes["href"] != null)
                    {
                        typeIDRef_ = typeNode.Attributes["href"].Value;
                    }
                    else
                    {
                        type_ = new CollateralValueAllocationEnum(typeNode);
                    }
                }
                else
                {
                    type_ = new CollateralValueAllocationEnum(typeNode);
                }
            }


            XmlNodeList valueNodeList = xmlNode.SelectNodes("value");

            if (valueNodeList != null)
            {
                this.value_ = new List <Money>();
                foreach (XmlNode item in valueNodeList)
                {
                    if (item.Attributes["href"] != null || item.Attributes["id"] != null)
                    {
                        if (item.Attributes["id"] != null)
                        {
                            valueIDRef_ = item.Attributes["id"].Value;
                            value_.Add(new Money(item));
                            IDManager.SetID(valueIDRef_, value_[value_.Count - 1]);
                        }
                        else if (item.Attributes["href"] != null)
                        {
                            valueIDRef_ = item.Attributes["href"].Value;
                        }
                        else
                        {
                            value_.Add(new Money(item));
                        }
                    }
                    else
                    {
                        value_.Add(new Money(item));
                    }
                }
            }
        }