Rss.aspx.cs
using System;
using System.Data;
using System.Web;
using System.Xml;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Power.Rss;
![](/Images/OutliningIndicators/None.gif)
public partial class Rss : System.Web.UI.Page
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/ContractedBlock.gif)
{
protected void Page_Load(object sender, EventArgs e)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
ProblemXML xml = new ProblemXML();
string username = "";
string password = "";
string category = "0";
string pageSize = "20";
string pageIndex = "1";
string subModuleID ="0";
![](/Images/OutliningIndicators/InBlock.gif)
XmlDocument doc = new XmlDocument();
try
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
doc.Load(Request.InputStream);
}
catch
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
xml.PutError(ProblemXML.INPUT_ERROR);
return;
}
if (doc.HasChildNodes)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
username = doc.DocumentElement.SelectSingleNode("//username") == null ? "" : doc.DocumentElement.SelectSingleNode("//username").InnerText.Trim();
password = doc.DocumentElement.SelectSingleNode("//password") == null ? "" : doc.DocumentElement.SelectSingleNode("//password").InnerText.Trim();
category = doc.DocumentElement.SelectSingleNode("//category") == null ? "0" : doc.DocumentElement.SelectSingleNode("//category").InnerText;
pageSize = doc.DocumentElement.SelectSingleNode("//pageSize") == null ? "20" : doc.DocumentElement.SelectSingleNode("//pageSize").InnerText;
pageIndex = doc.DocumentElement.SelectSingleNode("//pageIndex") == null ? "1" : doc.DocumentElement.SelectSingleNode("//pageIndex").InnerText;
subModuleID = doc.DocumentElement.SelectSingleNode("//ModuleID") == null ? "0" : doc.DocumentElement.SelectSingleNode("//ModuleID").InnerText;
![](/Images/OutliningIndicators/InBlock.gif)
}
//验证
if (xml.CheckUser(username, password))
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
try
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
xml.PutProblemXML(Convert.ToUInt32(category), Convert.ToUInt32(pageSize), Convert.ToUInt32(pageIndex), username,subModuleID);
}
catch(Exception ex)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
xml.PutError(ex.Message);
}
}
else
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
xml.PutError(ProblemXML.INPUT_PASSWORD_ERROR);
}
![](/Images/OutliningIndicators/InBlock.gif)
}
}
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
testRss.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>XmlHttp测试</title>
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
<script type="text/javascript">![](/Images/dot.gif)
function testxml()
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
var username = document.getElementById("txtUserName").value;
var password = document.getElementById("txtPassword").value;
var pageSize = document.getElementById("PageSize").value;
var pageIndex =document.getElementById("PageIndex").value;
var ModuleID;
var category;
for(var i = 0 ;i<document.getElementById("SelSubModule").options.length;i++)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
if(document.getElementById("SelSubModule").options[i].selected)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
var ModuleID = document.getElementById("SelSubModule").options[i].value;
}
}
for(var i=0;i<document.getElementById("SelCategory").options.length;i++)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
if(document.getElementById("SelCategory").options[i].selected)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
category = document.getElementById("SelCategory").options[i].value;
}
}
var strXML = "<Client>\r\n<FormData>\r\n";
strXML +="<username> " + username + "</username>\r\n";
strXML +="<password>" + password + "</password>\r\n";
strXML +="<category>" + category + "</category>\r\n";
strXML +="<pageSize>" + pageSize + "</pageSize>\r\n";
strXML +="<pageIndex>" + pageIndex +"</pageIndex>\r\n";
strXML +="<ModuleID>" + ModuleID +"</ModuleID>\r\n";
strXML += "</FormData>\r\n</Client>"
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
xmlhttp.open('POST','Rss.aspx',false);
xmlhttp.send(strXML);
if(xmlhttp.readyState == 4)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
document.getElementById("div1").innerText= xmlhttp.responseText;
}
![](/Images/OutliningIndicators/InBlock.gif)
}
function GetSubModule()
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
xmlModule = new ActiveXObject("Msxml2.XMLHTTP");
xmlModule.open("get","Rss_SubModule.aspx",true);
xmlModule.onreadystatechange = ShowModule;
xmlModule.send(null);
}
function ShowModule()
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
if(xmlModule.readyState == 4)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
if(xmlModule.status == 200)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
var doc = new ActiveXObject("Msxml2.DOMDocument");
doc.loadXML(xmlModule.responseText);
var items = doc.getElementsByTagName("SubModule");
for(var i = 0; i < items.length ; i++)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
var op = document.createElement("option");
op.value = items[i].getElementsByTagName("SubModuleID")[0].firstChild.nodeValue;
var txt = document.createTextNode(items[i].getElementsByTagName("SubModuleName")[0].firstChild.nodeValue);
op.appendChild(txt);
document.getElementById("SelSubModule").appendChild(op);
}
}
else
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
alert(xmlModule.statusText);
}
}
}
</script>
</head>
<body style="font-size:12px" onload="GetSubModule()">
<div>
<table border="0" cellpadding="2" cellspacing="1" style="background-color: #a9a9a9">
<tr>
<td style="width: 100px; background-color: #ffffff;">
用户名:</td>
<td style="background-color: #ffffff;">
<input id="txtUserName" type="text" /></td>
</tr>
<tr>
<td style="width: 100px; background-color: #ffffff;">
密 码:</td>
<td style="background-color: #ffffff;">
<input id="txtPassword" style="width: 150px" type="password" /></td>
</tr>
<tr>
<td style="width: 100px; background-color: #ffffff;">
页分大小:</td>
<td style="background-color: #ffffff;">
<input id="PageSize" type="text" value="20" /></td>
</tr>
<tr>
<td style="width: 100px; background-color: #ffffff;">
页分索引:</td>
<td style="background-color: #ffffff;">
<input id="PageIndex" type="text" value="1" /></td>
</tr>
<tr>
<td style="width: 100px; background-color: #ffffff;">
模块节点:</td>
<td style="background-color: #ffffff;">
<select id="SelSubModule" style="width: 155px">
<option selected="selected" value="0">全部类型</option>
</select>
</td>
</tr>
<tr>
<td style="width: 100px; background-color: #ffffff">
分 类:</td>
<td style="background-color: #ffffff">
<select id="SelCategory" style="width: 154px">
<option selected="selected" value="0">全部问题</option>
<option value="1">已解决的问题</option>
<option value="2">未解决的问题</option>
<option value="3">我解决的问题</option>
<option value="4">我未解决的问题</option>
<option value="5">未回复的问题</option>
<option value="6">回复后又修改的问题</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" style="background-color: #ffffff" align="center">
<input id="Button1" type="button" value="button" onclick="testxml()"/></td>
</tr>
</table>
<div id="div1" style="background-color:#ffffe9 ;"></div>
</div>
</body>
</html>