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

📄 manageclass.aspx.cs

📁 视频点播系统使用方法如下: 1. 将"视频点播系统"目录下的所有文件和目录复制到IIS服务器根目录下某新建的虚目录
💻 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.Text;

namespace Vod
{
	/// <summary>
	/// UserManager 的摘要说明。
	/// </summary>
	public class ManageClass : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label Label1;
		protected System.Web.UI.WebControls.Label Label2;
		protected System.Web.UI.WebControls.DropDownList DropDownList1;
		protected System.Web.UI.WebControls.DropDownList DropDownList2;
		
        protected System.Web.UI.WebControls.Button  ClassDelete1;
        protected System.Web.UI.WebControls.Button  ClassDelete2;

		protected System.Web.UI.WebControls.TextBox NewName1;
		protected System.Web.UI.WebControls.TextBox NewName2;
        protected System.Web.UI.WebControls.Button  ClassUpdate1;
        protected System.Web.UI.WebControls.Button  ClassUpdate2;		
		
		protected System.Web.UI.WebControls.TextBox AddName1;
		protected System.Web.UI.WebControls.TextBox AddName2;
        protected System.Web.UI.WebControls.Button  ClassAdd1;
        protected System.Web.UI.WebControls.Button  ClassAdd2;	
        
		private void Page_Load(object sender, System.EventArgs e)
		{
			if(!IsPostBack)
			{
				Label1.Text = Session["UserName"].ToString();	
			    try
				{
					if((Session["UserName"].ToString()!="") && My.Vod.User.IsSupervisor(Session["UserName"].ToString()))
					{
						Bind(0);															
					}
				}
				catch
				{
					Response.Redirect("Error.aspx");
				}
			}
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
            this.DropDownList1.SelectedIndexChanged += new System.EventHandler(this.selectClass);
            
            this.ClassDelete1.Click += new System.EventHandler(this.ClassDelete1_Click);
            this.ClassDelete2.Click += new System.EventHandler(this.ClassDelete2_Click);
            
            this.ClassUpdate1.Click += new System.EventHandler(this.ClassUpdate1_Click);
            this.ClassUpdate2.Click += new System.EventHandler(this.ClassUpdate2_Click);
            
            this.ClassAdd1.Click += new System.EventHandler(this.ClassAdd1_Click);
            this.ClassAdd2.Click += new System.EventHandler(this.ClassAdd2_Click);
            
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		/*private void bt_Click(object sender, System.EventArgs e)
		{	

			DataSet ds = My.Vod.User.SearchUser(tb_Search.Text.Trim());
			this.DataGrid1.DataSource = ds.Tables[0].DefaultView;
			this.DataGrid1.DataBind();
		}*/
		
		private void ClassDelete1_Click(object sender, System.EventArgs e)
		{
			My.VideoClass1.Delete(Int32.Parse(DropDownList1.SelectedItem.Value));
			Bind(0);	
		}
		
		private void ClassDelete2_Click(object sender, System.EventArgs e)
		{
			My.VideoClass2.Delete(DropDownList2.SelectedItem.Text.Trim(),Int32.Parse(DropDownList1.SelectedItem.Value));
			Bind(0);
    	}

		private void ClassUpdate1_Click(object sender, System.EventArgs e)
		{
			My.VideoClass1.Update(Int32.Parse(DropDownList1.SelectedItem.Value), DropDownList1.SelectedItem.Text.Trim(), NewName1.Text.Trim());
			NewName1.Text = "";
			Bind(0);			
		}			
		
		private void ClassUpdate2_Click(object sender, System.EventArgs e)
		{
			My.VideoClass2.Update(DropDownList2.SelectedItem.Text.Trim(), NewName2.Text.Trim(), Int32.Parse(DropDownList1.SelectedItem.Value));
			NewName2.Text = "";
			Bind(0);			
		}		
		
		private void ClassAdd1_Click(object sender, System.EventArgs e)
		{
			My.VideoClass1.Add(AddName1.Text.Trim());
			AddName1.Text = "";
			Bind(0);			
	    }
	
		private void ClassAdd2_Click(object sender, System.EventArgs e)
		{
			My.VideoClass2.Add(AddName2.Text.Trim(),Int32.Parse(DropDownList1.SelectedItem.Value));
			AddName2.Text = "";
			Bind(0);			
		}
			
		private void Bind(int i)
		{
			DataSet ds = My.VideoClass1.GetVideoClass1();
						
			Label1.Text = "共有:" + ds.Tables[0].Rows.Count.ToString();
						
			this.DropDownList1.DataSource = ds.Tables[0].DefaultView;
			this.DropDownList1.DataBind();
            
            this.DropDownList1.SelectedIndex = 0;

	    	DataSet dsVideoClass21 = My.VideoClass2.GetVideoClass2(Int32.Parse(DropDownList1.SelectedItem.Value));
	    	
	    	Label2.Text = "共有: " + dsVideoClass21.Tables[0].Rows.Count.ToString();
	    				
			this.DropDownList2.DataSource = dsVideoClass21.Tables[0].DefaultView;
			this.DropDownList2.DataBind();
	    }
	    
	    private void selectClass(object sender, System.EventArgs e)
	    {
	    	DataSet dsVideoClass21 = My.VideoClass2.GetVideoClass2(Int32.Parse(DropDownList1.SelectedItem.Value));
	    	
	    	Label2.Text = "共有:" + dsVideoClass21.Tables[0].Rows.Count.ToString();
	    				
			this.DropDownList2.DataSource = dsVideoClass21.Tables[0].DefaultView;
			this.DropDownList2.DataBind();
			
	    }
	    
	}
}

⌨️ 快捷键说明

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