/// <summary>
 /// 修改节点
 /// </summary>
 public bool Edit(UrlRewrite entity)
 {
     string filePath = Utils.GetXmlMapPath(SysKeys.FILE_URL_XML_CONFING);
     XmlDocument doc = new XmlDocument();
     doc.Load(filePath);
     XmlNode xn = doc.SelectSingleNode("urls");
     XmlNodeList xnList = xn.ChildNodes;
     if (xnList.Count > 0)
     {
         foreach (XmlElement xe in xnList)
         {
             if (xe.Attributes["name"].Value.ToLower() == entity.name.ToLower())
             {
                 xe.Attributes["path"].Value = entity.path;
                 xe.Attributes["pattern"].Value = entity.pattern;
                 xe.Attributes["page"].Value = entity.page;
                 xe.Attributes["querystring"].Value = entity.querystring;
                 xe.Attributes["templet"].Value = entity.templet;
                 xe.Attributes["channel"].Value = entity.channel.ToString();
                 xe.Attributes["type"].Value = entity.type;
                 xe.Attributes["inherit"].Value = entity.inherit;
                 doc.Save(filePath);
                 return true;
             }
         }
     }
     return false;
 }
 /// <summary>
 /// 取得节点配制信息
 /// </summary>
 public UrlRewrite GetInfo(string attrValue)
 {
     UrlRewrite entity = new UrlRewrite();
     string filePath = Utils.GetXmlMapPath(SysKeys.FILE_URL_XML_CONFING);
     XmlDocument doc = new XmlDocument();
     doc.Load(filePath);
     XmlNode xn = doc.SelectSingleNode("urls");
     XmlNodeList xnList = xn.ChildNodes;
     if (xnList.Count > 0)
     {
         foreach (XmlElement xe in xnList)
         {
             if (xe.Attributes["name"].Value.ToLower() == attrValue.ToLower())
             {
                 entity.name = xe.Attributes["name"].Value;
                 entity.path = xe.Attributes["path"].Value;
                 entity.pattern = xe.Attributes["pattern"].Value;
                 entity.page = xe.Attributes["page"].Value;
                 entity.querystring = xe.Attributes["querystring"].Value;
                 entity.templet = xe.Attributes["templet"].Value;
                 entity.channel = xe.Attributes["channel"].Value;
                 entity.type = xe.Attributes["type"].Value;
                 entity.inherit = xe.Attributes["inherit"].Value;
                 return entity;
             }
         }
     }
     return null;
 }
 /// <summary>
 /// 增加节点
 /// </summary>
 public bool Add(UrlRewrite entity)
 {
     try
     {
         string filePath = Utils.GetXmlMapPath(SysKeys.FILE_URL_XML_CONFING);
         XmlDocument doc = new XmlDocument();
         doc.Load(filePath);
         XmlNode xn = doc.SelectSingleNode("urls");
         XmlElement xe = doc.CreateElement("rewrite");
         xe.SetAttribute("name", entity.name);
         xe.SetAttribute("path", entity.path);
         xe.SetAttribute("pattern", entity.pattern);
         xe.SetAttribute("page", entity.page);
         xe.SetAttribute("querystring", entity.querystring);
         xe.SetAttribute("templet", entity.templet);
         xe.SetAttribute("channel", entity.channel.ToString());
         xe.SetAttribute("type", entity.type);
         xe.SetAttribute("inherit", entity.inherit);
         xn.AppendChild(xe);
         doc.Save(filePath);
         return true;
     }
     catch
     {
         return false;
     }
 }
 /// <summary>
 /// 修改节点
 /// </summary>
 public bool Edit(UrlRewrite entity)
 {
     return dal.Edit(entity);
 }
 /// <summary>
 /// 增加节点
 /// </summary>
 public bool Add(UrlRewrite entity)
 {
     return dal.Add(entity);
 }