Parsing the passed XML, judging if event is subscribe and Eventkey is not empty and contains qrscene_ or event is scan,
1. Get the scene number
int scanId = Int. Parse (TXTMessage_T.EventKey.Replace ("Qrscene_", "" "));
2. Build return XML, message sender and receiver Exchange
XML = new XmlDocument ();
XmlElement Elem;
Xmlcdatasection XC;
XmlNodeList nodelist;
XmlNode node;
Construct send message to user XML node content
Elem = XML. createelement ("xml");
Xml. AppendChild (Elem);
NodeList = XML. SelectNodes ("Descendant::xml");
node = nodelist. Item (nodelist. COUNT-1);
Redeem the original message sender and receiver
Elem = XML. CreateElement ("Tousername");
XC = XML. Createcdatasection (Txtmessage_t.fromusername);
Elem. AppendChild (XC);
Node. AppendChild (Elem);
Elem = XML. CreateElement ("Fromusername");
XC = XML. Createcdatasection (Txtmessage_t.tousername);
Elem. AppendChild (XC);
Node. AppendChild (Elem);
Time conversion to Long integer type
Elem = XML. CreateElement ("Createtime");
Elem. InnerText = Methods.fanlitime (). ToString ();
Node. AppendChild (Elem);
Building the text message XML
Elem = XML. CreateElement ("Msgtype");
Text message
XC = XML. Createcdatasection ("News");
Elem. AppendChild (XC);
Node. AppendChild (Elem);
The maximum number of text messages is 10
Elem = XML. CreateElement ("Articlecount");
Elem. InnerText = "1";
Node. AppendChild (Elem);
Text message Content
Elem = XML. CreateElement ("articles");
Node. AppendChild (Elem);
NodeList = XML. SelectNodes ("Xml/articles");
node = nodelist. Item (nodelist. COUNT-1);
Single text message item
Elem = XML. CreateElement ("item");
Node. AppendChild (Elem);
NodeList = XML. SelectNodes ("Xml/articles/item");
node = nodelist. Item (nodelist. COUNT-1);
Title
Elem = XML. CreateElement ("Title");
XC = XML. Createcdatasection (title);
Elem. AppendChild (XC);
Node. AppendChild (Elem);
Describe
Elem = XML. CreateElement ("Description");
XC = XML. Createcdatasection (title);
Elem. AppendChild (XC);
Node. AppendChild (Elem);
Image
Elem = XML. CreateElement ("Picurl");
XC = XML. Createcdatasection (IMG);
Elem. AppendChild (XC);
Node. AppendChild (Elem);
Link
Elem = XML. CreateElement ("Url");
XC = XML. Createcdatasection (Scanurl);
Elem. AppendChild (XC);
Node. AppendChild (Elem);
return XML
System.Web.HttpContext.Current.Response.Write (XML. OuterXml);
Sweep code with parameter QR code Scan code attention