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

📄 std_addchoosecourse.aspx.cs

📁 该系统是一个集成多功能的信息管理系统
💻 CS
📖 第 1 页 / 共 3 页
字号:
                        int remain1 = Math.Abs(Convert.ToInt32(remain11));
                        int remain2 = Math.Abs(Convert.ToInt32(remain22));
                        remain1--;
                        remain2--;
                        SqlCommand scd1 = new SqlCommand("select count(*) from ts_xs_stdChooseCoursesInfo where courseName = '" + courseName1 + "'", con);
                        int sdSQL1 = Convert.ToInt32(scd1.ExecuteScalar());
                        SqlCommand scd2 = new SqlCommand("select count(*) from ts_xs_stdChooseCoursesInfo where courseName = '" + courseName2 + "'", con);
                        int sdSQL2 = Convert.ToInt32(scd2.ExecuteScalar());
                        if (sdSQL1 <= 0 && sdSQL2 <= 0)
                        {
                            SqlCommand sdm1 = new SqlCommand("select courseCode from ts_xs_chooseCoursesInfo where courseName = '" + courseName1 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);

                            string courseCodem = Convert.ToString(sdm1.ExecuteScalar());
                            SqlCommand sdn1 = new SqlCommand("select courseCode from ts_xs_chooseCoursesInfo where courseName = '" + courseName2 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
                            string courseCoden = Convert.ToString(sdn1.ExecuteScalar());
                            SqlCommand sdm2 = new SqlCommand("select teacherCode from ts_xs_chooseCoursesInfo where courseName = '" + courseName1 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);

                            string teacherCodem = Convert.ToString(sdm2.ExecuteScalar());
                            SqlCommand sdn2 = new SqlCommand("select teacherCode from ts_xs_chooseCoursesInfo where courseName = '" + courseName2 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
                            string teacherCoden = Convert.ToString(sdn2.ExecuteScalar());
                            SqlCommand sdm3 = new SqlCommand("select teacherName from ts_xs_chooseCoursesInfo where courseName = '" + courseName1 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);

                            string teacherNamem = Convert.ToString(sdm3.ExecuteScalar());
                            SqlCommand sdn3 = new SqlCommand("select teacherName from ts_xs_chooseCoursesInfo where courseName = '" + courseName2 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
                            string teacherNamen = Convert.ToString(sdn3.ExecuteScalar());
                            SqlCommand sdm4 = new SqlCommand("select courseTime from ts_xs_chooseCoursesInfo where courseName = '" + courseName1 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);

                            string courseTimem = Convert.ToString(sdm4.ExecuteScalar());
                            SqlCommand sdn4 = new SqlCommand("select courseTime from ts_xs_chooseCoursesInfo where courseName = '" + courseName2 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
                            string courseTimen = Convert.ToString(sdn4.ExecuteScalar());
                            SqlCommand sdm5 = new SqlCommand("select coursePlace from ts_xs_chooseCoursesInfo where courseName = '" + courseName1 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);

                            string coursePlacem = Convert.ToString(sdm5.ExecuteScalar());
                            SqlCommand sdn5 = new SqlCommand("select coursePlace from ts_xs_chooseCoursesInfo where courseName = '" + courseName2 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
                            string coursePlacen = Convert.ToString(sdn5.ExecuteScalar());
                            SqlCommand sdm6 = new SqlCommand("select creditHour from ts_xs_chooseCoursesInfo where courseName = '" + courseName1 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);

                            int creditHourm = Convert.ToInt32(sdm6.ExecuteScalar());
                            SqlCommand sdn6 = new SqlCommand("select creditHour from ts_xs_chooseCoursesInfo where courseName = '" + courseName2 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
                            int creditHourn = Convert.ToInt32(sdn6.ExecuteScalar());
                            SqlCommand sdm7 = new SqlCommand("select weekPeriod from ts_xs_chooseCoursesInfo where courseName = '" + courseName1 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);

                            int weekPeriodm = Convert.ToInt32(sdm7.ExecuteScalar());
                            SqlCommand sdn7 = new SqlCommand("select weekPeriod from ts_xs_chooseCoursesInfo where courseName = '" + courseName2 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
                            int weekPeriodn = Convert.ToInt32(sdn7.ExecuteScalar());
                            SqlCommand sdm8 = new SqlCommand("select weekDateFrom from ts_xs_chooseCoursesInfo where courseName = '" + courseName1 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);

                            string weekDateFromm = Convert.ToString(sdm8.ExecuteScalar());
                            SqlCommand sdn8 = new SqlCommand("select weekDateFrom from ts_xs_chooseCoursesInfo where courseName = '" + courseName2 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
                            string weekDateFromn = Convert.ToString(sdn8.ExecuteScalar());
                            SqlCommand sdm9 = new SqlCommand("select remark from ts_xs_chooseCoursesInfo where courseName = '" + courseName1 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);

                            string remarkm = Convert.ToString(sdm9.ExecuteScalar());
                            SqlCommand sdn9 = new SqlCommand("select remark from ts_xs_chooseCoursesInfo where courseName = '" + courseName2 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
                            string remarkn = Convert.ToString(sdn9.ExecuteScalar());
                            SqlCommand sdm10 = new SqlCommand("select courseProperty from ts_xs_chooseCoursesInfo where courseName = '" + courseName1 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);

                            string coursePropertym = Convert.ToString(sdm10.ExecuteScalar());
                            SqlCommand sdn10 = new SqlCommand("select courseProperty from ts_xs_chooseCoursesInfo where courseName = '" + courseName2 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
                            string coursePropertyn = Convert.ToString(sdn10.ExecuteScalar());
                            SqlCommand sdm11 = new SqlCommand("select schoolArea from ts_xs_chooseCoursesInfo where courseName = '" + courseName1 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);

                            string schoolAream = Convert.ToString(sdm11.ExecuteScalar());
                            SqlCommand sdn11 = new SqlCommand("select schoolArea from ts_xs_chooseCoursesInfo where courseName = '" + courseName2 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
                            string schoolArean = Convert.ToString(sdn11.ExecuteScalar());
                            SqlCommand sdm12 = new SqlCommand("select courseCollege from ts_xs_chooseCoursesInfo where courseName = '" + courseName1 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);

                            string courseCollegem = Convert.ToString(sdm12.ExecuteScalar());
                            SqlCommand sdn12 = new SqlCommand("select courseCollege from ts_xs_chooseCoursesInfo where courseName = '" + courseName2 + "'and courseStudyYear = '" + "2007-2008" + "'and courseSemester = '" + 1 + "'", con);
                            string courseCollegen = Convert.ToString(sdn12.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 + "','" + courseCodem + "','" + 1 + "','" + p + "','" + courseName1 + "','" + teacherCodem + "','" + teacherNamem + "','" + courseTimem + "','" + coursePlacem + "','" + creditHourm + "','" + weekPeriodm + "','" + weekDateFromm + "','" + remarkm + "','" + coursePropertym + "','" + schoolAream + "','" + courseCollegem + "','" + "2007-2008" + "','" + 1 + "','"+ System.DateTime.Now.ToString() +"')";
                            string SQL1 = "update ts_xs_chooseCoursesInfo set choosed=  '" + choosed1 + "' where courseName='" + courseName1 + "' and courseStudyYear = '" + "2007-2008" + "' and courseSemester ='" + 1 + "'";
                            string SQL2 = "update ts_xs_chooseCoursesInfo set remain=  '" + remain1 + "' where courseName='" + courseName1 + "' and courseStudyYear = '" + "2007-2008" + "' and courseSemester ='" + 1 + "'";
                            string SQL3 = "insert into ts_xs_stdChooseCoursesInfo (studyNumber,studnetName,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 + "','" + courseCoden + "','" + 1 + "','" + q + "','" + courseName2 + "','" + teacherCoden + "','" + teacherNamen + "','" + courseTimen + "','" + coursePlacen + "','" + creditHourn + "','" + weekPeriodn + "','" + weekDateFromn + "','" + remarkn + "','" + coursePropertyn + "','" + schoolArean + "','" + courseCollegen + "','" + "2007-2008" + "','" + 1 + "','" + System.DateTime.Now.ToString() + "')";
                            string SQL4 = "update ts_xs_chooseCoursesInfo set choosed=  '" + choosed2 + "' where courseName='" + courseName2 + "' and courseStudyYear = '" + "2007-2008" + "' and courseSemester ='" + 1 + "'";
                            string SQL5 = "update ts_xs_chooseCoursesInfo set remain=  '" + remain2 + "' where courseName='" + courseName2 + "' and courseStudyYear = '" + "2007-2008" + "' and courseSemester ='" + 1 + "'";
                            if (bc.ExecSQL(SQL) && bc.ExecSQL(SQL1) && bc.ExecSQL(SQL2) && bc.ExecSQL(SQL3) && bc.ExecSQL(SQL4) && bc.ExecSQL(SQL5))
                            {
                                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>");
            }
        }
    }

    private void bind1()
    {
        SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter("select * from ts_xs_chooseCoursesInfo where courseStudyYear = '" + "2007-2008" + "'and courseSemester ='" + 1 + "' order by id", con);
        DataSet ds = new DataSet();
        sda.Fill(ds, "ts_xs_chooseCoursesInfo");
        GridView1.DataSource = ds.Tables["ts_xs_chooseCoursesInfo"];
        GridView1.DataKeyNames = new string[] { "id" };
        GridView1.DataBind();
        con.Close();
    }

    private void bind2()
    {
        SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter("select * from ts_xs_stdChooseCoursesInfo where courseStudyYear ='" + "2007-2008" + "'and courseSemester = '" + 1 + "'and studyNumber = '" + this.studyNumber.Text + "' order by id", con);
        DataSet ds = new DataSet();
        sda.Fill(ds, "ts_xs_stdChooseCoursesInfo");
        GridView2.DataSource = ds.Tables["ts_xs_stdChooseCoursesInfo"];
        GridView2.DataKeyNames = new string[] { "id" };

        GridView2.DataBind();
        con.Close();
    }

    private void bind3()
    {
        SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter("select * from ts_xs_stdChooseCoursesInfo where courseStudyYear ='" + "2007-2008" + "'and courseSemester = '" + 1 + "'and studyNumber = '" + this.studyNumber.Text + "' order by id", con);
        DataSet ds = new DataSet();
        sda.Fill(ds, "ts_xs_stdChooseCoursesInfo");
        GridView3.DataSource = ds.Tables["ts_xs_stdChooseCoursesInfo"];
        GridView3.DataKeyNames = new string[] { "id" };
        GridView3.DataBind();
        con.Close();
    }
}

⌨️ 快捷键说明

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