using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Models;
using LoveBLL;

namespace LoveWeb.Admin
{
    public partial class NewsView : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            News news = new News();
            news.Title = btntitle.Text;
            news.News_contents = FCKeditor1.Value;
            news.News_author = author.Text;
            news.News_codeid = Convert.ToInt32(dpl.SelectedValue);
            news.Newstime = Convert.ToDateTime(newstime.Text.ToString()); 
            bool checkAdd=NewsManager.AddNews(news);
            if (checkAdd)
            {
                Response.Write("<script>alert('添加新闻成功！');</script>");
                btntitle.Text = "";
                author.Text = "";
                newstime.Text = "";
                FCKeditor1.Value = "";
                Response.Redirect("~/Admin/NewsView.aspx");
            }
            else
            {
                Response.Write("<script>alert('添加新闻失败！')</script>");
            }
        }
    }
}
