Beispiel #1
0
        public static XmlDocument GetByIDasXml(int ID)
        {
            MenuItemDataMapper objCaller = new MenuItemDataMapper();

            MenuItem _news = objCaller.GetByID(ID);
            if (null == _news)
                return null;
            XmlDocument xdoc = new XmlDocument();
            XmlElement xroot = xdoc.CreateElement("Data");
            XmlElement xitem = xdoc.CreateElement("MenuItems");

            xdoc.AppendChild(xroot);
            xroot.AppendChild(xitem);

            XmlAttribute xName, xDesc, xId, xDetails, xUrl, xCreationdate, xImage;

            xName = xdoc.CreateAttribute("NAME");
            xDesc = xdoc.CreateAttribute("DESCRIPTION");
            xDetails = xdoc.CreateAttribute("DETAILS");
            xUrl = xdoc.CreateAttribute("URL");
            xCreationdate = xdoc.CreateAttribute("CREATION_DATE");
            xImage = xdoc.CreateAttribute("IMAGE");
            xId = xdoc.CreateAttribute("ID");

            xName.Value = _news.Name;
            xDesc.Value = _news.Description;
            xDetails.Value = _news.Details;
            xUrl.Value = _news.Url;
            xCreationdate.Value = _news.CreationDate;
            xImage.Value = _news.Image;
            xId.Value = _news.ID.ToString();
            xitem.Attributes.Append(xName);
            xitem.Attributes.Append(xDesc);
            xitem.Attributes.Append(xDetails);
            xitem.Attributes.Append(xUrl);
            xitem.Attributes.Append(xCreationdate);
            xitem.Attributes.Append(xImage);
            xitem.Attributes.Append(xId);
            return xdoc;
        }
Beispiel #2
0
        public static MenuItem GetByID(int ID)
        {
            MenuItemDataMapper objCaller = new MenuItemDataMapper();

            return objCaller.GetByID(ID);
        }