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

📄 st_grade_manage.aspx.cs

📁 本人上传的是学生管理系统,希望能给广大编程爱好都以帮助
💻 CS
📖 第 1 页 / 共 2 页
字号:
			
			st_dtg_grade.EditItemIndex=(int)e.Item.ItemIndex;
			ST_BindGrid();
			
		}
		public void DataGrid_update(object sender,DataGridCommandEventArgs e)
		{
			string st_sqlstr="update ST_student_course set ST_Student_grade=@Student_grade where ST_Student_id=@Student_id and ST_Course_id=@Course_id and ST_ID=@id";
			SqlCommand st_comm=new SqlCommand(st_sqlstr,st_conn);
			st_comm.Parameters.Add(new SqlParameter("@Student_grade",SqlDbType.Int,4));
			st_comm.Parameters.Add(new SqlParameter("@Course_id",SqlDbType.VarChar,50));
			st_comm.Parameters.Add(new SqlParameter("@Student_id",SqlDbType.VarChar,50));
			st_comm.Parameters.Add(new SqlParameter("@id",SqlDbType.Char,10));
			string st_colvalue=((TextBox)e.Item.Cells[7].Controls[0]).Text;
			st_comm.Parameters["@Student_grade"].Value=st_colvalue;
			st_comm.Parameters["@Student_id"].Value=e.Item.Cells[1].Text;
			st_comm.Parameters["@Course_id"].Value=e.Item.Cells[4].Text;
			st_comm.Parameters["@Student_grade"].Value=st_colvalue;
			st_comm.Parameters["@id"].Value=st_dtg_grade.DataKeys[(int)e.Item.ItemIndex];
			st_comm.Connection.Open();
			try
			{
				st_comm.ExecuteNonQuery();
				st_lbl_note.Text="编辑成功";
				st_dtg_grade.EditItemIndex=-1;
			}
			catch(SqlException)
			{
				st_lbl_note.Text="编辑失败";
				st_lbl_note.Style["color"]="red";
			}
			st_comm.Connection.Close();		
			ST_BindGrid();
			
		}
		
		public void DataGrid_delete(object sender,DataGridCommandEventArgs e)
		{
			
			string st_sqlstr="delete from ST_student_course where ST_ID=@id";
			SqlCommand st_comm=new SqlCommand(st_sqlstr,st_conn);
			st_comm.Parameters.Add(new SqlParameter("@id",SqlDbType.Char,10));			
            st_comm.Parameters["@id"].Value=st_dtg_grade.DataKeys[(int)e.Item.ItemIndex];
			st_comm.Connection.Open();
			try
			{
				st_comm.ExecuteNonQuery();
				st_lbl_note.Text="删除成功";
				
			}
			catch(SqlException)
			{
				st_lbl_note.Text="删除失败";
				st_lbl_note.Style["color"]="red";
			}
			st_comm.Connection.Close();			
			ST_BindGrid();
		}

		private void st_btn_count_Click(object sender, System.EventArgs e)
		{
			if(st_ddl_stat.SelectedItem.Value=="系别")
			{
					
			   if(st_ddl_content.SelectedItem.Text=="总人数")
			   {
				   st_sqlstr="select AVG(ST_Student_grade),MAX(ST_Student_grade),COUNT(*) from ST_student_course,ST_student,ST_class where ST_Course_id='"+st_tbx_classid.Text+"' and ST_student_course.ST_Course_year='"+st_tbx_year.Text+"'and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid=ST_class.ST_Class_id and ST_class.ST_Class_department='"+st_tbx_area.Text+"' ";
			   }
			   else if(st_ddl_content.SelectedItem.Text=="优秀人数")
			   {
				   st_sqlstr="select AVG(ST_Student_grade),MAX(ST_Student_grade),COUNT(*) from ST_student_course,ST_student,ST_class where ST_Course_id='"+st_tbx_classid.Text+"' and ST_student_course.ST_Course_year='"+st_tbx_year.Text+"'and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid=ST_class.ST_Class_id and ST_class.ST_Class_department='"+st_tbx_area.Text+"'and ST_Student_grade>=85 ";
			   }
			   else if(st_ddl_content.SelectedItem.Text=="不及格人数")
			   {
				   st_sqlstr="select AVG(ST_Student_grade),MAX(ST_Student_grade),COUNT(*) from ST_student_course,ST_student,ST_class where ST_Course_id='"+st_tbx_classid.Text+"' and ST_student_course.ST_Course_year='"+st_tbx_year.Text+"'and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid=ST_class.ST_Class_id and ST_class.ST_Class_department='"+st_tbx_area.Text+"'and ST_Student_grade<60 ";
			   }
				else
			   {
				 st_sqlstr="select AVG(ST_Student_grade),MAX(ST_Student_grade) from ST_student_course,ST_student,ST_class where ST_Course_id='"+st_tbx_classid.Text+"' and ST_student_course.ST_Course_year='"+st_tbx_year.Text+"'and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid=class.ST_Class_id and ST_class.ST_Class_department='"+st_tbx_area.Text+"' ";
			   }
			}
			else if(st_ddl_stat.SelectedItem.Value=="学院")
			{
				if(st_ddl_content.SelectedItem.Text=="总人数")
				{
					st_sqlstr="select AVG(ST_Student_grade),MAX(ST_Student_grade),COUNT(*) from ST_student_course,ST_student,ST_class where ST_Course_id='"+st_tbx_classid.Text+"' and ST_student_course.ST_Course_year='"+st_tbx_year.Text+"'and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid=ST_class.ST_Class_id and ST_class.ST_Class_college='"+st_tbx_area.Text+"' ";
				}
				else if(st_ddl_content.SelectedItem.Text=="优秀人数")
				{
					st_sqlstr="select AVG(ST_Student_grade),MAX(ST_Student_grade),COUNT(*) from ST_student_course,ST_student,ST_class where ST_Course_id='"+st_tbx_classid.Text+"' and ST_student_course.ST_Course_year='"+st_tbx_year.Text+"'and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid=ST_class.ST_Class_id and ST_class.ST_Class_college='"+st_tbx_area.Text+"'and ST_Student_grade>=85 ";
				}
				else if(st_ddl_content.SelectedItem.Text=="不及格人数")
				{
					st_sqlstr="select AVG(ST_Student_grade),MAX(ST_Student_grade),COUNT(*) from ST_student_course,ST_student,ST_class where ST_Course_id='"+st_tbx_classid.Text+"' and ST_student_course.ST_Course_year='"+st_tbx_year.Text+"'and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid=ST_class.ST_Class_id and ST_class.ST_Class_college='"+st_tbx_area.Text+"'and ST_Student_grade<60 ";
				}
				else
				{
						st_sqlstr="select AVG(ST_Student_grade),MAX(ST_Student_grade) from ST_student_course,ST_student,ST_class where ST_Course_id='"+st_tbx_classid.Text+"' and ST_student_course.ST_Course_year='"+st_tbx_year.Text+"'and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid=ST_class.ST_Class_id and ST_class.ST_Class_college='"+st_tbx_area.Text+"' ";
				}
				
				
			}
			else if(st_ddl_stat.SelectedItem.Value=="班级")
			{
				if(st_ddl_content.SelectedItem.Text=="总人数")
				{
					st_sqlstr="select AVG(ST_Student_grade),MAX(ST_Student_grade),COUNT(*) from ST_student_course,ST_student where ST_Course_id='"+st_tbx_classid.Text+"' and ST_student_course.ST_Course_year='"+st_tbx_year.Text+"' and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid='"+st_tbx_area.Text+"'";
				}
				else if(st_ddl_content.SelectedItem.Text=="优秀人数")
				{
					st_sqlstr="select AVG(ST_Student_grade),MAX(ST_Student_grade),COUNT(*) from ST_student_course,ST_student where ST_Course_id='"+st_tbx_classid.Text+"' and ST_student_course.ST_Course_year='"+st_tbx_year.Text+"' and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid='"+st_tbx_area.Text+"'and ST_Student_grade>=85";
				}
				else if(st_ddl_content.SelectedItem.Text=="不及格人数")
				{
					st_sqlstr="select AVG(ST_Student_grade),MAX(ST_Student_grade),COUNT(*) from ST_student_course,ST_student where ST_Course_id='"+st_tbx_classid.Text+"' and ST_student_course.ST_Course_year='"+st_tbx_year.Text+"' and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid='"+st_tbx_area.Text+"'and ST_Student_grade<60";
				}
				else
				{
					st_sqlstr="select AVG(ST_Student_grade),MAX(ST_Student_grade) from ST_student_course,ST_student where ST_Course_id='"+st_tbx_classid.Text+"' and ST_student_course.ST_Course_year='"+st_tbx_year.Text+"' and ST_student_course.ST_Student_id=ST_student.ST_Student_id and ST_student.ST_Student_classid='"+st_tbx_area.Text+"'";
				}
					
				
			}
			SqlCommand st_comm=new SqlCommand(st_sqlstr,st_conn);
			st_conn.Open();
			SqlDataReader dr=st_comm.ExecuteReader();
			if(dr.Read())
			{
				if(st_ddl_content.SelectedItem.Text=="平均分")
				{
					st_lbl_average.Visible=true;
					st_lbl_average.Text="平均分为:"+dr[0].ToString();
				}
				else if(st_ddl_content.SelectedItem.Text=="最高分")
				{
					st_lbl_high.Visible=true;
					st_lbl_high.Text="最高分为:"+dr[1].ToString();
				}
				else if(st_ddl_content.SelectedItem.Text=="总人数")
				{
					st_lbl_all.Visible=true;
					st_lbl_all.Text="总人数为:"+dr[2].ToString();
				}
				else if(st_ddl_content.SelectedItem.Text=="优秀人数")
				{
					st_lbl_a.Visible=true;
					st_lbl_a.Text="优秀人数为:"+dr[2].ToString();
				}
				else if(st_ddl_content.SelectedItem.Text=="不及格人数")
				{
						st_lbl_unpass.Visible=true;
					st_lbl_unpass.Text="不及格人数为:"+dr[2].ToString();
				}
				else
				{st_lbl_note.Text="无此信息";
				}
				st_conn.Close();
			}
			 
		}

		private void st_btn_exit_Click(object sender, System.EventArgs e)
		{
			Response.Redirect("default.aspx");
		}

		private void st_lbtn_addgrade_Click(object sender, System.EventArgs e)
		{
			Response.Redirect("ST_addgrade.aspx");
		}

		
	}
}

⌨️ 快捷键说明

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