예제 #1
0
    protected void Btnquiz_Click(object sender, EventArgs e)
    {
        string strscore = Labelallscore.Text;
        if (strscore != "")
        {
            int Rscore = Int32.Parse(strscore);
            if (Rscore > 0)
            {
                string Rnum = Request.Cookies["StudentCookies"].Values["Snum"].ToString();
                string odate = DateTime.Now.ToShortDateString();
                DateTime Rdate = DateTime.Parse(odate);
                Labelmsg.Text = Rdate.ToString();

                LearnSite.BLL.Result bll = new LearnSite.BLL.Result();
                if (bll.ExistsBynumdate(Rnum, Rdate))
                {
                    Labelmsg.Text = "今天已经通过测验!";
                }
                else
                {
                    LearnSite.Model.Result model = new LearnSite.Model.Result();
                    model.Rdate = Rdate;
                    model.Rnum = Rnum;
                    model.Rscore = Rscore;
                    bll.Add(model);//增加今天测验成绩记录
                    int Squiz = bll.GetAverage(Rnum);//计算获得该学号的测验成绩总平均值
                    LearnSite.BLL.Students stbll = new LearnSite.BLL.Students();
                    stbll.SetSquiz(Rnum, Squiz);//更新该学号的测验成绩
                    System.Threading.Thread.Sleep(1000);
                    Labelmsg.Text = "测验成绩成功提交!";
                    PrintQids();
                    Btnquiz.Enabled = false;
                    HLanswer.Enabled = true;
                    HLanswer.Visible = true;
                }
            }
            else
            {
                Labelmsg.Text = "测验成绩为零!";
            }
        }
        else
        {
            Labelmsg.Text = "请先进行测验!";
        }
    }
예제 #2
0
 private void ShowMySquiz()
 {
     string mySnum = Request.Cookies["StudentCookies"].Values["Snum"].ToString();
     LearnSite.BLL.Students bll = new LearnSite.BLL.Students();
     LabelSquiz.Text = bll.MySquiz(mySnum);
     LearnSite.BLL.Result rbll = new LearnSite.BLL.Result();
     GVmyScore.DataSource = rbll.GetListScore(mySnum);
     GVmyScore.DataBind();
 }