예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            BLArticle bll = new BLArticle();
            art = bll.SelectOne(Request.QueryString["Id"]);
            if (art != null)
            {
                this.artName.InnerText = art.ArticleName;
                this.artDate.InnerText = art.AddDate.ToString("yyyy-MM-dd HH:mm:ss");

                string path = GetPath(art.ArticlePath);
                string artContent="出错了...";
                try
                {
                    artContent = System.Text.Encoding.Default.GetString(System.IO.File.ReadAllBytes(path));
                }
                catch { }

                //artContent = System.Text.Encoding.Default.GetString(System.IO.File.ReadAllBytes(art.ArticlePath));
                this.articleContent.InnerHtml = artContent;
                fileName=art.ArticleName+art.AddDate.ToString("yyyy-MM-dd.HH-mm-ss");

                listReview = new BLReview().SelectByArticleId(art.Id.ToString());
            }
        }
    }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         this.btnSubmit.Attributes.Add("OnClick", "return confirm('确认添加?')");
     }
     else
     {
         string artContent = this.articleContent.Value;
         if (!string.IsNullOrEmpty(artContent))
         {
             string artName = this.tbArticleName.Text;
             //string artContent = Request.Form["articleContent"];
             DateTime addDate = DateTime.Now;
             string fileName = artName + addDate.ToString("yyyy-MM-dd.HH-mm-ss");
             string diectoryPath = BLArticle.artPath + fileName + @"\";
             System.IO.Directory.CreateDirectory(diectoryPath);
             string artPath = diectoryPath + fileName;
             System.IO.File.WriteAllBytes(artPath, System.Text.Encoding.Default.GetBytes(artContent));
             BLArticle bll = new BLArticle();
             if (bll.Insert(artName, artPath, addDate))
                 Response.Redirect("ArticleMaster.aspx");
         }
     }
 }
예제 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         BLL.BLArticle bl = new BLL.BLArticle();
         artList = bl.Select();
     }
 }