Ejemplo n.º 1
0
        public ActionResult SelfExercise(int?id)
        {
            List <ScoreInfo> scorelist = new List <ScoreInfo>();
            int               UserID   = _user.SelectUserByAccout(User.Identity.Name).UserID;
            List <Guid?>      paclist  = _paper.SelectPaperByPeriod(BeginTime, EndTime, UserID, ClassID);
            List <CEDTS_User> userlist = _user.SelectUserByClassID(ClassID);

            foreach (var user in userlist)
            {
                ScoreInfo eachscore = new ScoreInfo();
                eachscore.UserID    = user.UserID;
                eachscore.StudNum   = user.StudentNumber;
                eachscore.StudName  = user.UserNickname;
                eachscore.TestNames = new List <string>();
                eachscore.TestScore = new List <double>();
                List <CEDTS_Test> usertest = _paper.SelectTestByPeriod(BeginTime, EndTime, user.UserID);

                int donenum    = 0;
                int correctnum = 0;
                foreach (var test in usertest)
                {
                    if (!paclist.Contains(test.PaperID))
                    {
                        donenum    += _paper.SelectQNByTestID(test.TestID);
                        correctnum += _paper.SelectCQNByTestID(test.TestID);
                    }
                }
                eachscore.DoneNum    = donenum;
                eachscore.CorrectNum = correctnum;
                if (donenum != 0)
                {
                    eachscore.DoneScore = correctnum * 1.0 / donenum * 100;
                }
                else
                {
                    eachscore.DoneScore = 0.0;
                }
                scorelist.Add(eachscore);
            }
            ViewData["StartDate"] = BeginTime;
            ViewData["EndDate"]   = EndTime;
            ViewData["ClassName"] = ClassName;
            return(View(_paper.ScoreInfoPaged(id, scorelist)));
        }