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

📄 baohu.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>
	/// baohu 的摘要说明。
	/// </summary>
	public class baohu : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.LinkButton LinkButton1;
		protected System.Web.UI.WebControls.TextBox TextBox2;
		protected System.Web.UI.WebControls.TextBox TextBox1;
		protected System.Web.UI.WebControls.Panel Panel1;
		protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
		protected System.Web.UI.WebControls.TextBox TextBox4;
		protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
		protected System.Web.UI.WebControls.TextBox TextBox3;
		protected System.Web.UI.WebControls.Label Label1;
		protected System.Web.UI.WebControls.Panel Panel2;
		protected System.Web.UI.WebControls.LinkButton LinkButton5;
		protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator4;
		protected System.Web.UI.WebControls.TextBox TextBox6;
		protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;
		protected System.Web.UI.WebControls.TextBox TextBox5;
		protected System.Web.UI.WebControls.Panel Panel4;
		protected System.Web.UI.WebControls.LinkButton LinkButton4;
		protected System.Web.UI.WebControls.LinkButton LinkButton3;
		protected System.Web.UI.WebControls.Panel Panel3;
		protected System.Web.UI.WebControls.LinkButton LinkButton6;
		protected System.Web.UI.WebControls.LinkButton LinkButton2;
		protected System.Web.UI.WebControls.LinkButton LinkButton7;
		protected System.Web.UI.WebControls.Label Label2;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.LinkButton3.Click += new System.EventHandler(this.LinkButton3_Click);
			this.LinkButton4.Click += new System.EventHandler(this.LinkButton4_Click);
			this.LinkButton1.Click += new System.EventHandler(this.LinkButton1_Click);
			this.LinkButton2.Click += new System.EventHandler(this.LinkButton2_Click);
			this.LinkButton6.Click += new System.EventHandler(this.LinkButton6_Click);
			this.LinkButton5.Click += new System.EventHandler(this.LinkButton5_Click);
			this.LinkButton7.Click += new System.EventHandler(this.LinkButton7_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void LinkButton1_Click(object sender, System.EventArgs e)
		{
			
			string str="select * from user1 where name='"+this.TextBox1.Text+"' and password='"+this.TextBox2.Text+"'";
			SqlConnection cn=db.createcon();
			cn.Open();
			SqlCommand cm=new SqlCommand(str,cn);
			SqlDataReader sdr=cm.ExecuteReader();
			if(sdr.Read())
			{
               	
			    Session["userid88"]=this.TextBox1.Text;
				this.Panel1.Visible=false;
				//this.Panel2.Visible=true;
				this.Panel3.Visible=true;
				this.Label2.Text="欢迎用户:"+this.TextBox1.Text;
			}
			else
			{
				Response.Write("<script language=javascript>alert('用户名或密码错误')</script>");
			}
			cn.Close();
		}

		private void LinkButton3_Click(object sender, System.EventArgs e)
		{
			SqlConnection cn=db.createcon();
			cn.Open();
			SqlCommand cm=new SqlCommand("select * from user1 where name='"+Session["userid88"].ToString()+"'",cn);
			SqlDataReader sdr=cm.ExecuteReader();
			sdr.Read();
			if(sdr["quest"].ToString()!="")
			{
				Response.Write("<script language=javascript>alert('您已经申请了此项服务')</script>");
				this.Panel2.Visible=false;
				this.Panel1.Visible=false;
				this.Panel4.Visible=false;

			}
			else
			{
				this.Panel2.Visible=true;
				this.Panel1.Visible=false;
				this.Panel4.Visible=false;
			}
			cn.Close();
		}

		private void LinkButton4_Click(object sender, System.EventArgs e)
		{
			this.Panel4.Visible=true;
			this.Panel2.Visible=false;
			this.Panel1.Visible=false;
		}

		private void LinkButton2_Click(object sender, System.EventArgs e)
		{
			string up="update user1 set quest='"+this.TextBox3.Text+"',answer='"+this.TextBox4.Text+"' where name='"+Session["userid88"].ToString()+"'";
			SqlConnection cn=db.createcon();
			cn.Open();
			SqlCommand cm=new SqlCommand(up,cn);
			cm.ExecuteNonQuery();
			Response.Write("<script language=javascript>alert('设置成功')</script>");
			this.Panel1.Visible=false;
	        this.Panel2.Visible=false;
			this.Panel4.Visible=false;
			cn.Close();
		
		}

		private void LinkButton5_Click(object sender, System.EventArgs e)
		{
			string str="update user1 set password='"+this.TextBox5.Text+"' where name='"+Session["userid88"].ToString()+"'";
			SqlConnection cn=db.createcon();
			cn.Open();
			SqlCommand cm=new SqlCommand(str,cn);
			cm.ExecuteNonQuery();
			cn.Close();
			Response.Write("<script language=javascript>alert('修改成功')</script>");
			this.Panel1.Visible=false;
			this.Panel2.Visible=false;
			this.Panel4.Visible=false;


		}

		private void LinkButton6_Click(object sender, System.EventArgs e)
		{
			this.Panel1.Visible=false;
			this.Panel2.Visible=false;
			this.Panel4.Visible=false;
			this.TextBox3.Text="";
			this.TextBox4.Text="";
		
		}

		private void LinkButton7_Click(object sender, System.EventArgs e)
		{
			this.Panel1.Visible=false;
			this.Panel2.Visible=false;
			this.Panel4.Visible=false;
			this.TextBox5.Text="";
			this.TextBox6.Text="";
		
		}
	}
}

⌨️ 快捷键说明

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