⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addvideo.aspx.cs

📁 毕业设计——在线视频点播系统 内容很全
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace gllbysj
{
	/// <summary>
	/// addVideo 的摘要说明。
	/// </summary>
	public class addVideo : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label Label1;
		protected System.Web.UI.WebControls.TextBox TextBox3;
		protected System.Web.UI.WebControls.TextBox TextBox5;
		protected System.Web.UI.WebControls.TextBox TextBox2;
		protected System.Web.UI.WebControls.DropDownList DropDownList1;
		protected System.Web.UI.HtmlControls.HtmlInputFile File1;
		protected System.Web.UI.WebControls.Button Button2;
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.WebControls.TextBox TextBox1;
		protected System.Web.UI.HtmlControls.HtmlInputFile File2;
		protected System.Web.UI.WebControls.Panel Panel1;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			if(Session["gl"]!="1")
			{
			Response.Write("<script language=javascript>alert('您没有管理权限!');location='index.htm' </script>");
			}
			this.Button1.Attributes.Add("OnClick","return confirm('确实要添加该影片吗?')");
		}
		public void insert()
		{

		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.Button1.Click += new System.EventHandler(this.Button1_Click);
			this.Button2.Click += new System.EventHandler(this.Button2_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void Button1_Click(object sender, System.EventArgs e)
		{

			//Response.Write("<script language=javascript>confirm()</script>");
			string fullname=this.File1.PostedFile.FileName;
			string image=fullname.Substring(fullname.LastIndexOf("\\")+1);
			string type=fullname.Substring(fullname.LastIndexOf(".")+1);
			string vodname=this.File2.PostedFile.FileName;
			string filename=vodname.Substring(vodname.LastIndexOf("\\")+1);
			string filetype=vodname.Substring(vodname.LastIndexOf(".")+1);
			if(filetype=="wmv"||filetype=="avi"||filetype=="asf")
			{
            
				if(type=="bmp"||type=="jpg"||type=="gif")
				{
					//string image1=image;
					//Response.Write("<script>if(confirm('确定要存储吗?')) insert();else history.go(-1)	;		</script>");
					SqlConnection con=db.createcon();
					con.Open();
					string dl=this.DropDownList1.SelectedItem.Text;
					//string dl="喜剧片";
					string name=this.TextBox1.Text;
					//string filename=this.TextBox4.Text;
					// string image=this.TextBox1.Text;
					string sizve=this.TextBox2.Text;
					string descr=this.TextBox3.Text;
					string mainp=this.TextBox5.Text;
					string time=Convert.ToString(System.DateTime.Now);
					//string g=this.TextBox1.Text;
					string str="insert into mess(class1,name,filename,image,sizev,descr,主要演员,times) values('"+dl+"','"+name+"','"+filename+"','"+image+"','"+sizve+"','"+descr+"','"+mainp+"','"+time+"')";
					this.File1.PostedFile.SaveAs(Server.MapPath("upimage")+"\\"+image);
					this.File2.PostedFile.SaveAs(Server.MapPath("view")+"\\"+filename);
					SqlCommand cmm=new SqlCommand(str,con);
					cmm.ExecuteNonQuery();
					con.Close();
					Response.Write("<script language=javascript>alert('添加成功')</script>");
			

			
				}
				else
					Response.Write("<script language=javascript>alert('您存的图片格式不正确!')</script>");
			}
			else
			{
				Response.Write("<script language=javascript>alert('影片文件格式不正确!')</script>");
			}
		}





		private void Button2_Click(object sender, System.EventArgs e)
		{
			this.TextBox1.Text="";
            this.TextBox2.Text="";
			this.TextBox3.Text="";
			//this.TextBox4.Text="";
			this.TextBox5.Text="";
			
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -