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

📄 dianming1.aspx.cs

📁 学生考勤管理系统学生考勤管理系统学生考勤管理系统学生考勤管理系统学生考勤管理系统
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace kqxt
{
	/// <summary>
	/// dianming 的摘要说明。
	/// </summary>
	public class dianming1 : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Button Button2;
		protected System.Web.UI.WebControls.DropDownList DropDownList1;
		protected System.Web.UI.WebControls.Label Label3;
		/*string conn=System.Configuration.ConfigurationSettings.AppSettings["connstr"];
		SqlConnection objconn=new SqlConnection(conn);*/
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			object obj = Session["usersID"];
			string userid=obj.ToString();
			DataSet myds=new DataSet();
		
			if(!this.IsPostBack)
			{
				string conn=System.Configuration.ConfigurationSettings.AppSettings["connstr"];
				SqlConnection objconn=new SqlConnection(conn);
				
				string sqlstr="select classID from classCourse,teacher where teacher.thID=classCourse.thID and teacher.thID='"+userid+"'";
				//SqlCommand mycom=new SqlCommand(sqlstr,objconn);
				//objconn.Open();
				SqlDataAdapter mydata=new SqlDataAdapter(sqlstr,objconn);
				mydata.Fill(myds,"class");
				DropDownList1.DataSource=myds.Tables["class"].DefaultView;
				DropDownList1.DataTextField=myds.Tables["class"].Columns[0].ColumnName;
				DropDownList1.DataValueField=myds.Tables["class"].Columns[0].ColumnName;
				DropDownList1.DataBind();
			}
		
			/*this.Label1.Visible=false;
			this.TextBox1.Visible=false;
			this.message.Visible=false;
			this.Label2.Visible=false;
			this.Button1.Visible=false;*/
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			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)
		{
			object obj = Session["usersID"];
			string thID=obj.ToString();
			
			string conn=System.Configuration.ConfigurationSettings.AppSettings["connstr"];
			SqlConnection objconn=new SqlConnection(conn);
			int a,l,q,z;
			string dates=this.TextBox1.Text;
			CheckBox c1,c2,c3,c4;
			foreach(DataGridItem dgi in DataGrid1.Items)
			{
				string stuID=this.DataGrid1.DataKeys[dgi.ItemIndex].ToString();
				c1=(CheckBox)dgi.FindControl("ck1");
				c2=(CheckBox)dgi.FindControl("ck2");
				c3=(CheckBox)dgi.FindControl("ck3");
				c4=(CheckBox)dgi.FindControl("ck4");
				if(c1.Checked==true)
				{
					a=1;l=0;q=0;z=0;
					int Absent=a;
					int Late=l;
					int Qinjia=q;
					int ZhengC=z;
					string sql ="insert into kaoqin values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')";
					sql = string.Format(sql,stuID,thID,Absent,Late,Qinjia,ZhengC,dates);
				
					SqlCommand mycom=new SqlCommand(sql,objconn);
					objconn.Open();
					int n = mycom.ExecuteNonQuery();			
					objconn.Close();

				}
				
				else if(c2.Checked==true)
				{
					a=0;l=1;q=0;z=0;
					int Absent=a;
					int Late=l;
					int Qinjia=q;
					int ZhengC=z;
					string sql ="insert into kaoqin values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')";
					sql = string.Format(sql,stuID,thID,Absent,Late,Qinjia,ZhengC,dates);
				
					SqlCommand mycom=new SqlCommand(sql,objconn);
					objconn.Open();
					int n = mycom.ExecuteNonQuery();			
					objconn.Close();
				}
				
				else if(c3.Checked==true)
				{
					a=0;l=0;q=1;z=0;
					int Absent=a;
					int Late=l;
					int Qinjia=q;
					int ZhengC=z;
					string sql ="insert into kaoqin values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')";
					sql = string.Format(sql,stuID,thID,Absent,Late,Qinjia,ZhengC,dates);
				
					SqlCommand mycom=new SqlCommand(sql,objconn);
					objconn.Open();
					int n = mycom.ExecuteNonQuery();			
					objconn.Close();
				}
				
				else if(c4.Checked==true)
				{
					a=0;l=0;q=0;z=1;
					int Absent=a;
					int Late=l;
					int Qinjia=q;
					int ZhengC=z;
					string sql ="insert into kaoqin values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')";
					sql = string.Format(sql,stuID,thID,Absent,Late,Qinjia,ZhengC,dates);
				
					SqlCommand mycom=new SqlCommand(sql,objconn);
					objconn.Open();
					int n = mycom.ExecuteNonQuery();			
					objconn.Close();
					//if(n==1)
					//this.message.Text="点名完毕!";
				}
				
			}
			this.message.Text="点名完毕!";
		}*/


		private void Button2_Click(object sender, System.EventArgs e)
		{
			string n=this.DropDownList1.SelectedItem.ToString();
			/*if(!this.IsPostBack)
			{
				DataSet myds=new DataSet();
				string conn=System.Configuration.ConfigurationSettings.AppSettings["connstr"];
				SqlConnection objconn=new SqlConnection(conn);
				string sqlstr="select stuID,stuName from student  where classID=student.classID='"+n+"'";
				SqlCommand mycom=new SqlCommand(sqlstr,objconn);
				objconn.Open();
				SqlDataAdapter mydata=new SqlDataAdapter(sqlstr,objconn);
				mydata.Fill(myds,"student");
				this.DataGrid1.DataSource=myds.Tables["student"].DefaultView;
				this.DataGrid1.DataBind();
				this.Label1.Visible=true;
				this.TextBox1.Visible=true;
				this.message.Visible=true;
				this.Label2.Visible=true;
				this.Button1.Visible=true;
			}*/

			Response.Redirect("dianming.aspx?classID="+n);
		}
		
	}
}

⌨️ 快捷键说明

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