Beispiel #1
0
        public static NewsItem GetByID(int ID)
        {
            NewsItemDataMapper objCaller = new NewsItemDataMapper();

            return objCaller.GetByID(ID);
        }
Beispiel #2
0
        public static XmlDocument GetByIDasXml(int ID)
        {
            NewsItemDataMapper objCaller = new NewsItemDataMapper();

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

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

            XmlAttribute xName, xDesc, xDetails, xUrl, xCreationdate, xImage, xTitle, xID;

            xName = xdoc.CreateAttribute("NAME");
            xDesc = xdoc.CreateAttribute("DESCRIPTION");

            xID = xdoc.CreateAttribute("ID");
            xDetails = xdoc.CreateAttribute("DETAILS");
            xImage = xdoc.CreateAttribute("IMAGE");
            xUrl = xdoc.CreateAttribute("URL");
            xCreationdate = xdoc.CreateAttribute("CREATION_DATE");

            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(xID);

            xitem.Attributes.Append(xDetails);
            xitem.Attributes.Append(xUrl);
            xitem.Attributes.Append(xCreationdate);
            xitem.Attributes.Append(xImage);

            return xdoc;
        }