updatewendabyteacher.aspx.cs

来自「在线考试系统 主要真对考试 开发的个人项目」· CS 代码 · 共 71 行

CS
71
字号
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;

public partial class updateWenDaByTeacher : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["teacherId"] == null)
        {
            Response.Redirect("Default.aspx");
        }

        if (!Page.IsPostBack)
        {
            string testId = Session["testId"].ToString();
            DataSet ds = new DataSet();
            ds = (new projClass()).getWenDaInfoAsId(testId);
            DataTable dt = ds.Tables["testInfo"];
            DataRow dataRow = dt.Rows[0];
            string courseId = Convert.ToString(dataRow["testCourse"]);
            lbl_courseName.Text = (new projClass()).getCourseNameAsCourseId(courseId);
            tbx_content.Text = Convert.ToString(dataRow["testContent"]);
            this.tbx_score.Text = Convert.ToString(dataRow["testScore"]);
            this.txtRightAns.Text = Convert.ToString(dataRow["rightAns"]);
            this.TextBox3.Text = Convert.ToString(dataRow["keyword"]);
            String pub = Convert.ToString(dataRow["pub"]);
            // Response.Write("<script>alert('"+pub+"')</script>");
            if (pub.Equals("是"))
                cbx_isPub.Checked = true;
            else cbx_isPub.Checked = false;
        }

    }

    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        if (tbx_content.Text.Trim() != "")
        {
            int count;
            string courseId = Convert.ToString(Session["courseId"]);
            string content = tbx_content.Text.Trim();
            string rightAns = this.txtRightAns.Text.Trim();
            int score;
            int pub;
            if (cbx_isPub.Checked)
                pub = 1;
            else pub = 0;
            string keyword = this.TextBox3.Text.Trim();
            string testId = Session["testId"].ToString();
            score = Convert.ToInt32(tbx_score.Text);
            count = (new projClass()).updateTestWenDaInfo(testId, content, rightAns,keyword, pub, score, courseId);

        }
        Response.Write("<script>alert(\"修改成功!\");</script>");
        Response.Redirect("teacherShowWenDa.aspx");

    }
    protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("teacherShowWenDa.aspx");
    }
}

⌨️ 快捷键说明

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