Ejemplo n.º 1
0
        public static RecurringChargeUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new RecurringChargeUnmarshaller();
            }

            return(instance);
        }
        public ReservedCacheNodesOffering Unmarshall(XmlUnmarshallerContext context)
        {
            ReservedCacheNodesOffering reservedCacheNodesOffering = new ReservedCacheNodesOffering();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            if (context.IsStartOfDocument)
            {
                targetDepth++;
            }

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("ReservedCacheNodesOfferingId", targetDepth))
                    {
                        reservedCacheNodesOffering.ReservedCacheNodesOfferingId = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("CacheNodeType", targetDepth))
                    {
                        reservedCacheNodesOffering.CacheNodeType = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Duration", targetDepth))
                    {
                        reservedCacheNodesOffering.Duration = IntUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("FixedPrice", targetDepth))
                    {
                        reservedCacheNodesOffering.FixedPrice = DoubleUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("UsagePrice", targetDepth))
                    {
                        reservedCacheNodesOffering.UsagePrice = DoubleUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("ProductDescription", targetDepth))
                    {
                        reservedCacheNodesOffering.ProductDescription = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("OfferingType", targetDepth))
                    {
                        reservedCacheNodesOffering.OfferingType = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("RecurringCharges/RecurringCharge", targetDepth))
                    {
                        reservedCacheNodesOffering.RecurringCharges.Add(RecurringChargeUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(reservedCacheNodesOffering);
                }
            }



            return(reservedCacheNodesOffering);
        }