Article_Add.aspx.cs
上传用户:szraylite
上传日期:2018-06-06
资源大小:11546k
文件大小:2k
源码类别:

软件测试

开发平台:

Java

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using ENTERPRISE.BusinessLogicLayer;
  12. using ENTERPRISE.DataAccessHelper;
  13. using ENTERPRISE.DataAccessLayer;
  14. public partial class admin_Article_Add : System.Web.UI.Page
  15. {
  16.     protected void Page_Load(object sender, EventArgs e)
  17.     {
  18.         InitData();
  19.     }
  20.     public void InitData()
  21.     {
  22.         DataSet ds = ArticleClass.Queryclass();
  23.         ddl_ArticleClass.DataSource = ds.Tables[0];
  24.         ddl_ArticleClass.DataTextField = "column_name";
  25.         ddl_ArticleClass.DataValueField = "id";
  26.         ddl_ArticleClass.DataBind();
  27.     }
  28.     protected void add_Click(object sender, EventArgs e)
  29.     {
  30.         NoSortHashtable ht = new NoSortHashtable();
  31.         ht.Add("title", SqlStringFormat.GetQuotedString(txb_Title.Text));
  32.         ht.Add("content", System.Web.HttpUtility.HtmlEncode(SqlStringFormat.GetQuotedString(FreeTextBox1.Text)));
  33.         ht.Add("reporter", SqlStringFormat.GetQuotedString(txb_Author.Text));
  34.         ht.Add("notetime", SqlStringFormat.GetQuotedString(System.DateTime.Now.ToString()));
  35.         ht.Add("belong_column", SqlStringFormat.GetQuotedString(ddl_ArticleClass.Text));       
  36.         Article article = new Article();
  37.         article.Add(ht);
  38.         Response.Write(System.Web.HttpUtility.HtmlEncode(SqlStringFormat.GetQuotedString(FreeTextBox1.Text)));
  39.     }
  40. }