protected void btadGeneral_Click(object sender, EventArgs e) { Model.NewsFileProperty info = new XYECOM.Model.NewsFileProperty(); info.Count = XYECOM.Core.MyConvert.GetInt32(this.txtCount.Text.Trim()); info.VirtualPath = this.txtFullPath.Text.Trim(); info.NewsTypeId = this.hdgetid.Value; info.OnlyToday = this.ckToday.Checked ? "1" : "0"; info.WebMaster = this.txtWebMaster.Text.Trim(); info.UpdatePeri = this.txtUpdatePeri.Text.Trim(); info.DomainName = this.txtDomainName.Text.Trim().ToLower(); //验证 //Server.MapPath //保存 int res = newsSourceBLL.GeneralNewsSourceXML(info); if (res > 0) { BindData(); } }
/// <summary> /// 根据新闻源属性文件,解析出对应的类 /// </summary> /// <param name="propertyFilePath"></param> /// <returns></returns> public Model.NewsFileProperty AnalyzePropertyFile(string propertyFilePath) { FileInfo fileinfo = new FileInfo(propertyFilePath); Model.NewsFileProperty info = null; if (fileinfo.Exists) { info = new XYECOM.Model.NewsFileProperty(); XmlDocument doc = new XmlDocument(); doc.Load(propertyFilePath); XmlElement root = doc.DocumentElement; info.Count = XYECOM.Core.MyConvert.GetInt32(root.Attributes["Count"].Value); info.DomainName = root.Attributes["DomainName"].Value; info.NewsTypeId = root.Attributes["NewsTypeId"].Value; info.OnlyToday = root.Attributes["OnlyToday"].Value; info.UpdatePeri = root.Attributes["UpdatePeri"].Value; info.VirtualPath = root.Attributes["VirtualPath"].Value; info.WebMaster = root.Attributes["WebMaster"].Value; } return info; }