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;
using System.IO;

public partial class mp4LookAdd : System.Web.UI.Page
{
    mp4films mf = new mp4films();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Session["UserID"] == null && Session["UserName"] != "shuanghan")
            {
                Response.Write("<script>alert(\"请管理员登录!\")</script>");
                Response.Write("<meta http-equiv='refresh' content='1;url=mp4.aspx'>");
            }
        }
    }
    protected void upload_Click(object sender, EventArgs e)
    {
        if (Session["UserID"] != null)
        {
            string mp4Title = Mp4Title.Text.Trim();
            string mp4Pic = Mp4Pic.Text.Trim();
            string mp4Url = Mp4Url.Text.Trim();
            string mp4Size = Mp4Size.Text.Trim();
            string mp4Intro = Mp4Intro.Text.Trim();
            if (mp4Title.Length <= 50)
            {
                try
                {
                    //执行存储过程,返回bool值
                    mf.UpLoadMp4LookData(mp4Title,mp4Pic,mp4Url,mp4Size,mp4Intro);
                    Response.Write("<script>alert(\"上传成功！\")</script>");
                    select.Visible = true;         
                }
                catch (Exception ex)
                {
                    Response.Write("<script>alert(\"上传失败！\")</script>");
                    //throw new Exception(ex.Message, ex);
                }
            }
            else
            {
                Response.Write("<script>alert(\"影片名称超过５０！\")</script>");
            }
        }
        else
        {
            Response.Write("<script>alert(\"您还没有登陆，请登陆后上传！\")</script>");
        }
    }
}
