using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class CalendarManage_NewNotepad : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }


    protected void Button1_Click(object sender, EventArgs e)
    {
        if (this.txTitle.Value.Trim() == "" || this.txContent.Value.Trim() == "")
        {
            Response.Write("<script>alert('请输入详细信息！')</script>");
        }
        else
        {

            try
            {
                SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
                con.Open();
                string Message = this.txContent.Value.Trim();
                string Title = this.txTitle.Value.Trim();
                DateTime addtime = DateTime.Now;
                string UserName = Session["UserName"].ToString();
                string sql = "insert into Notepaper values('" + Message + "','" + addtime + "','" + UserName + "','" + Title + "')";
                SqlCommand com = new SqlCommand(sql, con);
                com.ExecuteNonQuery();
                Response.Write("<script>alert('保存成功！');window.location.href='Notepad.aspx';</script>");
                con.Close();
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
    }
}
