📄 std_addchoosecourse.aspx.cs
字号:
}
}
for (int i = 0; i <= 199; i++)
{
if (b[checkedNumber] != 0)
{
teachingMaterial = 1;
}
}
int yuding = 0;
for (int i = 0; i <= 199; i++)
{
if (i != checkedNumber && b[i] != 0)
{
yuding++;
}
}
if (yuding != 0)
{
Response.Write("<script>alert('你选择了其他选修课科目预定教材,但你没有选择此选修课!');history.back()</script>");
}
else
{
string courseName = GridView1.Rows[checkedNumber].Cells[2].Text.ToString();
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["strcon"]);
con.Open();
string capacity1 = GridView1.Rows[checkedNumber].Cells[9].Text.ToString();
int capacity = Math.Abs(Convert.ToInt32(capacity1));
string choosed1 = GridView1.Rows[checkedNumber].Cells[10].Text.ToString();
int choosed = Math.Abs(Convert.ToInt32(choosed1));
choosed++;
string remain1 = GridView1.Rows[checkedNumber].Cells[11].Text.ToString();
int remain = Math.Abs(Convert.ToInt32(remain1));
remain--;
SqlCommand sd = new SqlCommand("select count(*) from ts_xs_stdChooseCoursesInfo where courseName = '" + courseName + "' and studyNumber ='" + this.studyNumber.Text + "'", con);
int sdSQL = Convert.ToInt32(sd.ExecuteScalar());
if (sdSQL <= 0)
{
SqlCommand sd1 = new SqlCommand("select courseCode from ts_xs_chooseCoursesInfo where courseName = '" + courseName + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
string courseCode = Convert.ToString(sd1.ExecuteScalar());
SqlCommand sd2 = new SqlCommand("select teacherCode from ts_xs_chooseCoursesInfo where courseName = '" + courseName + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
string teacherCode = Convert.ToString(sd2.ExecuteScalar());
SqlCommand sd3 = new SqlCommand("select teacherName from ts_xs_chooseCoursesInfo where courseName = '" + courseName + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
string teacherName = Convert.ToString(sd3.ExecuteScalar());
SqlCommand sd4 = new SqlCommand("select courseTime from ts_xs_chooseCoursesInfo where courseName = '" + courseName + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
string courseTime = Convert.ToString(sd4.ExecuteScalar());
SqlCommand sd5 = new SqlCommand("select coursePlace from ts_xs_chooseCoursesInfo where courseName = '" + courseName + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
string coursePlace = Convert.ToString(sd5.ExecuteScalar());
SqlCommand sd6 = new SqlCommand("select creditHour from ts_xs_chooseCoursesInfo where courseName = '" + courseName + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
int creditHour = Convert.ToInt32(sd6.ExecuteScalar());
SqlCommand sd7 = new SqlCommand("select weekPeriod from ts_xs_chooseCoursesInfo where courseName = '" + courseName + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
int weekPeriod = Convert.ToInt32(sd7.ExecuteScalar());
SqlCommand sd8 = new SqlCommand("select weekDateFrom from ts_xs_chooseCoursesInfo where courseName = '" + courseName + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
string weekDateFrom = Convert.ToString(sd8.ExecuteScalar());
SqlCommand sd9 = new SqlCommand("select remark from ts_xs_chooseCoursesInfo where courseName = '" + courseName + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
string remark = Convert.ToString(sd9.ExecuteScalar());
SqlCommand sd10 = new SqlCommand("select courseProperty from ts_xs_chooseCoursesInfo where courseName = '" + courseName + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
string courseProperty = Convert.ToString(sd10.ExecuteScalar());
SqlCommand sd11 = new SqlCommand("select schoolArea from ts_xs_chooseCoursesInfo where courseName = '" + courseName + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
string schoolArea = Convert.ToString(sd11.ExecuteScalar());
SqlCommand sd12 = new SqlCommand("select courseCollege from ts_xs_chooseCoursesInfo where courseName = '" + courseName + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
string courseCollege = Convert.ToString(sd12.ExecuteScalar());
string SQL = "insert into ts_xs_stdChooseCoursesInfo (studyNumber,studentName,IDcardNumber,college,speciality,teachedClass,adminClass,courseCode,ifChoose,ifTeachingMaterial,courseName,teacherCode,teacherName,courseTime,coursePlace,creditHour,weekPeriod,weekDateFrom,remark,courseProperty,schoolArea,courseCollege,courseStudyYear,courseSemester,chooseDate) values('" + this.studyNumber.Text + "','" + this.studentName.Text + "','" + IDcardNumber + "','" + this.college.Text + "','" + this.speciality.Text + "','" + this.teachedClass.Text + "','" + this.adminClass.Text + "','" + courseCode + "','" + 1 + "','" + teachingMaterial + "','" + courseName + "','" + teacherCode + "','" + teacherName + "','" + courseTime + "','" + coursePlace + "','" + creditHour + "','" + weekPeriod + "','" + weekDateFrom + "','" + remark + "','" + courseProperty + "','" + schoolArea + "','" + courseCollege + "','" + "2007-2008" + "','" + 1 + "','"+ System.DateTime.Now.ToString() +"')";
string SQL1 = "update ts_xs_chooseCoursesInfo set choosed= '" + choosed + "' where courseName='" + courseName + "' and courseStudyYear = '" + "2007-2008" + "' and courseSemester ='" + 1 + "'";
string SQL2 = "update ts_xs_chooseCoursesInfo set remain= '" + remain + "' where courseName='" + courseName + "' and courseStudyYear = '" + "2007-2008" + "' and courseSemester ='" + 1 + "'";
if (bc.ExecSQL(SQL) && bc.ExecSQL(SQL1) && bc.ExecSQL(SQL2))
{
con.Close();
this.bind1();
this.bind2();
this.bind3();
this.submit.Enabled = false;
this.infoExport.Enabled = true;
this.studyNumber.Text = "";
this.studyNumber.ReadOnly = false;
this.college.Text = "";
this.studentName.Text = "";
this.speciality.Text = "";
this.adminClass.Text = "";
this.teachedClass.Text = "";
Response.Write("<script>alert('你已成功选择此门修课!')</script>");
}
else
{
con.Close();
Response.Write("<script>alert('数据提交不成功!系统忙!请稍后再试!');history.back()</script>");
}
}
else
{
Response.Write("<script>alert('你已经选择过此门选修课或你已经选修此们选修课!');history.back()</script>");
}
}
}
if (checkedCount1 == 2)
{
int p = 0, q = 0;
System.Collections.ArrayList myList = new System.Collections.ArrayList();
for (int i = 0; i <= 199; i++)
{
if (a[i] != 0)
{
myList.Add(i);
}
}
int m = (int)myList[0];
int n = (int)myList[1];
for (int i = 0; i <= 199; i++)
{
if (a[m] != 0)
{
p = 1;
}
if (a[n] != 0)
{
q = 1;
}
}
int yuding = 0;
for (int i = 0; i < 199; i++)
{
if (i != m && i != n && b[i] != 0)
{
yuding++;
}
}
if (yuding != 0)
{
Response.Write("<script>alert('你选择了其他选修科目预定教材,但你没有选择次们此选修课!');history.back()</script>");
}
else
{
string courseName1 = GridView1.Rows[m].Cells[2].Text.ToString();
string courseName2 = GridView1.Rows[n].Cells[2].Text.ToString();
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["strcon"]);
con.Open();
string capacity11 = GridView1.Rows[m].Cells[9].Text.ToString();
string capacity22 = GridView1.Rows[n].Cells[9].Text.ToString();
int capacity1 = Math.Abs(Convert.ToInt32(capacity11));
int capacity2 = Math.Abs(Convert.ToInt32(capacity22));
string choosed11 = GridView1.Rows[m].Cells[10].Text.ToString();
string choosed22 = GridView1.Rows[n].Cells[10].Text.ToString();
int choosed1 = Math.Abs(Convert.ToInt32(choosed11));
int choosed2 = Math.Abs(Convert.ToInt32(choosed22));
choosed1++;
choosed2++;
string remain11 = GridView1.Rows[m].Cells[11].Text.ToString();
string remain22 = GridView1.Rows[n].Cells[11].Text.ToString();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -