Beispiel #1
0
 protected void cancelCourBt_Click(object sender, EventArgs e)
 {
     foreach (ListItem li in CheckBoxList1.Items)
     {
         if (li.Selected)
         {
             foreach (EntityCour c in list)
             {
                 if (c.getCname() == li.Value.ToString())
                 {
                     string     sql  = "delete from c where cno = \"" + c.getCno() + "\"";
                     DBconnetor conn = new DBconnetor(sql);
                     conn.updata();
                 }
             }
         }
     }
     Response.Redirect("../Admin/AddCour.aspx");
 }
Beispiel #2
0
 protected void submit_Click(object sender, EventArgs e)
 {
     if (this.gradeTB.Text == "")
     {
         Response.Write("<script>alert('请填写成绩!')</script>");
         //Response.Redirect("../Admin/SetGrade.aspx");
     }
     else
     {
         string sid   = this.stuIDTB.Text;
         bool   flag  = false;
         int    grade = int.Parse(this.gradeTB.Text);
         if (grade < 0 || grade > 100)
         {
             Response.Write("<script>alert('成绩不合法!')</script>");
         }
         else
         {
             foreach (ListItem li in RadioButtonList1.Items)
             {
                 if (li.Selected)
                 {
                     flag = true;
                     foreach (EntityCour c in list)
                     {
                         if (c.getCname() == li.Value.ToString())
                         {
                             string sql = "update sc set grade = " + grade + " where sid = \"" + sid + "\" and cno = \"" + c.getCno() + "\"";
                             Response.Write(sql);
                             DBconnetor conn = new DBconnetor(sql);
                             conn.updata();
                         }
                     }
                 }
             }
             if (flag == false)
             {
                 Response.Write("<script>alert('请选择课程!')</script>");
                 //Response.Redirect("../Admin/SetGrade.aspx");
             }
         }
     }
 }
Beispiel #3
0
 protected void DeSelectButton_Click(object sender, EventArgs e)
 {
     foreach (ListItem li in CheckBoxList2.Items)
     {
         if (li.Selected)
         {
             foreach (EntityCour c in list)
             {
                 if (li.Value.ToString() == c.getCname())
                 {
                     string sql = "delete from sc where sid = \"" + Session["ID"] + "\" and cno = \"" + c.getCno() + "\"";
                     Response.Write(sql);
                     DBconnetor coon = new DBconnetor(sql);
                     coon.updata();
                 }
             }
         }
     }
     Response.Redirect("../Account/SelCourse.aspx");
 }
Beispiel #4
0
 protected void submitButton_Click(object sender, EventArgs e)
 {
     foreach (ListItem li in CheckBoxList1.Items)
     {
         if (li.Selected)
         {
             foreach (EntityCour c in leftList)
             {
                 if (li.Value.ToString() == c.getCname())
                 {
                     string sql = "insert into sc(sid, cno) values(\"" + Session["ID"] + "\", \"" + c.getCno() + "\")";
                     Response.Write(sql);
                     DBconnetor coon = new DBconnetor(sql);
                     coon.updata();
                 }
             }
         }
     }
     Response.Redirect("../Account/SelCourse.aspx");
 }
Beispiel #5
0
        protected void submitBt_Click(object sender, EventArgs e)
        {
            string            cno;
            string            sql     = "select max(cast(cno as signed)), cname, ccredit from c";
            DBconnetor        co      = new DBconnetor(sql);
            List <EntityBase> cnoList = co.getList(new EntityCour());
            EntityCour        c       = (EntityCour)cnoList.ElementAt(0);
            int maxCno = int.Parse(c.getCno());

            maxCno++;
            cno = maxCno.ToString();
            string cname   = this.CnameTB.Text;
            float  ccredit = float.Parse(this.CcreditTB.Text);
            string sqlsen  = "insert into c value (\"" + cno + "\", \"" + cname + "\", " + ccredit + ")";
            //Response.Write(sqlsen);
            DBconnetor conn = new DBconnetor(sqlsen);

            conn.updata();
            Response.Redirect("../Admin/AddCour.aspx");
        }