📄 std_addchoosecourse.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Text;
using System.IO;
using System.Drawing;
/// <summary>
/// 哈尔滨师范大学教务系统开发
/// 作者:易继勇
/// 邮箱:yijiyong100@163.com
/// qq:610068468
/// 哈尔滨师范大学教务平台图片展示地址:http://photo.sina.com.cn/yijiyong100
/// 如果您有什么问题,将您的问题发送至邮箱yijiyong100@163.com,欢迎大家和我交流讨论,多多希望您提出您宝贵的意见!
/// </summary>
public partial class manager_sysManager_studentManage_std_addChooseCourse : System.Web.UI.Page
{
BaseClass bc = new BaseClass();
protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToString(Session["manName"]) == "")
{
Response.Write("<script language=javascript>location='../../../TS_ManagerLogin.aspx'</script>");
return;
}
if (!IsPostBack)
{
this.RequiredFieldValidator2.Enabled = true;
this.submit.Enabled = false;
this.bind1();
}
}
protected void infoExport_Click(object sender, EventArgs e)
{
string studyNumber = this.studyNumber.Text;
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["strcon"]);
con.Open();
SqlCommand scd = new SqlCommand("select count(*) from ts_xs_basicInfo where studyNumber ='"+ studyNumber +"'", con);
int count = Convert.ToInt32(scd.ExecuteScalar());
if (count > 0)
{
DataSet ds = new DataSet();
SqlDataAdapter sda1 = new SqlDataAdapter("select * from ts_xs_basicInfo where studyNumber ='" + studyNumber + "'", con);
sda1.Fill(ds, "ts_xs_basicInfo");
DataRowView rowview = ds.Tables["ts_xs_basicInfo"].DefaultView[0];
this.college.Text = rowview["college"].ToString();
this.speciality.Text = rowview["speciality"].ToString();
this.studentName.Text = rowview["studentName"].ToString();
this.adminClass.Text = rowview["adminClass"].ToString();
this.teachedClass.Text = rowview["teachedClass"].ToString();
this.submit.Enabled = true;
this.infoExport.Enabled = false;
this.studyNumber.ReadOnly = true;
this.bind1();
this.bind2();
this.bind3();
}
else
{
Response.Write(bc.MessageBox("请校验您输入的学生证号!在数据库中未找到相关的信息!"));
}
}
protected void GridView2_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
}
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void submit_Click(object sender, EventArgs e)
{
SqlConnection con1 = new SqlConnection(ConfigurationManager.AppSettings["strcon"]);
con1.Open();
DataSet ds = new DataSet();
SqlDataAdapter sda1 = new SqlDataAdapter("select * from ts_xs_basicInfo where studyNumber ='" + this.studyNumber.Text + "'", con1);
sda1.Fill(ds, "ts_xs_basicInfo");
DataRowView rowview = ds.Tables["ts_xs_basicInfo"].DefaultView[0];
string IDcardNumber = rowview["IDcardNumber"].ToString();
con1.Close();
int checkedCount1 = 0;
int chechedCount2 = 0;
int uncheckedCount1 = 0;
int uncheckedCount2 = 0;
int[] a = new int[200];
int[] b = new int[200];
for (int i = 0; i <= 199; i++)
{
a[i] = b[i] = 0;
}
int rowsNumber = GridView1.Rows.Count;
for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
{
CheckBox cbox1 = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1");
CheckBox cbox2 = (CheckBox)GridView1.Rows[i].FindControl("CheckBox2");
if (cbox1.Checked == true)
{
checkedCount1++;
a[i] = i + 1;
}
else
{
uncheckedCount1++;
}
if (cbox2.Checked == true)
{
chechedCount2++;
b[i] = i + 1;
}
else
{
uncheckedCount2++;
}
}
if (checkedCount1 > 2)
{
Response.Write("<script>alert('每次最多只能选择两门选修课!');history.back()</script>");
}
if (uncheckedCount1 == rowsNumber)
{
Response.Write("<script>alert('你还没有选择你所要选择的选修课!');history.back()</script>");
}
else
{
SqlConnection constr = new SqlConnection(ConfigurationManager.AppSettings["strcon"]);
constr.Open();
SqlCommand cmd = new SqlCommand("select count(*) from ts_xs_stdChooseCoursesInfo where studyNumber ='" + this.studyNumber.Text + "' and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", constr);
int dbcount = Convert.ToInt32(cmd.ExecuteScalar());
constr.Close();
int totalcount = dbcount + checkedCount1;
if (totalcount <= 2)
{
if (checkedCount1 == 1)
{
int checkedNumber = 0;
int teachingMaterial = 0;
for (int i = 0; i <= 199; i++)
{
if (a[i] != 0)
{
checkedNumber = i;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -