📄 grade_query.aspx.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;
using System.Configuration;
namespace sms
{
/// <summary>
/// grade_query 的摘要说明。
/// </summary>
public partial class grade_query : System.Web.UI.Page
{
string strsql;
protected System.Web.UI.WebControls.Button Btn_look;
protected void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
}
#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()
{
}
#endregion
protected void Btn_information_Click(object sender, System.EventArgs e)
{
Response.Redirect("query.aspx");
}
protected void Btn_ok_Click(object sender, System.EventArgs e)
{
if(Tbx_course.Text=="")
{
strsql="select course.Course_name,student_course.Course_id,Course_year,Student_grade,Course_credit,Course_kind from student_course,course where Course_year='"+Tbx_term.Text+"' and student_course.Course_id=course.Course_id and Student_id='"+Session["User_id"].ToString()+"'";
}
else
{
strsql="select course.Course_name,student_course.Course_id,Course_year,Student_grade,Course_credit,Course_kind from student_course,course where Course_year='"+Tbx_term.Text+"'and course.Course_id=student_course.Course_id and course.Course_name='"+Tbx_course.Text+"'and Student_id='"+Session["User_id"].ToString()+"'";
}
DataAccess DataAs = new DataAccess();
DataTable DT = DataAs.CreateDatatable(strsql);
GridView1.DataSource=DT;
GridView1.DataBind();
Lbl_note.Visible=true;
display();
}
public void display()
{
strsql = "select COALESCE(SUM(Course_credit),0) from course,student_course where Course_year='" + Tbx_term.Text + "' and student_course.Course_id=course.Course_id and Course_kind=2 and Student_grade>=60";
DataAccess DataAs = new DataAccess();
DataTable DT = DataAs.CreateDatatable(strsql);
if ((int)DT.Rows[0][0] != 0)
{
Lbl_sort.Text = "本学期选修课的总学分为:" + DT.Rows[0][0].ToString();
}
else
{
Lbl_sort.Text = "本学期选修课的总学分为:0";
}
strsql="select SUM(Course_credit) from course,student_course where Course_year='"+Tbx_term.Text+"' and student_course.Course_id=course.Course_id and Course_kind<2 and Student_grade>=60";
DT = DataAs.CreateDatatable(strsql);
if ((int)DT.Rows[0][0] != 0)
{
Lbl_must.Text = "本学期必修课的总学分为:" + DT.Rows[0][0].ToString();
}
else
{
Lbl_must.Text = "本学期选修课的总学分为:0";
}
}
protected void Btn_exit_Click(object sender, System.EventArgs e)
{
Response.Redirect("query.aspx");
}
protected void Btn_see_Click(object sender, System.EventArgs e)
{
Response.Redirect("sortcourse.aspx");
}
protected void Btn_personnel_Click(object sender, System.EventArgs e)
{
Response.Redirect("updatepwd.aspx");
}
protected void Btn_course_Click(object sender, System.EventArgs e)
{
Response.Redirect("course_student.aspx");
}
protected void Btn_grade_Click(object sender, System.EventArgs e)
{
Response.Redirect("grade_query.aspx");
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -