Ejemplo n.º 1
0
        public StuScores OrderByScores(StudentInformation.StudentScores items)
        {
            StuScores stuscores = new StuScores();

            switch (items.KCMC)
            {
            case "语文":
                stuscores.stuscore = items;
                stuscores.KCIndex  = 1;
                break;

            case "数学":
                stuscores.stuscore = items;
                stuscores.KCIndex  = 2;
                break;

            case "英语":
                stuscores.stuscore = items;
                stuscores.KCIndex  = 3;
                break;

            case "物理":
                stuscores.stuscore = items;
                stuscores.KCIndex  = 4;
                break;

            case "化学":
                stuscores.stuscore = items;
                stuscores.KCIndex  = 5;
                break;

            case "生物":
                stuscores.stuscore = items;
                stuscores.KCIndex  = 6;
                break;

            case "历史":
                stuscores.stuscore = items;
                stuscores.KCIndex  = 7;
                break;

            case "政治":
                stuscores.stuscore = items;
                stuscores.KCIndex  = 8;
                break;

            case "地理":
                stuscores.stuscore = items;
                stuscores.KCIndex  = 9;
                break;

            default:
                stuscores.stuscore = items;
                stuscores.KCIndex  = 10;
                break;
            }
            return(stuscores);
        }
Ejemplo n.º 2
0
        public IList <StudentInformation.StudentScores> GetStudentScore(Guid userId, Guid schoolId, string year, string term, string ExamType, string ExamName)
        {
            StudentEntities db = new StudentEntities();
            Func <View_Exam_ExamScore, bool> predicate;
            Func <View_Exam_ExamScore, bool> func2;
            Func <View_Exam_ExamScore, bool> func3;
            Func <View_Exam_ExamScore, bool> func4;
            string sql =
                "select * from View_Exam_ExamScore where studentid='" + userId + "' and SchoolId = '" + schoolId + "'";
            List <View_Exam_ExamScore> source = db.ExecuteStoreQuery <View_Exam_ExamScore>(sql).ToList();

            //List<View_Exam_ExamScore> source =
            //    db.View_Exam_ExamScore.Where(x => x.StudentId == userId && x.SchoolId == schoolId).ToList();

            if (!string.IsNullOrEmpty(year))
            {
                predicate = x => x.SchYear == year;
                source    = source.Where(predicate).ToList();
            }
            if (!string.IsNullOrEmpty(term))
            {
                func2  = x => x.SchTerm == term;
                source = source.Where(func2).ToList();
            }
            if (!string.IsNullOrEmpty(ExamType))
            {
                func3 = delegate(View_Exam_ExamScore x)
                {
                    int?examType = x.ExamType;
                    int num      = Convert.ToInt32(ExamType);
                    return((examType.GetValueOrDefault() == num) && examType.HasValue);
                };
                source = source.Where(func3).ToList();
            }
            if (!string.IsNullOrEmpty(ExamName))
            {
                func4  = x => x.ExamName == ExamName;
                source = source.Where(func4).ToList();
            }
            IList <StudentInformation.StudentScores> list2 = new List <StudentInformation.StudentScores>();

            foreach (View_Exam_ExamScore score in source)
            {
                StudentInformation.StudentScores item = new StudentInformation.StudentScores
                {
                    SCID          = score.ScoreId.ToString(),
                    ClassId       = score.ClassId.ToString(),
                    ClassName     = score.ClassName,
                    ExamID        = score.ExamId,
                    Score         = score.Score,
                    SchYear       = score.SchYear,
                    SchTerm       = score.SchTerm,
                    ExamName      = score.ExamName,
                    Examlevel     = score.ExamLevel.ToString(),
                    ExamTypeCode  = score.ExamType,
                    ExamStartTime = score.StartDate,
                    ExamEndTime   = score.EndDate
                };
                if (item.SchTerm.Equals("1"))
                {
                    item.SchTermName = "第一学期";
                    item.SchYearTerm = string.Concat(new object[] { Convert.ToInt32(score.SchYear) - 1, "-", score.SchYear, "学年第一学期" });
                }
                else
                {
                    item.SchTermName = "第二学期";
                    item.SchYearTerm = string.Concat(new object[] { Convert.ToInt32(score.SchYear) - 1, "-", score.SchYear, "学年第二学期" });
                }
                string str = item.ExamTypeCode.ToString();
                if (!string.IsNullOrEmpty(str))
                {
                    string str2 = str;
                    if (str2 != "0")
                    {
                        if (str2 == "1")
                        {
                            goto Label_0403;
                        }
                        if (str2 == "2")
                        {
                            goto Label_040C;
                        }
                        if (str2 == "9")
                        {
                            goto Label_0415;
                        }
                    }
                    else
                    {
                        str = "平时测试";
                    }
                }
                goto Label_041F;
Label_0403:
                str = "期中考试";
                goto Label_041F;
Label_040C:
                str = "期末考试";
                goto Label_041F;
Label_0415:
                str = "其他考试";
Label_041F:
                item.ExamType = str;
                item.KCMC     = score.KCMC;
                list2.Add(item);
            }
            //if (list2.Count == 0)
            //{
            //    list2.Add(new StudentInformation.StudentScores());
            //}
            return(list2);
        }