Exemple #1
0
        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));
        }