private static void read_banners(XmlNodeReader nodeReader, Item_Aggregation hierarchyObject)
        {
            while (nodeReader.Read())
            {
                // If this is the beginning tag for an element, assign the next values accordingly
                if (nodeReader.NodeType == XmlNodeType.Element)
                {
                    // Get the node name, trimmed and to upper
                    string nodeName = nodeReader.Name.Trim().ToUpper();

                    // switch the rest based on the tag name
                    switch (nodeName)
                    {
                    case "HI:SOURCE":
                        // Check for any attributes to this banner node
                        string lang    = String.Empty;
                        bool   special = false;

                        if (nodeReader.HasAttributes)
                        {
                            if (nodeReader.MoveToAttribute("lang"))
                            {
                                lang = nodeReader.Value.Trim().ToUpper();
                            }
                            if (nodeReader.MoveToAttribute("type"))
                            {
                                if (nodeReader.Value.Trim().ToUpper() == "HIGHLIGHT")
                                {
                                    special = true;
                                }
                            }
                        }

                        // Now read the banner information and add to the aggregation object
                        nodeReader.Read();
                        if (special)
                        {
                            hierarchyObject.Add_Front_Banner_Image(nodeReader.Value, Web_Language_Enum_Converter.Code_To_Enum(lang));
                        }
                        else
                        {
                            hierarchyObject.Add_Banner_Image(nodeReader.Value, Web_Language_Enum_Converter.Code_To_Enum(lang));
                        }


                        break;
                    }
                }

                if ((nodeReader.NodeType == XmlNodeType.EndElement) && (nodeReader.Name.Trim().ToUpper() == "HI:BANNER"))
                {
                    return;
                }
            }
        }
Пример #2
0
        private static void read_banners(XmlNodeReader NodeReader, Item_Aggregation HierarchyObject)
        {
            while (NodeReader.Read())
            {
                // If this is the beginning tag for an element, assign the next values accordingly
                if (NodeReader.NodeType == XmlNodeType.Element)
                {
                    // Get the node name, trimmed and to upper
                    string nodeName = NodeReader.Name.Trim().ToUpper();

                    // switch the rest based on the tag name
                    switch (nodeName)
                    {
                    case "HI:SOURCE":
                        // Check for any attributes to this banner node
                        string lang    = String.Empty;
                        bool   special = false;
                        Item_Aggregation_Front_Banner.Item_Aggregation_Front_Banner_Type type = Item_Aggregation_Front_Banner.Item_Aggregation_Front_Banner_Type.LEFT;
                        ushort width  = 550;
                        ushort height = 230;

                        if (NodeReader.HasAttributes)
                        {
                            if (NodeReader.MoveToAttribute("lang"))
                            {
                                lang = NodeReader.Value.Trim().ToUpper();
                            }
                            if (NodeReader.MoveToAttribute("type"))
                            {
                                if ((NodeReader.Value.Trim().ToUpper() == "HIGHLIGHT") || (NodeReader.Value.Trim().ToUpper() == "FRONT"))
                                {
                                    special = true;
                                }
                            }
                            if (NodeReader.MoveToAttribute("side"))
                            {
                                switch (NodeReader.Value.Trim().ToUpper())
                                {
                                case "RIGHT":
                                    type = Item_Aggregation_Front_Banner.Item_Aggregation_Front_Banner_Type.RIGHT;
                                    break;

                                case "LEFT":
                                    type = Item_Aggregation_Front_Banner.Item_Aggregation_Front_Banner_Type.LEFT;
                                    break;

                                case "FULL":
                                    type = Item_Aggregation_Front_Banner.Item_Aggregation_Front_Banner_Type.FULL;
                                    break;
                                }
                            }
                            if (NodeReader.MoveToAttribute("width"))
                            {
                                ushort.TryParse(NodeReader.Value, out width);
                            }
                            if (NodeReader.MoveToAttribute("height"))
                            {
                                ushort.TryParse(NodeReader.Value, out height);
                            }
                        }

                        // Now read the banner information and add to the aggregation object
                        NodeReader.Read();
                        if (special)
                        {
                            Item_Aggregation_Front_Banner bannerObj = HierarchyObject.Add_Front_Banner_Image(NodeReader.Value, Web_Language_Enum_Converter.Code_To_Enum(lang));
                            bannerObj.Width       = width;
                            bannerObj.Height      = height;
                            bannerObj.Banner_Type = type;
                        }
                        else
                        {
                            HierarchyObject.Add_Banner_Image(NodeReader.Value, Web_Language_Enum_Converter.Code_To_Enum(lang));
                        }


                        break;
                    }
                }

                if ((NodeReader.NodeType == XmlNodeType.EndElement) && (NodeReader.Name.Trim().ToUpper() == "HI:BANNER"))
                {
                    return;
                }
            }
        }