コード例 #1
0
        protected void BtnOk_Click(object sender, EventArgs e)
        {
            Business.correcting     correcting     = new Business.correcting();
            Business.correctingData correctingdata = new Business.correctingData();

            correctingdata.hwtit    = hwtit.Text;
            correctingdata.userid   = userid.Text;
            correctingdata.ctime    = ctime.Text;
            correctingdata.ccon     = ccon.Text;
            correctingdata.ter      = ter.Text;
            correctingdata.cdate    = cdate.Text;
            correctingdata.scores   = scores.Text;
            correctingdata.messages = messages.Text;


            if (Request.QueryString["id"] != null)
            {
                correctingdata.Id = Request.QueryString["id"];
                correcting.Modify(correctingdata);
            }
            else
            {
                correcting.Insert(correctingdata);
            }

            Response.Redirect("correctingtb.aspx");

            correcting     = null;
            correctingdata = null;
        }
コード例 #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (userid.Value == "")
            {
                Response.Write("<script>alert('请填写你的学号姓名!')</script>");
            }
            else
            {
                Business.correcting     correcting     = new Business.correcting();
                Business.correctingData correctingdata = new Business.correctingData();

                string ccon = "";

                foreach (RepeaterItem ri in Repeater1.Items)
                {
                    Label   key   = (Label)ri.FindControl("Label1");
                    TextBox value = (TextBox)ri.FindControl("TextBox1");
                    ccon += "题目:" + key.Text + "<br/>答案:" + value.Text + "<br/>";
                }

                correctingdata.hwtit    = Label2.Text;
                correctingdata.userid   = userid.Value;
                correctingdata.ctime    = DateTime.Now.ToString();
                correctingdata.ccon     = ccon;
                correctingdata.ter      = "";
                correctingdata.cdate    = "";
                correctingdata.scores   = "";
                correctingdata.messages = "";
                correcting.Insert(correctingdata);

                Response.Redirect("correctingtb.aspx");
            }
        }