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
{
    public partial class SoulAdd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

            }
            else
            {
                if (Session["username"] != null)
                {
                    Label1.Text = Session["username"].ToString();
                }
               
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (Label1.Text != "")
            {

                Article arti = new Article();
                arti.Arti_title = btnArtiTitle.Text;
                arti.Arti_contents = FCK_arti.Value;
                arti.Arti_time = System.DateTime.Now;
                arti.Arti_codeid = Convert.ToInt32(DropDownList1.SelectedValue);
                arti.Userid = UserManager.GetIdByUsername(Label1.Text).Userid;

                ArticleManager.AddArti(arti);

                Response.Redirect("~/Soul.aspx");
            }
            else
            {
                Session["sort"] = "Soul";
                Response.Write("<script>alert('请先登录！')</script>");
                Response.Redirect("~/Login/Login.aspx");
            }
        }
    }
}
