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 addAlbum : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        DB db = new DB();
        string albumName = TextBox1.Text;
        DateTime albumTime = DateTime.Now;
        string logourl = "image/" + FileUpload1.FileName;
        string exname = FileUpload1.FileName.Split('.')[1];
        string albumDesc = TextBox2.Text;
        if (exname.ToLower() == "jpg" || exname.ToLower() == "gif" || exname.ToLower() == "png")
        {
            FileUpload1.SaveAs(Server.MapPath(logourl));
 
        }
        db.AddAlbum(albumName, albumTime, logourl, albumDesc);
        Response.Write("<script>('创建专集成功');location.href='default.aspx';</script>");
    }
}
