示例#1
0
        public void AddLink(string title, string uri)
        {
            XmlDocument doc = new XmlDataDocument();
            doc.Load("RssLinks.xml");
            XmlNode rootNode = doc.SelectSingleNode("links");

            XmlNode linkNode = doc.CreateElement("link");

            XmlNode titleNode = doc.CreateElement("title");
            XmlText titleText = doc.CreateTextNode(title);
            titleNode.AppendChild(titleText);

            XmlNode uriNode = doc.CreateElement("uri");
            XmlText uriText = doc.CreateTextNode(uri);
            uriNode.AppendChild(uriText);

            XmlNode defaultshowNode = doc.CreateElement("defaultshow");
            XmlText defaultshowText = doc.CreateTextNode("false");
            defaultshowNode.AppendChild(defaultshowText);

            linkNode.AppendChild(titleNode);
            linkNode.AppendChild(uriNode);
            linkNode.AppendChild(defaultshowNode);

            rootNode.AppendChild(linkNode);

            doc.Save("RssLinks.xml");
        }
示例#2
0
        public XmlDataDocument DataCollection(string mac, string ip, string hostname, string UserName,string Domain)
        {
            string result = "";
            if (string.IsNullOrEmpty(mac) && string.IsNullOrEmpty(ip) && string.IsNullOrEmpty(hostname) && string.IsNullOrEmpty(UserName) && string.IsNullOrEmpty(Domain))
            {
                result = "-2";
            }
            else
            {
                SqlStatment.InsertData(mac, ip, hostname, UserName,Domain);
                result = "0";
            }
            XmlDataDocument xd = new XmlDataDocument();
            //XmlStr.Append("<?xml version=\"1.0\" encoding=\"gb2312\"?>");
            XmlDeclaration newDec = xd.CreateXmlDeclaration("1.0", "gb2312", null);
            xd.AppendChild(newDec);
            XmlElement xmlElemFileName = xd.CreateElement("result");

            XmlText xmlTextFileName = xd.CreateTextNode(result);
            xmlElemFileName.AppendChild(xmlTextFileName);
            xd.AppendChild(xmlElemFileName);

            return xd;
        }
示例#3
0
        public XmlDataDocument CheckClient(string mac, string ip, string hostname,string UserName,string Domain)
        {
            string result = "";
            if (string.IsNullOrEmpty(mac) && string.IsNullOrEmpty(ip) && string.IsNullOrEmpty(hostname) && string.IsNullOrEmpty(Domain))
            {
                result = "-2";
            }
            else
            {
                DataTable dt = SqlStatment.CheckLogin(hostname, mac, Domain);
                result = dt.Rows[0][0].ToString();
            }
            XmlDataDocument xd = new XmlDataDocument();
            //XmlStr.Append("<?xml version=\"1.0\" encoding=\"gb2312\"?>");
            XmlDeclaration newDec = xd.CreateXmlDeclaration("1.0", "gb2312", null);
            xd.AppendChild(newDec);
            XmlElement xmlElemFileName = xd.CreateElement("result");

            XmlText xmlTextFileName = xd.CreateTextNode(result);
                    xmlElemFileName.AppendChild(xmlTextFileName);
                    xd.AppendChild(xmlElemFileName);
           
            return xd;
        }