⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 seeimitationresult.aspx.cs

📁 在线考试系统 主要真对考试 开发的个人项目
💻 CS
📖 第 1 页 / 共 2 页
字号:
                        if (htMulit[dr.RowIndex].ToString().Contains("C"))
                        {
                            ((CheckBox)dr.FindControl("CheckBox2")).Checked = true;
                            if (htMulit[dr.RowIndex].ToString().Contains("D"))
                            {
                                ((CheckBox)dr.FindControl("CheckBox4")).Checked = true;
                            }
                        }
                        else if (htMulit[dr.RowIndex].ToString().Contains("D"))
                        {
                            ((CheckBox)dr.FindControl("CheckBox4")).Checked = true;
                        }
                    }
                    else if (htMulit[dr.RowIndex].ToString().Contains("C"))
                    {

                        ((CheckBox)dr.FindControl("CheckBox2")).Checked = true;
                        if (htMulit[dr.RowIndex].ToString().Contains("D"))
                        {
                            ((CheckBox)dr.FindControl("CheckBox4")).Checked = true;
                        }

                    }
                    else if (htMulit[dr.RowIndex].ToString().Contains("D"))
                    {
                        ((CheckBox)dr.FindControl("CheckBox4")).Checked = true;
                    }
                }
                else if (htMulit[dr.RowIndex].ToString().Contains("B"))
                {
                    ((CheckBox)dr.FindControl("CheckBox3")).Checked = true;
                    if (htMulit[dr.RowIndex].ToString().Contains("C"))
                    {
                        ((CheckBox)dr.FindControl("CheckBox2")).Checked = true;
                        if (htMulit[dr.RowIndex].ToString().Contains("D"))
                        {
                            ((CheckBox)dr.FindControl("CheckBox4")).Checked = true;
                        }
                    }
                    else if (htMulit[dr.RowIndex].ToString().Contains("D"))
                    {
                        ((CheckBox)dr.FindControl("CheckBox4")).Checked = true;
                    }

                }
                else if (htMulit[dr.RowIndex].ToString().Contains("C"))
                {
                    ((CheckBox)dr.FindControl("CheckBox2")).Checked = true;
                    if (htMulit[dr.RowIndex].ToString().Contains("D"))
                    {
                        ((CheckBox)dr.FindControl("CheckBox4")).Checked = true;
                    }
                }
                else if (htMulit[dr.RowIndex].ToString().Contains("D"))
                {
                    ((CheckBox)dr.FindControl("CheckBox4")).Checked = true;
                }
            }



        }
    }

    //检查判断题
    public void CheckJudge(Hashtable htJudge)
    {
       // string Qanswer = ((Label)GridView3.Rows[0].FindControl("Label23")).Text;
        foreach (GridViewRow dr in GridView3.Rows)//对单选题每题进行判断用户选择答案
        {
            string Qanswer = ((Label)GridView3.Rows[dr.RowIndex].FindControl("Label23")).Text;
            if (htJudge[dr.RowIndex].ToString() != Qanswer)
            {
                if (htJudge[dr.RowIndex].ToString().Contains("错"))
                {
                    ((CheckBox)dr.FindControl("CheckBox6")).Checked=true;
                    ((Label)GridView3.Rows[dr.RowIndex].FindControl("Label23")).Visible = true;
                }
            }
            else
            {
                if (htJudge[dr.RowIndex].ToString().Contains("对"))
                {
                    ((CheckBox)dr.FindControl("CheckBox5")).Checked=true;
                }
            }
        }
    }

    //检查填空题
    public void CheckFill(Hashtable htfill)
    {
        foreach (GridViewRow dr in GridView4.Rows)
        {
            string Qanswer = ((Label)GridView4.Rows[dr.RowIndex].FindControl("Label27")).Text;
            if (htfill[dr.RowIndex].ToString() != Qanswer)
            {
                ((TextBox)GridView4.Rows[dr.RowIndex].FindControl("TextBox1")).Text = htfill[dr.RowIndex].ToString();
                ((Label)GridView4.Rows[dr.RowIndex].FindControl("Label27")).Visible = true;

            }
            else
            {
                ((TextBox)GridView4.Rows[dr.RowIndex].FindControl("TextBox1")).Text = htfill[dr.RowIndex].ToString();
            }

        }
    }

    //检查问答题
    public void CheckQuestion(Hashtable htquestions)
    {
        foreach (GridViewRow dr in GridView5.Rows)
        {
            string Qanswer = ((Label)GridView5.Rows[dr.RowIndex].FindControl("Label30")).Text;
            string str = htquestions[dr.RowIndex].ToString();
            string key = ((Label)GridView5.Rows[dr.RowIndex].FindControl("Label39")).Text;
            int score = Int32.Parse(((Label)GridView5.Rows[dr.RowIndex].FindControl("Label35")).Text);
            string str1 = Key(str, key);
            ((Label)GridView5.Rows[dr.RowIndex].FindControl("Label26")).Text = WrongKey(str1, key);
            ((Label)GridView5.Rows[dr.RowIndex].FindControl("Label40")).Text = Marks(str1, key, score).ToString();
            ((Label)GridView5.Rows[dr.RowIndex].FindControl("Label30")).Visible = true;   

        }
    }

    protected void Button1_Click(object sender, EventArgs e)
    {      
        Response.Redirect("StudentInfo.aspx");
    }
    static String Key(string str, string strkey)
    {

        string[] str1 = strkey.Split(',');
        for (int i = 0; i < str1.Length; i++)
        {
            if (str.Contains(str1[i]))
            {
                str = str.Replace(str1[i], "<font color='red'>" + str1[i] + "</font>");
            }
        }
        return str;
    }
    static String WrongKey(string str, string strkey)
    {
        string fou = "not,不是,不,错,错误,不好,否,坏,不会,不对";
        string[] str1 = fou.Split(',');

        for (int i = 0; i < str1.Length; i++)
        {
            if (str.Contains(str1[i]))
            {
                str = str.Replace(str1[i], "<font color='blue'>" + str1[i] + "</font>");
            }
        }
        return str;

    }
    static int Marks(string str, string key, int score)
    {
        string fou = "not,不是,不,错,错误,不好,否,坏,不会,不对";
        string[] str1 = key.Split(',');
        string[] str2 = fou.Split(',');
        string[,] str3 = new string[str2.Length, str1.Length];
        string[] str4 = new string[str2.Length * str1.Length];
        int count = 0, count1 = 0;
        for (int i = 0; i < str1.Length; i++)
        {
            count += PanDuan(str, str1[i]);
        }

        try
        {
            for (int i = 0; i < str2.Length; i++)
            {
                for (int j = 0; j < str1.Length; j++)
                {
                    str3[i, j] = str2[i] + str1[j];
                }
            }
        }
        catch (Exception e)
        {
            //Console.WriteLine(e.Message); 
            throw new Exception(e.Message);
        }
        for (int i = 0; i < str2.Length; i++)
        {
            for (int j = 0; j < str1.Length; j++)
            {
                str4[i * str1.Length + j] = str3[i, j];
            }
        }

        for (int i = 0; i < str4.Length; i++)
        {
            count1 += PanDuan(str, str4[i]);

        }
        return (count - count1) * (score / str1.Length);
    }
    static int PanDuan(string str, string str1)
    {
        int count = 0;
        if (str.Contains(str1))
        {
            count++;
        }
        return count;
    } 
}

⌨️ 快捷键说明

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