using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Xml;
/// <summary>
///GetXML 的摘要说明
/// </summary>
public class GetXML
{
public GetXML()
{
//
//TODO: 在此处添加构造函数逻辑
//
}
//地址是xml文件的地址,然后传入匹配项 看匹配项是否在xml中存在
public static bool XMLISTrue(string address, string cardId)
{
XmlDocument doc = new XmlDocument();
address = @"Ntours_GroupWebmanagerFIT_Activity_Rule/" + address;
doc.Load(address); //加载Xml文件
XmlElement rootElem = doc.DocumentElement; //获取根节点
XmlNodeList typeNode = rootElem.GetElementsByTagName("type");
int num = 0;
foreach (XmlNode node in typeNode)
{
if (node.Attributes["value"].Value.ToString()== "CheckCardId")
{
XmlNodeList visaNodes = node.ChildNodes;
foreach (XmlNode vnode in visaNodes)
{
if (cardId.Substring(0, 6) == vnode.InnerText)
{
num = 0;
break;
}
else
{
num++;
}
}
}
}
if (num != 0)
{
return false;
}
else
{
return true;
}
}
}