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

📄 kaoshianpai.aspx.cs

📁 一个办公管理系统完整版
💻 CS
📖 第 1 页 / 共 2 页
字号:
    	{
		this.DropDownList5.Items.Add(new ListItem(Reader["教师名"].ToString(),Reader["教师名"].ToString()));
				
	    }
	    Reader.Close();

	   //DropDowlist6 选择监考老师
	   this.DropDownList6.Items.Clear();
	   this.DropDownList6.Items.Add(new ListItem("请选择监考老师","请选择监考老师2"));
	   Class.DataProcess Sqlstr=new OfficeSys.Class.DataProcess( );
	   string Str="select * from 教师信息表 where 教师号 not in (select 辅考教师 from 考试表 where 班级号!='"+this.DropDownList1.SelectedValue.Trim()+"'and 考试时间号='"+kaoshishijian+"') and 教师号 not in (select 主考教师  from 考试表 where 班级号!='"+this.DropDownList1.SelectedValue.Trim()+"'and 考试时间号='"+kaoshishijian+"')";
	    SqlDataReader Reader1=Sqlstr.ExecuteReader(Str);
	     while(Reader1.Read())
        {
	     this.DropDownList6.Items.Add(new ListItem(Reader1["教师名"].ToString(),Reader1["教师名"].ToString()));
				
        }
        Reader1.Close();
           
		}

		private void DropDownList4_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			Class.DataProcess sql=new OfficeSys.Class.DataProcess( );
			string strSql="select 容纳人数 from 教室表 where 教室号='"+this.DropDownList4.SelectedValue.Trim()+"'";
			SqlDataReader Reader1=sql.ExecuteReader(strSql);
			while (Reader1.Read())
			{
				this.jiaoshiyongna.Text=Reader1["容纳人数"].ToString();

			}
			
			Reader1.Close();
		}

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

		private void Button2_Click(object sender, System.EventArgs e)
		{
			n=this.xianding.Items.Count;
			j=this.studentname.Items.Count;
			
			for(i=0;i<this.studentname.Items.Count;i++)
			{  
				
				if(this.studentname.Items[i].Selected==true)
				{  
					n++;  	
					this.TextBox4.Text=n.ToString();

					this.xianding.Items.Add(new ListItem(this.studentname.Items[i].Text,this.studentname.Items[i].Value.Trim().ToString()));
					
					j--;
					this.kaoshi.Text=j.ToString();
				}
				
			}
			for(i=0;i<this.studentname.Items.Count;i++)
			{
				if(this.studentname.Items[i].Selected)
				{
					this.studentname.Items.Remove(this.studentname.Items[i]);
					i--;
					j--;
				}
			}

		}

		private void Button3_Click(object sender, System.EventArgs e)
		{
			j=this.studentname.Items.Count;
			n=this.xianding.Items.Count;
			for(int i=0;i<this.xianding.Items.Count;i++)
			{
				if(this.xianding.Items[i].Selected)
				{
					this.studentname.Items.Add(new ListItem(this.xianding.Items[i].Text,this.xianding.Items[i].Value.Trim().ToString()));
					n--;
					j++;
					this.kaoshi.Text=j.ToString();
					this.TextBox4.Text=n.ToString();
				}
				
			}
			for( i=0;i<this.xianding.Items.Count;i++)
			{
				if(this.xianding.Items[i].Selected)
				{
				
					this.xianding.Items.Remove(this.xianding.Items[i]);
					i--;
					n--;
				}
			}
		}

		private void Button8_Click(object sender, System.EventArgs e)
		{
			int sum;
			this.about.Text="";
			string 班级号1=this.DropDownList1.SelectedValue.Trim().ToString();
			string 课程号1=this.DropDownList2.SelectedValue.Trim().ToString();
			string 教室号1=this.DropDownList4.SelectedValue.Trim().ToString();
			string 考试号1=this.DropDownList3.SelectedValue.Trim().ToString();
			string 主考教师号1=this.DropDownList5.SelectedValue.Trim().ToString();
			string 辅考教师号1=this.DropDownList6.SelectedValue.Trim().ToString();			
			if (班级号1==""||班级号1=="请选择班级")
			{
					Response.Write("<script language='javascript'>alert('请选择班级!');</script>");
				return ;
			}
			else if (课程号1==""||课程号1=="请选择考试科目")
			{
				Response.Write("<script language='javascript'>alert('请选择考试科目!');</script>");
				return ;
			}
			else if (考试号1==""||考试号1=="请选择考试时间")
			{
				Response.Write("<script language='javascript'>alert('请选择考试时间!');</script>");
				return ;
			}
			else if (教室号1==""||教室号1=="请选择空闲教室")
			{
					Response.Write("<script language='javascript'>alert('一请选择空闲教室!');</script>");
				return ;
			}
			
			else if (主考教师号1==""||主考教师号1=="请选择监考老师1")
			{
					Response.Write("<script language='javascript'>alert('请选择主监考老师!');</script>");
				return ;
			}
			else if (辅考教师号1==""||辅考教师号1=="请选择监考老师2")
			{
					Response.Write("<script language='javascript'>alert('请选择辅监考老师!');</script>");
				return ;
			}
			
			sum=this.xianding.Items.Count;
			for(i=0;i<this.xianding.Items.Count;i++)
			{
				string 学生号=this.xianding.Items[i].Value.Trim().ToString();
				string select="select  科目号,教室号,主考教师,辅考教师,考试时间号 ,班级号 from 考试表 ";//where  课程编号='"+课程编号1+"' and 教室编号='"+教室编号1+"' and 考试编号='"+考试编号1+"' and 教师名称='"+监考老师+"'and 班级编号='"+班级编号1+"'";
				string insert="insert into 考试表 (学生号,科目号,教室号,考试时间号,主考教师,辅考教师,班级号) values ('"+学生号+"','"+课程号1+"','"+教室号1+"','"+考试号1+"','"+主考教师号1+"','"+辅考教师号1+"','"+班级号1+"')";
				SqlConnection con=new SqlConnection(strConn);
				con.Open();
				com=new SqlCommand(select,con);
				SqlDataReader reader=com.ExecuteReader();
				if(reader.Read())
				{  
					if(主考教师号1==reader["主考教师"].ToString() && 辅考教师号1==reader["辅考教师"].ToString() &&考试号1==reader["考试时间号"].ToString() && 班级号1!=reader["班级号"].ToString())
					{ 
						//this.about.Text="一个老师不能同时为两个班监考";
						Response.Write("<script language='javascript'>alert('一个老师不能同时为两个班监考!');</script>");
					}
					else if(课程号1==reader["科目号"].ToString() && 考试号1!=reader["考试时间号"].ToString() && 班级号1==reader["班级号"].ToString()) 
					{
						//this.about.Text="一个科目不能考两次";
						Response.Write("<script language='javascript'>alert('一个科目不能考两次!');</script>");
					}
					else 
					{
						reader.Close();
						com=new SqlCommand(insert,con);
						int j=com.ExecuteNonQuery();
						j++;

					}			
                     									 																		
				}
				else
				{															   
					reader.Close();
					com=new SqlCommand(insert,con);
					int j=com.ExecuteNonQuery();
					j++;
				}
				
				con.Close();
			}
  
			this.xianding.Items.Clear();
			this.TextBox4.Text="";  
			Response.Write("<script language='javascript'>alert('插入成功!');</script>");
		}
	}
}

⌨️ 快捷键说明

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