updatetiankong.aspx.cs

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

CS
74
字号
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 updateTianKong : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (Session["adminId"] == null)
        //{
        //    Response.Redirect("Default.aspx");
        //}
        //else

        if (!Page.IsPostBack)
        {
            string testId = Session["testId"].ToString();
            DataSet ds = new DataSet();
            ds = (new projClass()).getTianKongInfoAsId(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["formerContent"]);
            tbx_content2.Text = Convert.ToString(dataRow["backContent"]);
            this.tbx_score.Text = Convert.ToString(dataRow["testScore"]);
            this.txtRightAns.Text = Convert.ToString(dataRow["rightAns"]);
            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;
            string content2 = tbx_content2.Text;
            string rightAns = this.txtRightAns.Text.Trim();
            int score;
            int pub;
            if (cbx_isPub.Checked)
                pub = 1;
            else pub = 0;
            string testId = Session["testId"].ToString();
            score = Convert.ToInt32(tbx_score.Text);
            count = (new projClass()).updateTestTianKongInfo(testId, content,content2, rightAns, pub, score, courseId);
            if (count > 0)
            {
                Response.Write("<script>alert(\"修改成功!\");</script>");
                Response.Redirect("showTianKong.aspx");
            }
        }
    }
    protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("showTianKong.aspx");
    }
}

⌨️ 快捷键说明

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