Beispiel #1
0
 private void SaveTypeRecord(string Psnum,string Pip)
 {
     string TypeScore = Request.Form["Typeresult"].ToString();//
     TypeScore = TypeScore.Replace("字/分", "");
     string nowstr = Request.Form["TypeText7"].ToString();
     string rightword = Request.Form["TypeText4"].ToString();
     bool Timepass = false;
     int nowtime = 0;
     int uplen = ts.Length * 80 / 100;
     if (nowstr != "")
     {
         nowtime = Int32.Parse(nowstr);
     }
     int Typetime = 1800 - nowtime;
     if (Typetime > 10)
     {
         Timepass = true;
     }
     else
     {
         Timepass = false;
     }
     if (Timepass)
     {
         if (Int32.Parse(rightword) > uplen)
         {
             int Ptid = Int32.Parse(LTid.Text);
             int Pscore = Int32.Parse(TypeScore.Trim());
             DateTime Pdate = DateTime.Now;
             LearnSite.Model.Ptyper pmodel = new LearnSite.Model.Ptyper();
             pmodel.Pdate = Pdate;
             pmodel.Pip = Pip;
             pmodel.Pscore = Pscore;
             pmodel.Psnum = Psnum;
             pmodel.Ptid = Ptid;
             pmodel.Ptype = 1;
             LearnSite.BLL.Ptyper pt = new LearnSite.BLL.Ptyper();
             if (pt.ExistsPsnum(Psnum))
             {
                 pt.Update(pmodel);
             }
             else
             {
                 pt.Add(pmodel);
             }
             Labelmsg.Text = "输入" + rightword + "个汉字" + " 用时" + Typetime.ToString() + "秒";
             BtnType.Text = "成绩记录成功!";
             BtnType.Enabled = false;
         }
         else
         {
             Labelmsg.Text = "字数太少不作记录" + " 用时" + Typetime.ToString() + "秒";
         }
         System.Threading.Thread.Sleep(500);
         showtyper();
     }
     else
     {
         Labelmsg.Text = "打字时间太短不作记录" + " 用时" + Typetime.ToString() + "秒";
         BtnType.Text = "成绩记录失败!";
     }
 }