Esempio n. 1
0
        public static NewsItem GetByGUID(string GUID)
        {
            NewsItemDataMapper objCaller = new NewsItemDataMapper();

            return objCaller.GetByGUID(GUID);
        }
Esempio n. 2
0
        public static XmlDocument GetByIDasXml(string GUID)
        {
            NewsItemDataMapper objCaller = new NewsItemDataMapper();

            NewsItem _news = objCaller.GetByGUID(GUID);
            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, xGUID, 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");
            xGUID = xdoc.CreateAttribute("GUID");

            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();
            xGUID.Value = _news.Guid.ToString();

            xitem.Attributes.Append(xName);
            xitem.Attributes.Append(xDesc);
            xitem.Attributes.Append(xID);
            xitem.Attributes.Append(xGUID);
            xitem.Attributes.Append(xDetails);
            xitem.Attributes.Append(xUrl);
            xitem.Attributes.Append(xCreationdate);
            xitem.Attributes.Append(xImage);

            return xdoc;
        }