Exemplo n.º 1
0
        StatisticsScore ICedts_HomeRepository.UserScore(string UserName)
        {
            var UserID = (from m in db.CEDTS_User where m.UserAccount == UserName select m.UserID).FirstOrDefault();
            var Score  = (from m in db.CEDTS_Test where m.UserID == UserID orderby m.FinishDate descending select m).Take(10);

            StatisticsScore Ss = new StatisticsScore();

            Ss.Score    = new List <double>();
            Ss.TypeName = new List <string>();
            foreach (var s in Score)
            {
                var typename = (from b in db.CEDTS_Paper where b.PaperID == s.PaperID select b).FirstOrDefault();
                Ss.Score.Add(s.TotalScore.Value / typename.Score.Value * 100);
                Ss.TypeName.Add(typename.Title);
            }
            return(Ss);
        }
Exemplo n.º 2
0
        StatisticsScore ICedts_HomeRepository.TotalScore()
        {
            var Score = db.CEDTS_Test.OrderBy(p => p.TotalScore);

            StatisticsScore Ss = new StatisticsScore();

            Ss.Count = new List <int>();
            Ss.Score = new List <double>();
            Ss.Count.Add(0);
            Ss.Count.Add(0);
            Ss.Count.Add(0);
            Ss.Count.Add(0);
            Ss.Count.Add(0);
            Ss.Count.Add(0);
            Ss.Count.Add(0);
            Ss.Count.Add(0);
            Ss.Count.Add(0);
            if (Score.Count() >= 500)
            {
                foreach (var s in Score)
                {
                    if (0 <= s.TotalScore && s.TotalScore < 10)
                    {
                        Ss.Count[0] += 1;
                    }
                    if (10 <= s.TotalScore && s.TotalScore < 20)
                    {
                        Ss.Count[1] += 1;
                    }
                    if (20 <= s.TotalScore && s.TotalScore < 30)
                    {
                        Ss.Count[2] += 1;
                    }
                    if (30 <= s.TotalScore && s.TotalScore < 40)
                    {
                        Ss.Count[3] += 1;
                    }
                    if (40 <= s.TotalScore && s.TotalScore < 50)
                    {
                        Ss.Count[4] += 1;
                    }
                    if (50 <= s.TotalScore && s.TotalScore < 60)
                    {
                        Ss.Count[5] += 1;
                    }
                    if (60 <= s.TotalScore && s.TotalScore < 70)
                    {
                        Ss.Count[6] += 1;
                    }
                    if (70 <= s.TotalScore && s.TotalScore < 80)
                    {
                        Ss.Count[7] += 1;
                    }
                    if (80 <= s.TotalScore && s.TotalScore < 90)
                    {
                        Ss.Count[8] += 1;
                    }
                }
            }
            else
            {
                Ss.Count[0] = 10;
                Ss.Count[1] = 50;
                Ss.Count[2] = 110;
                Ss.Count[3] = 160;
                Ss.Count[4] = 110;
                Ss.Count[5] = 50;
                Ss.Count[6] = 10;
            }
            return(Ss);
        }