示例#1
0
    //��ʼ���Ծ�������ݿ��н�����ȡ��
    protected void InitData()
    {
        DataBase DB = new DataBase();
        int paperID = Convert.ToInt32(Request.QueryString["PaperID"].ToString());

        SqlParameter[] Params1 = new SqlParameter[2];
        Params1[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //�Ծ���
        Params1[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "��ѡ��");            //��Ŀ����
        DataSet ds1 = DB.GetDataSet("Proc_PaperDetailmr", Params1);
        GridView1.DataSource = ds1;
        GridView1.DataBind();

        SqlParameter[] Params2 = new SqlParameter[2];
        Params2[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //�Ծ���
        Params2[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "��ѡ��");            //��Ŀ����
        DataSet ds2 = DB.GetDataSet("Proc_PaperDetailmr", Params2);
        GridView2.DataSource = ds2;
        GridView2.DataBind();

        SqlParameter[] Params3 = new SqlParameter[2];
        Params3[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //�Ծ���
        Params3[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "�ж���");            //��Ŀ����
        DataSet ds3 = DB.GetDataSet("Proc_PaperDetailmr", Params3);
        GridView3.DataSource = ds3;
        GridView3.DataBind();

        SqlParameter[] Params4 = new SqlParameter[2];
        Params4[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //�Ծ���
        Params4[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "�����");            //��Ŀ����
        DataSet ds4 = DB.GetDataSet("Proc_PaperDetailmr", Params4);
        GridView4.DataSource = ds4;
        GridView4.DataBind();

        SqlParameter[] Params5 = new SqlParameter[2];
        Params5[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //�Ծ���
        Params5[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "�ʴ���");            //��Ŀ����
        DataSet ds5 = DB.GetDataSet("Proc_PaperDetailmr", Params5);
        GridView5.DataSource = ds5;
        GridView5.DataBind();
    }
示例#2
0
    //初始化试卷,从数据库中将试题取出
    protected void InitData()
    {
        SqlParameter[] Params1 = new SqlParameter[2];
        DataBase DB = new DataBase();
        int paperID = int.Parse(Session["PaperID"].ToString());
        Params1[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params1[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "单选题");            //题目类型
        DataSet ds1 = DB.GetDataSet("Proc_PaperDetailmr", Params1);
        GridView1.DataSource = ds1;
        GridView1.DataBind();
        ((Label)GridView1.HeaderRow.FindControl("Label27")).Text = ((Label)GridView1.Rows[0].FindControl("Label4")).Text;

        SqlParameter[] Params2 = new SqlParameter[2];
        Params2[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params2[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "多选题");            //题目类型
        DataSet ds2 = DB.GetDataSet("Proc_PaperDetailmr", Params2);
        GridView2.DataSource = ds2;
        GridView2.DataBind();
        ((Label)GridView2.HeaderRow.FindControl("Label28")).Text = ((Label)GridView2.Rows[0].FindControl("Label8")).Text;

        SqlParameter[] Params3 = new SqlParameter[2];
        Params3[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params3[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "判断题");            //题目类型
        DataSet ds3 = DB.GetDataSet("Proc_PaperDetailmr", Params3);
        GridView3.DataSource = ds3;
        GridView3.DataBind();
        ((Label)GridView3.HeaderRow.FindControl("Label29")).Text = ((Label)GridView3.Rows[0].FindControl("Label12")).Text;

        SqlParameter[] Params4 = new SqlParameter[2];
        Params4[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID);               //试卷编号
        Params4[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "填空题");            //题目类型
        DataSet ds4 = DB.GetDataSet("Proc_PaperDetailmr", Params4);
        GridView4.DataSource = ds4;
        GridView4.DataBind();
        ((Label)GridView4.HeaderRow.FindControl("Label30")).Text = ((Label)GridView4.Rows[0].FindControl("Label17")).Text;
    }
示例#3
0
        //查询某个用户考试的试卷
        public DataSet QueryUserPaper(string type,string userid)
        {
            DataBase DB = new DataBase();
            SqlParameter[] Params = new SqlParameter[2];
            //Params[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid);               //试卷编号
            Params[0] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, type);            //题目类型
            Params[1] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid);            //用户ID

            return DB.GetDataSet("Proc_UserAnswermr", Params);
        }
示例#4
0
    //��ʼ���Ծ�������ݿ��н�����ȡ��
    protected void PaperData()
    {
        string userid = Request.QueryString["UserID"].ToString();
        paperid = int.Parse(Request.QueryString["PaperID"].ToString());

        DataBase DB = new DataBase();

        DataSet ds = DB.GetDataSetSql("select * from [UserAnswermr] where UserID='" + userid + "'");
        DataRow[] row = ds.Tables[0].Select();
        foreach (DataRow rs in row)
        {
            lblExamtime.Text = rs["ExamTime"].ToString();
        }

        SqlParameter[] Params1 = new SqlParameter[3];
        Params1[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid);
        Params1[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "��ѡ��");
        Params1[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid);
        DataSet ds1 = DB.GetDataSet("Proc_UserAnswermr", Params1);
        if (ds1.Tables[0].Rows.Count > 0)
        {
            GridView1.DataSource = ds1;
            GridView1.DataBind();
            ((Label)GridView1.HeaderRow.FindControl("Label27")).Text = ((Label)GridView1.Rows[0].FindControl("Label4")).Text;
        }

        SqlParameter[] Params2 = new SqlParameter[3];
        Params2[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid);
        Params2[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "��ѡ��");
        Params2[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid);
        DataSet ds2 = DB.GetDataSet("Proc_UserAnswermr", Params2);
        if (ds2.Tables[0].Rows.Count > 0)
        {
            GridView2.DataSource = ds2;
            GridView2.DataBind();
            ((Label)GridView2.HeaderRow.FindControl("Label28")).Text = ((Label)GridView2.Rows[0].FindControl("Label8")).Text;
        }

        SqlParameter[] Params3 = new SqlParameter[3];
        Params3[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid);
        Params3[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "���");
        Params3[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid);
        DataSet ds3 = DB.GetDataSet("Proc_UserAnswermr", Params3);
        if (ds3.Tables[0].Rows.Count > 0)
        {
            GridView3.DataSource = ds3;
            GridView3.DataBind();
            ((Label)GridView3.HeaderRow.FindControl("Label29")).Text = ((Label)GridView3.Rows[0].FindControl("Label12")).Text;
        }

        SqlParameter[] Params4 = new SqlParameter[3];
        Params4[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid);
        Params4[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "�����");
        Params4[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid);
        DataSet ds4 = DB.GetDataSet("Proc_UserAnswermr", Params4);
        if (ds4.Tables[0].Rows.Count > 0)
        {
            GridView4.DataSource = ds4;
            GridView4.DataBind();
            ((Label)GridView4.HeaderRow.FindControl("Label30")).Text = ((Label)GridView4.Rows[0].FindControl("Label17")).Text;
        }

        SqlParameter[] Params5 = new SqlParameter[3];
        Params5[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid);
        Params5[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "�ʴ���");
        Params5[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid);
        DataSet ds5 = DB.GetDataSet("Proc_UserAnswermr", Params5);
        if (ds5.Tables[0].Rows.Count > 0)
        {
            GridView5.DataSource = ds5;
            GridView5.DataBind();
            ((Label)GridView5.HeaderRow.FindControl("Label31")).Text = ((Label)GridView5.Rows[0].FindControl("Label21")).Text;
        }

        if (GridView1.Rows.Count > 0)
        {
            int score1 = 0;
            int singlemark = int.Parse(((Label)GridView1.Rows[0].FindControl("Label4")).Text);//ȡ����ѡ���ÿ���ֵ
            foreach (GridViewRow dr in GridView1.Rows)
            {
                if (((Label)dr.FindControl("Label3")).Text.Trim() == "A")
                {
                    ((RadioButton)dr.FindControl("RadioButton1")).Checked = true;
                }
                else if (((Label)dr.FindControl("Label3")).Text.Trim() == "B")
                {
                    ((RadioButton)dr.FindControl("RadioButton2")).Checked = true;
                }
                else if (((Label)dr.FindControl("Label3")).Text.Trim() == "C")
                {
                    ((RadioButton)dr.FindControl("RadioButton3")).Checked = true;
                }
                else if (((Label)dr.FindControl("Label3")).Text.Trim() == "D")
                {
                    ((RadioButton)dr.FindControl("RadioButton4")).Checked = true;
                }
                if (((Label)dr.FindControl("Label3")).Text.Trim() == ((Label)dr.FindControl("Label23")).Text.Trim())
                {
                    score1 = score1 + singlemark;
                    sinScore.Text = Convert.ToString(score1);
                }
            }
        }

        if (GridView2.Rows.Count > 0)
        {
            int score2 = 0;
            int multimark = int.Parse(((Label)GridView2.Rows[0].FindControl("Label8")).Text);//ȡ����ѡ��ÿ���ֵ
            foreach (GridViewRow dr in GridView2.Rows)
            {
                if (((Label)dr.FindControl("Label7")).Text.Trim() == "A")
                {
                    ((CheckBox)dr.FindControl("CheckBox1")).Checked = true;
                }
                if (((Label)dr.FindControl("Label7")).Text.Trim() == "B")
                {
                    ((CheckBox)dr.FindControl("CheckBox2")).Checked = true;
                }
                if (((Label)dr.FindControl("Label7")).Text.Trim() == "C")
                {
                    ((CheckBox)dr.FindControl("CheckBox3")).Checked = true;
                }
                if (((Label)dr.FindControl("Label7")).Text.Trim() == "D")
                {
                    ((CheckBox)dr.FindControl("CheckBox4")).Checked = true;
                }
                if (((Label)dr.FindControl("Label7")).Text.Trim() == "AB")
                {
                    ((CheckBox)dr.FindControl("CheckBox1")).Checked = true;
                    ((CheckBox)dr.FindControl("CheckBox2")).Checked = true;
                }
                if (((Label)dr.FindControl("Label7")).Text.Trim() == "AC")
                {
                    ((CheckBox)dr.FindControl("CheckBox1")).Checked = true;
                    ((CheckBox)dr.FindControl("CheckBox3")).Checked = true;
                }
                if (((Label)dr.FindControl("Label7")).Text.Trim() == "AD")
                {
                    ((CheckBox)dr.FindControl("CheckBox1")).Checked = true;
                    ((CheckBox)dr.FindControl("CheckBox4")).Checked = true;
                }
                if (((Label)dr.FindControl("Label7")).Text.Trim() == "BC")
                {
                    ((CheckBox)dr.FindControl("CheckBox2")).Checked = true;
                    ((CheckBox)dr.FindControl("CheckBox3")).Checked = true;
                }
                if (((Label)dr.FindControl("Label7")).Text.Trim() == "BD")
                {
                    ((CheckBox)dr.FindControl("CheckBox2")).Checked = true;
                    ((CheckBox)dr.FindControl("CheckBox4")).Checked = true;
                }
                if (((Label)dr.FindControl("Label7")).Text.Trim() == "CD")
                {
                    ((CheckBox)dr.FindControl("CheckBox3")).Checked = true;
                    ((CheckBox)dr.FindControl("CheckBox4")).Checked = true;
                }
                if (((Label)dr.FindControl("Label7")).Text.Trim() == "ABC")
                {
                    ((CheckBox)dr.FindControl("CheckBox1")).Checked = true;
                    ((CheckBox)dr.FindControl("CheckBox2")).Checked = true;
                    ((CheckBox)dr.FindControl("CheckBox3")).Checked = true;
                }
                if (((Label)dr.FindControl("Label7")).Text.Trim() == "ABD")
                {
                    ((CheckBox)dr.FindControl("CheckBox1")).Checked = true;
                    ((CheckBox)dr.FindControl("CheckBox2")).Checked = true;
                    ((CheckBox)dr.FindControl("CheckBox4")).Checked = true;
                }
                if (((Label)dr.FindControl("Label7")).Text.Trim() == "ACD")
                {
                    ((CheckBox)dr.FindControl("CheckBox1")).Checked = true;
                    ((CheckBox)dr.FindControl("CheckBox3")).Checked = true;
                    ((CheckBox)dr.FindControl("CheckBox4")).Checked = true;
                }
                if (((Label)dr.FindControl("Label7")).Text.Trim() == "ABCD")
                {
                    ((CheckBox)dr.FindControl("CheckBox1")).Checked = true;
                    ((CheckBox)dr.FindControl("CheckBox2")).Checked = true;
                    ((CheckBox)dr.FindControl("CheckBox3")).Checked = true;
                    ((CheckBox)dr.FindControl("CheckBox4")).Checked = true;
                }
                if (((Label)dr.FindControl("Label7")).Text.Trim() == ((Label)dr.FindControl("Label27")).Text.Trim())
                {
                    score2 = score2 + multimark;
                    mulScore.Text = Convert.ToString(score2);
                }
            }
        }

        if (GridView3.Rows.Count > 0)
        {
            int score3 = 0;
            int judgemark = int.Parse(((Label)GridView3.Rows[0].FindControl("Label12")).Text);//ȡ���ж���ÿ���ֵ
            foreach (GridViewRow dr in GridView3.Rows)//���ж���ÿ������ж��û�ѡ���
            {
                if (bool.Parse(((Label)dr.FindControl("Label11")).Text.Trim()))
                {
                    ((CheckBox)dr.FindControl("CheckBox5")).Checked = true;
                }
                else
                {
                    ((CheckBox)dr.FindControl("CheckBox6")).Checked = true;
                }
                if (((Label)dr.FindControl("Label11")).Text.Trim() == ((Label)dr.FindControl("Label41")).Text.Trim())
                {
                    score3 = score3 + judgemark;
                    judScore.Text = Convert.ToString(score3);
                }
            }
        }
        //ȡ�������ÿ���ֵ
        if (GridView4.Rows.Count > 0)
        {
            int score4 = 0;
            int fillmark = int.Parse(((Label)GridView4.Rows[0].FindControl("Label17")).Text);
            foreach (GridViewRow dr in GridView4.Rows)//�������ÿ������ж��û�ѡ���
            {
                string str = "";
                str = ((TextBox)dr.FindControl("TextBox1")).Text.Trim();
                if (str == ((Label)dr.FindControl("Label26")).Text.Trim())
                {
                    score4 = score4 + fillmark;
                    filScore.Text = Convert.ToString(score4);
                }
            }
        }
    }