protected void btnDel_Click(object sender, EventArgs e)
    {
        ArrayList selected = GetSelectedGV();

        if (selected.Count == 0)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请选择课程任务!');</script>");
            return;
        }
        else
        {
            foreach (GridViewRow row in GV.Rows)
            {
                if (((CheckBox)row.FindControl("chkSelected")).Checked)
                {
                    KCRW.Delete(row.Cells[1].Text, row.Cells[3].Text, row.Cells[6].Text, row.Cells[7].Text, row.Cells[8].Text);
                }
            }
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('删除成功');</script>");
            Query();
        }
    }
    protected void btnSave_ServerClick(object sender, EventArgs e)
    {
        if (btnAdd.Disabled == true)
        {
            Hashtable hash = new Hashtable();
            if (KCRW.HasKCRW(txtJsbh.Value, txtKcbh.Value, txtJxbbh.Value, txtKbxn.Value, selKbxq.Value))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加失败,课程任务已存在!');</script>");
                return;
            }
            //if (GetSelectedJS().Count != 1)
            //{
            //    Response.Write("<Script Language=JavaScript>alert('请选择一个教师!');</Script>");
            //    return;
            //}
            //foreach (GridViewRow row in GVJS.Rows)
            //{
            //    if (((CheckBox)row.FindControl("chkSelected")).Checked)
            //    {
            //        hash.Add("jsbh", SqlStringConstructor.GetQuotedString(Convert.ToString(row.Cells[1].Text)));
            //    }
            //}

            //if (GetSelectedKC().Count != 1)
            //{
            //    Response.Write("<Script Language=JavaScript>alert('请选择一个课程!');</Script>");
            //    return;
            //}
            //foreach (GridViewRow row in GVKC.Rows)
            //{
            //    if (((CheckBox)row.FindControl("chkSelected")).Checked)
            //    {
            //        hash.Add("kcbh", SqlStringConstructor.GetQuotedString(Convert.ToString(row.Cells[1].Text)));
            //    }
            //}
            hash.Add("jsbh", SqlStringConstructor.GetQuotedString(txtJsbh.Value));
            hash.Add("kcbh", SqlStringConstructor.GetQuotedString(txtKcbh.Value));
            hash.Add("llxs", Convert.ToInt32(txtLlxs.Value));
            hash.Add("syxs", Convert.ToInt32(txtSyxs.Value));
            hash.Add("sydxs", Convert.ToDouble(txtSydxs.Value));
            hash.Add("kbxn", SqlStringConstructor.GetQuotedString(txtKbxn.Value));
            hash.Add("kbxq", SqlStringConstructor.GetQuotedString(selKbxq.Value));
            hash.Add("jxbbh", SqlStringConstructor.GetQuotedString(txtJxbbh.Value));

            Gzl.BusinessLogicLayer.KCRW.Add(hash);

            txtJsbh.Value      = "";
            txtKcbh.Value      = "";
            txtZdjs.Value      = "";
            txtKcmc.Value      = "";
            txtJxbbh.Value     = "";
            txtJxbrs.Value     = "";
            txtLlxs.Value      = "";
            txtSydxs.Value     = "";
            txtSyxs.Value      = "";
            txtLlxs.Disabled   = true;
            txtSyxs.Disabled   = true;
            txtSydxs.Disabled  = true;
            selKbxq.Disabled   = true;
            btnJssz.Disabled   = true;
            btnKcsz.Disabled   = true;
            btnJxbsz.Enabled   = false;
            btnAdd.Disabled    = false;
            btnSave.Disabled   = true;
            btnCancel.Disabled = true;
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加成功');</script>");
            Query();
            //QueryKC();
            //QueryJS();
        }

        if (btnChag.Disabled == true)
        {
            Hashtable hash = new Hashtable();
            //if (GetSelectedJS().Count != 1)
            //{
            //    Response.Write("<Script Language=JavaScript>alert('请选择一个教师!');</Script>");
            //    return;
            //}
            //foreach (GridViewRow row in GVJS.Rows)
            //{
            //    if (((CheckBox)row.FindControl("chkSelected")).Checked)
            //    {
            //        hash.Add("jsbh", SqlStringConstructor.GetQuotedString(Convert.ToString(row.Cells[1].Text)));
            //    }
            //}

            //if (GetSelectedKC().Count != 1)
            //{
            //    Response.Write("<Script Language=JavaScript>alert('请选择一个课程!');</Script>");
            //    return;
            //}
            //foreach (GridViewRow row in GVKC.Rows)
            //{
            //    if (((CheckBox)row.FindControl("chkSelected")).Checked)
            //    {
            //        hash.Add("kcbh", SqlStringConstructor.GetQuotedString(Convert.ToString(row.Cells[1].Text)));
            //    }
            //}
            hash.Add("jsbh", SqlStringConstructor.GetQuotedString(txtJsbh.Value));
            hash.Add("kcbh", SqlStringConstructor.GetQuotedString(txtKcbh.Value));
            hash.Add("llxs", Convert.ToInt32(txtLlxs.Value));
            hash.Add("syxs", Convert.ToInt32(txtSyxs.Value));
            hash.Add("sydxs", Convert.ToDouble(txtSydxs.Value));
            hash.Add("kbxn", SqlStringConstructor.GetQuotedString(txtKbxn.Value));
            hash.Add("kbxq", SqlStringConstructor.GetQuotedString(selKbxq.Value));
            hash.Add("jxbbh", SqlStringConstructor.GetQuotedString(txtJxbbh.Value));

            string where = "Where jsbh = " + SqlStringConstructor.GetQuotedString(Tjsbh.Text)
                           + " And kcbh = " + SqlStringConstructor.GetQuotedString(Tkcbh.Text) + " And jxbbh ="
                           + SqlStringConstructor.GetQuotedString(Tjxbbh.Text) + " And kbxn = " + SqlStringConstructor.GetQuotedString(Tkbxn.Text)
                           + " And kbxq =" + SqlStringConstructor.GetQuotedString(Tkbxq.Text);
            Gzl.BusinessLogicLayer.KCRW.Update(hash, where);

            txtJsbh.Value     = "";
            txtKcbh.Value     = "";
            txtZdjs.Value     = "";
            txtKcmc.Value     = "";
            txtJxbbh.Value    = "";
            txtJxbrs.Value    = "";
            txtLlxs.Value     = "";
            txtSydxs.Value    = "";
            txtSyxs.Value     = "";
            txtLlxs.Disabled  = true;
            txtSyxs.Disabled  = true;
            txtSydxs.Disabled = true;
            selKbxq.Disabled  = true;
            btnJssz.Disabled  = true;
            btnKcsz.Disabled  = true;
            btnJxbsz.Enabled  = false;


            btnSave.Disabled   = true;
            btnCancel.Disabled = true;
            btnChag.Disabled   = false;
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('修改成功');</script>");
            Query();
            //QueryKC();
            //QueryJS();
        }
    }
    protected void btnChag_ServerClick(object sender, EventArgs e)
    {
        ArrayList selected = GetSelectedGV();
        KCRW      kcrw     = new KCRW();

        if (selected.Count != 1)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请选择一个课程任务!');</script>");
            return;
        }
        string jsbh  = "";
        string kcmc  = "";
        string jxbmc = "";
        string kbxn  = "";
        string kbxq  = "";

        foreach (GridViewRow row in GV.Rows)
        {
            if (((CheckBox)row.FindControl("chkSelected")).Checked)
            {
                jsbh  = Convert.ToString(row.Cells[1].Text);
                kcmc  = Convert.ToString(row.Cells[3].Text);
                jxbmc = Convert.ToString(row.Cells[6].Text);
                kbxn  = Convert.ToString(row.Cells[7].Text);
                kbxq  = Convert.ToString(row.Cells[8].Text);
            }
        }
        kcrw.LoadData(jsbh, kcmc, jxbmc, kbxn, kbxq);
        Tjsbh.Text    = kcrw.Jsbh;
        Tkcbh.Text    = kcrw.Kcbh;
        Tjxbbh.Text   = kcrw.Jxbbh;
        Tkbxn.Text    = kcrw.Kbxn;
        Tkbxq.Text    = kcrw.Kbxq;
        txtJsbh.Value = kcrw.Jsbh;
        txtZdjs.Value = kcrw.Jsxm;
        //QueryJS2(kcrw.Jsbh);
        //foreach (GridViewRow row in GVJS.Rows)
        //{
        //    ((CheckBox)row.FindControl("chkSelected")).Checked = true;
        //}
        txtKcbh.Value = kcrw.Kcbh;
        txtKcmc.Value = kcrw.Kcmc;
        //QueryKC2();
        //foreach (GridViewRow row in GVKC.Rows)
        //{
        //    ((CheckBox)row.FindControl("chkSelected")).Checked = true;
        //}
        txtKbxn.Value = kcrw.Kbxn;
        foreach (ListItem item in selKbxq.Items)
        {
            if (item.Selected == true)
            {
                item.Selected = false;
            }
            if (item.Text == kcrw.Kbxq)
            {
                item.Selected = true;
            }
        }
        txtLlxs.Value  = Convert.ToString(kcrw.Llxs);
        txtSyxs.Value  = Convert.ToString(kcrw.Syxs);
        txtSydxs.Value = Convert.ToString(kcrw.Sydxs);
        txtJxbbh.Value = kcrw.Jxbbh;
        JXB jxb = new JXB();

        //if (kcrw.Jxbbh.Substring(0, 2) == "bx")
        //{
        jxb.LoadDataJXB(kcrw.Jxbbh);
        txtJxbrs.Value = jxb.Jxbzrs;
        //foreach (ListItem item in selJxblx.Items)
        //{
        //    if (item.Selected == true)
        //    {
        //        item.Selected = false;
        //    }
        //    if (item.Value == kcrw.Jxbbh.Substring(0, 2))
        //    {
        //        item.Selected = true;
        //    }
        //}
        //DataTable dt = JXB.LoadDataGX(kcrw.Jxbbh);
        //listRight.Items.Clear();
        //foreach (DataRow dr in dt.Rows)
        //{
        //    listRight.Items.Add(new ListItem(dr["bjmc"].ToString(), dr["bjbh"].ToString()));
        //}
        //leftTree.Enabled = true;
        //listRight.Enabled = true;
        //btnLeftToRight.Disabled = false;
        //btnRightToLeft.Disabled = false;
        //    txtJxbrs.Disabled = true;
        //}
        //else
        //{
        //    jxb.LoadDataJXB(kcrw.Jxbbh);
        //    txtJxbrs.Value = jxb.Jxbzrs;
        //foreach (ListItem item in selJxblx.Items)
        //{
        //    if (item.Selected == true)
        //    {
        //        item.Selected = false;
        //    }
        //    if (item.Value == kcrw.Jxbbh.Substring(0, 2))
        //    {
        //        item.Selected = true;
        //    }
        //}
        //leftTree.Enabled = false;
        //listRight.Enabled = false;
        //btnLeftToRight.Disabled = false;
        //btnRightToLeft.Disabled = false;
        //txtJxbrs.Disabled = false;
        //}
        txtLlxs.Disabled   = false;
        txtSyxs.Disabled   = false;
        txtSydxs.Disabled  = false;
        selKbxq.Disabled   = false;
        btnJssz.Disabled   = false;
        btnJxbsz.Enabled   = true;
        btnKcsz.Disabled   = false;
        btnAdd.Disabled    = false;
        btnChag.Disabled   = true;
        btnDel.Enabled     = true;
        btnSave.Disabled   = false;
        btnCancel.Disabled = false;
        //selJxblx.Enabled = false;
    }