Beispiel #1
0
        ExamResultGREGMATModel GetGREGMATExamResult(Guid studentID)
        {
            //从数据库中根据StudentID、ExamDate、ExamType 选择考试条目
            ExamResultEntity examResult = repository.ExamResult
                                          .FirstOrDefault(e => e.StudentID == studentID && e.IsBeforeSign == true && (e.ExamType == ExamType.GMAT || e.ExamType == ExamType.GRE));

            if (examResult == null)
            {
                examResult = new ExamResultEntity
                {
                    ResultID     = Guid.NewGuid(),
                    StudentID    = studentID,
                    ExamID       = Guid.NewGuid(),
                    IsBeforeSign = true,
                    ExamType     = ExamType.GRE
                };
            }
            ExamResultGREGMATEntity examResultDetail = repository.ExamResultGREGMAT.SingleOrDefault(e => e.ExamID == examResult.ExamID);

            if (examResultDetail == null)
            {
                examResultDetail = new ExamResultGREGMATEntity
                {
                    ExamID = examResult.ExamID,
                    Total  = examResult.Total
                };
            }
            return(new ExamResultGREGMATModel
            {
                ExamResult = examResult,
                ExamResultDetail = examResultDetail
            });
        }
Beispiel #2
0
        public void SaveExamResultGREGMAT(ExamResultGREGMATEntity greGMATDetail)
        {
            ExamResultGREGMATEntity originDetail = context.ExamResult_GRE_GMAT.SingleOrDefault(e => e.ExamID == greGMATDetail.ExamID);

            if (originDetail == null)
            {
                if (greGMATDetail.Total > 0)
                {
                    context.ExamResult_GRE_GMAT.Add(greGMATDetail);
                }
                else
                {
                    return;
                }
            }
            else
            {
                if (greGMATDetail.Total > 0)
                {
                    context.Entry(originDetail).CurrentValues.SetValues(greGMATDetail);
                }
                else
                {
                    context.ExamResult_GRE_GMAT.Remove(originDetail);
                }
            }
            context.SaveChanges();
        }
Beispiel #3
0
 void SaveGreGmatResult(ExamResultEntity greGmatResult, ExamResultGREGMATEntity greGmatResultDetail)
 {
     if (greGmatResult.ExamType == ExamType.GRE || greGmatResult.ExamType == ExamType.GMAT)
     {
         repository.SaveExamResult(greGmatResult);
         if (greGmatResultDetail.ExamID != greGmatResult.ExamID)
         {
             greGmatResultDetail.ExamID = greGmatResult.ExamID = Guid.NewGuid();
         }
         repository.SaveExamResultGREGMAT(greGmatResultDetail);
         return;
     }
     else
     {
         return;
     }
 }
Beispiel #4
0
        public void SaveExamResultGREGMAT(ExamResultGREGMATEntity greGMATDetail)
        {
            if (greGMATDetail.ExamID == Guid.Empty)
            {
                greGMATDetail.ExamID = Guid.NewGuid();
            }
            ExamResultGREGMATEntity originDetail = context.ExamResult_GRE_GMAT.SingleOrDefault(e => e.ExamID == greGMATDetail.ExamID);

            if (originDetail == null)
            {
                context.ExamResult_GRE_GMAT.Add(greGMATDetail);
            }
            else
            {
                context.Entry(originDetail).CurrentValues.SetValues(greGMATDetail);
            }
            context.SaveChanges();
        }