// // GET: /News/ #region <ActionResult> public ActionResult Index(string Module) { HealthEducationList HElist = new HealthEducationList(); if (Module != null) HElist.selectedModuleId = Module; HElist.ModuleList = new List<SelectListItem>(); DataSet ModuleInfo = _ServicesSoapClient.GetMstTaskByParentCode("TD0000"); foreach (DataRow Row in ModuleInfo.Tables[0].Rows) { SelectListItem NewLine = new SelectListItem(); NewLine.Value = Row[1].ToString(); NewLine.Text = Row[2].ToString() + "模块"; HElist.ModuleList.Add(NewLine); } if (HElist.selectedModuleId == "") { HElist.selectedModuleId = "TD0001"; } DataSet info = _ServicesSoapClient.GetMstTaskByParentCode(HElist.selectedModuleId); SelectListItem SelectedModule = HElist.ModuleList.Find( delegate(SelectListItem x) { return x.Value == HElist.selectedModuleId; }); foreach (DataRow row in info.Tables[0].Rows) { HealthEducation news = new HealthEducation(); news.Module = HElist.selectedModuleId; news.ModuleName = SelectedModule.Text; news.Id = row[1].ToString(); news.Path = row[9].ToString(); news.Title = row[2].ToString(); news.CreateDateTime = row[10].ToString(); news.Author = row[11].ToString(); news.AuthorName = row[12].ToString(); HElist.HEList.Add(news); } return View(HElist); }
public NewHealthEducationFile() { selectedModuleId = ""; news = new HealthEducation(); }
public ActionResult Edit(string Module, string Id) { TaskDetailInfo info = _ServicesSoapClient.GetCmTaskItemInfo(Module.Substring(0, 2), Id); HealthEducation news = new HealthEducation(); news.Module = Module; news.Id = Id; news.Path = info.OptionCategory; news.Title = info.Name; news.CreateDateTime = info.CreateDateTime.ToString(); news.Author = info.Author; news.AuthorName = info.AuthorName; string dir = Server.MapPath("/"); StreamReader sr = new StreamReader(dir + news.Path.Substring(1).Replace("/","\\"), Encoding.GetEncoding("GB2312")); string temp; news.htmlContent = ""; if ((temp = sr.ReadLine()) != null) { Regex reg = new Regex(@"<body>([\s\S]*)</body>", RegexOptions.IgnoreCase); MatchCollection mc = reg.Matches(temp); news.htmlContent = mc[0].Value; news.htmlContent = news.htmlContent.Substring(6, news.htmlContent.Length - 13); } sr.Close(); NewHealthEducationFile nhe = new NewHealthEducationFile(); nhe.selectedModuleId = Module; nhe.news = news; nhe.ModuleList = new List<SelectListItem>(); DataSet ModuleInfo = _ServicesSoapClient.GetMstTaskByParentCode("TD0000"); foreach (DataRow Row in ModuleInfo.Tables[0].Rows) { SelectListItem NewLine = new SelectListItem(); NewLine.Value = Row[1].ToString(); NewLine.Text = Row[2].ToString() + "模块"; nhe.ModuleList.Add(NewLine); } return View(nhe); }
public ActionResult Index() { HealthEducationList HElist = new HealthEducationList(); DataSet info = _ServicesSoapClient.GetAddressByTypeList(HElist.selectedModuleId, 5); foreach (DataRow row in info.Tables[0].Rows) { HealthEducation news = new HealthEducation(); news.Module = row[0].ToString(); news.ModuleName = row[1].ToString(); news.Id = row[2].ToString(); news.Type = Convert.ToInt32(row[3].ToString()); news.FileName = row[5].ToString(); news.Path = row[6].ToString(); news.Title = row[7].ToString(); news.CreateDateTime = row[8].ToString(); news.Author = row[9].ToString(); news.AuthorName = row[10].ToString(); HElist.HEList.Add(news); } return View(HElist); }
public ActionResult Edit(string Module, string Id) { DataSet info = _ServicesSoapClient.GetAll(Module, Id); HealthEducation news = new HealthEducation(); if (info.Tables[0].Rows.Count > 0) { DataRow row = info.Tables[0].Rows[0]; news.Module = Module; news.Id = Id; news.Type = Convert.ToInt32(row[2].ToString()); news.FileName = row[4].ToString(); news.Path = row[5].ToString(); news.Title = row[6].ToString(); news.CreateDateTime = row[7].ToString(); news.Author = row[8].ToString(); news.AuthorName = row[9].ToString(); string dir = Server.MapPath("/") + "HealthEducation\\"; StreamReader sr = new StreamReader(dir + news.FileName, Encoding.GetEncoding("GB2312")); string temp; news.htmlContent = ""; if ((temp = sr.ReadLine()) != null) { Regex reg = new Regex(@"<body>([\s\S]*)</body>", RegexOptions.IgnoreCase); MatchCollection mc = reg.Matches(temp); news.htmlContent = mc[0].Value; news.htmlContent = news.htmlContent.Substring(6, news.htmlContent.Length - 13); } sr.Close(); } NewHealthEducationFile nhe = new NewHealthEducationFile(); nhe.selectedModuleId = Module; nhe.news = news; return View(nhe); }