Beispiel #1
0
        protected void txtOK_Click(object sender, EventArgs e)
        {
            BLL.NewsBLL n    = new BLL.NewsBLL();
            Model.News  news = new Model.News();

            news.Title   = txtTitle.Text;
            news.Content = txtContent.Text;
            news.Author  = txtAuthor.Text;

            bool flag = n.InsertNews(news);

            if (txtTitle.Text == "" || txtContent.Text == "" || txtAuthor.Text == "")
            {
                Response.Write("<script language='javascript'>alert('请将内容填写完整!');</script>");
            }
            else
            {
                if (flag)
                {
                    Response.Write("<script language='javascript'>alert('新闻发布成功!');</script>");
                }
                else
                {
                    Response.Write("<script language='javascript'>alert('新闻发布失败!');</script>");
                }
            }
        }
Beispiel #2
0
 public void del(string id)
 {
     Model.News news = new Model.News();
     news.id = id;
     BLL.NewsBLL newsBLL = new BLL.NewsBLL();
     if (newsBLL.DelNews(news))
     {
         Response.Write("<script>alert('删除成功');location.href='report_check.aspx'</script>");
     }
 }
Beispiel #3
0
 protected void Button2_Click1(object sender, EventArgs e)
 {
     Model.News news = new Model.News();
     news.id = s;
     BLL.NewsBLL newsBLL = new BLL.NewsBLL();
     if (newsBLL.DelNews(news))
     {
         Response.Write("<script>alert('删除成功');location.href='choose.aspx'</script>");
     }
 }
Beispiel #4
0
 public void ss(string sousuo)
 {
     Model.News news = new Model.News();
     news.title = sousuo;
     BLL.NewsBLL newsBLL = new BLL.NewsBLL();
     if (newsBLL.SearchTitle(news))
     {
         this.SqlDataSource1.SelectCommand = news.sql;
     }
 }
Beispiel #5
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     Model.News news = new Model.News();
     news.id         = s;
     news.category   = DropDownList1.SelectedItem.Text;
     news.title      = Request["ttitle"].ToString();
     news.author     = Request["author"].ToString();
     news.contents   = this.txtEditorContents.Text;
     news.createTime = DateTime.Now.ToLocalTime().ToString();
     BLL.NewsBLL newsBLL = new BLL.NewsBLL();
     newsBLL.UpdateNews(news);
 }
Beispiel #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         k = Convert.ToInt32(Request["id"]);
         this.Label6.Text = k.ToString();
         //更新点击量
         Model.News news = new Model.News();
         news.id = k.ToString();
         BLL.NewsBLL newsBLL = new BLL.NewsBLL();
         newsBLL.UpdateClick(news);
     }
     chaxun(k);
 }
Beispiel #7
0
        public void newsupdate()
        {
            Model.News news = new Model.News();
            news.category   = DropDownList1.SelectedItem.Text;
            news.title      = Request["ttitle"].ToString();
            news.author     = Request["author"].ToString();
            news.contents   = this.txtEditorContents.Text;
            news.createTime = DateTime.Now.ToLocalTime().ToString();
            int click = 0;

            news.click = click.ToString();
            BLL.NewsBLL newsBLL = new BLL.NewsBLL();
            newsBLL.AddNews(news);
        }
Beispiel #8
0
 public void query(string id)
 {
     Model.News news = new Model.News();
     news.id = id;
     BLL.NewsBLL newsBLL = new BLL.NewsBLL();
     if (newsBLL.QueryNews(news))
     {
         this.ttitle.Value           = news.title.ToString();
         this.author.Value           = news.author.ToString();
         this.txtEditorContents.Text = news.contents;
     }
     else
     {
         Response.Write("<script>alert('查询失败')</script>");
     }
 }
Beispiel #9
0
 public void chaxun(string id)
 {
     Model.News news = new Model.News();
     news.id = id;
     BLL.NewsBLL newsBLL = new BLL.NewsBLL();
     if (newsBLL.QueryNews(news))
     {
         this.Label1.Text = news.id.ToString();
         this.Label2.Text = news.title.ToString();
         Page.Title       = "匿名举报新闻 -" + news.title.ToString();
     }
     else
     {
         Response.Write("<script>alert('查询失败')</script>");
     }
 }
Beispiel #10
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     Model.News  news    = new Model.News();
     BLL.NewsBLL newsBLL = new BLL.NewsBLL();
     if (this.DropDownList1.SelectedValue == "按标题")
     {
         news.title = Request["search"].ToString().Trim();
         newsBLL.SearchTitle(news);
         this.SqlDataSource1.SelectCommand = news.sql;
     }
     else if (this.DropDownList1.SelectedValue == "按类别")
     {
         news.category = Request["search"].ToString().Trim();
         newsBLL.SearchCategory(news);
         this.SqlDataSource1.SelectCommand = news.sql;
     }
 }
Beispiel #11
0
 public void chaxun(int id)
 {
     Model.News news = new Model.News();
     news.id = id.ToString();
     BLL.NewsBLL newsBLL = new BLL.NewsBLL();
     if (newsBLL.QueryNews(news))
     {
         this.Label1.Text = news.title.ToString();
         this.Label4.Text = news.author.ToString();
         this.Label3.Text = news.contents;
         this.Label2.Text = news.createTime.ToString();
         this.Label5.Text = news.category.ToString();
         this.Label7.Text = news.click.ToString();
         Page.Title       = news.title.ToString();
     }
     else
     {
         Response.Write("<script>alert('查询失败')</script>");
     }
 }
Beispiel #12
0
 //public string sou;
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["category"] != null)
     {
         Model.News news = new Model.News();
         news.category = Request.QueryString["category"].ToString();
         BLL.NewsBLL newsBLL = new BLL.NewsBLL();
         if (newsBLL.SearchCategory(news))
         {
             this.SqlDataSource1.SelectCommand = news.sql;
         }
     }
     else if (Session["search"] == null)
     {
         this.ssearch.Value = "";
     }
     else if (Session["search"] != null)
     {
         // sou = Session["search"].ToString();
         ss(Session["search"].ToString());
     }
 }