private static void read_banners(XmlNodeReader NodeReader, Complete_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_Type_Enum type = Item_Aggregation_Front_Banner_Type_Enum.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_Type_Enum.Right;
break;
case "LEFT":
type = Item_Aggregation_Front_Banner_Type_Enum.Left;
break;
case "FULL":
type = Item_Aggregation_Front_Banner_Type_Enum.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.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;
}
}
}