public static RecurringChargeUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new RecurringChargeUnmarshaller();
            }

            return(instance);
        }
예제 #2
0
        public ReservedNode Unmarshall(XmlUnmarshallerContext context)
        {
            ReservedNode reservedNode  = new ReservedNode();
            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("ReservedNodeId", targetDepth))
                    {
                        reservedNode.ReservedNodeId = StringUnmarshaller.GetInstance().Unmarshall(context);

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

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

                        continue;
                    }
                    if (context.TestExpression("StartTime", targetDepth))
                    {
                        reservedNode.StartTime = DateTimeUnmarshaller.GetInstance().Unmarshall(context);

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

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

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

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

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

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

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

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

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



            return(reservedNode);
        }