Exemplo n.º 1
0
        /// <summary>
        /// 渲染初访登记表——学生的培训、课程、考试信息
        /// </summary>
        /// <param name="id">学生ID</param>
        /// <returns></returns>
        public ViewResult FirstRegFormTP(string id)
        {
            Guid studentID = new Guid(id);
            StudentInfoEntity studentInfo = repository.StudentInfo.SingleOrDefault(s => s.StudentID == studentID);

            StudentTPInfoEntity studentTPInfo = null;
            if (repository.StudentTPInfo.SingleOrDefault(s => s.StudentID == studentID) != null)
            {
                studentTPInfo = repository.StudentTPInfo.SingleOrDefault(s => s.StudentID == studentID);
            }
            else
                studentTPInfo = new StudentTPInfoEntity { StudentID = studentID };

            ExamResultEntity tfIELTSResult = null;
            if(repository.ExamResult.FirstOrDefault(e=>e.StudentID == studentID && (e.ExamType == ExamType.TOFEL || e.ExamType == ExamType.IELTS)) != null)
                tfIELTSResult = repository.ExamResult.FirstOrDefault(e=>e.StudentID == studentID && (e.ExamType == ExamType.TOFEL || e.ExamType == ExamType.IELTS));
            else
                tfIELTSResult = new ExamResultEntity{ExamType = Domain.Enum.ExamType.TOFEL,StudentID = studentID,ExamID = Guid.NewGuid()};

            ExamResultEntity sATSSATResult = null;
            ExamResultSATSSATEntity sATSSATResultDetail = null;
            if (repository.ExamResult.FirstOrDefault(e => e.StudentID == studentID && (e.ExamType == ExamType.SAT || e.ExamType == ExamType.SSAT)) != null)
            {
                sATSSATResult = repository.ExamResult.FirstOrDefault(e => e.StudentID == studentID && (e.ExamType == ExamType.SAT || e.ExamType == ExamType.SSAT));
                if (repository.ExamResultSATSSAT.SingleOrDefault(e => e.ExamID == sATSSATResult.ExamID) != null)
                {
                    sATSSATResultDetail = repository.ExamResultSATSSAT.SingleOrDefault(e => e.ExamID == sATSSATResult.ExamID);
                }
                else
                {
                    sATSSATResultDetail = new ExamResultSATSSATEntity { ExamID = Guid.NewGuid() };
                }
            }
            else
            {
                Guid detailId = Guid.NewGuid();
                sATSSATResult = new ExamResultEntity { ExamType = Domain.Enum.ExamType.SAT,StudentID = studentID,ResultID=Guid.NewGuid(),ExamID=detailId};
                sATSSATResultDetail = new ExamResultSATSSATEntity { ExamID = detailId };
            }

            ExamResultEntity sAT2Result = null;
            if (repository.ExamResult.FirstOrDefault(e => e.StudentID == studentID && e.ExamType == ExamType.SAT2) != null)
            {
                sAT2Result = repository.ExamResult.FirstOrDefault(e => e.StudentID == studentID && e.ExamType == ExamType.SAT2);
            }
            else
                sAT2Result = new ExamResultEntity { ExamType = Domain.Enum.ExamType.SAT2, StudentID = studentID };

            FirstInterviewTPModel tpModel = new FirstInterviewTPModel
            {
                StudentInfo=studentInfo,
                StudentTPInfo = studentTPInfo,
                TFIELTSResult = tfIELTSResult,
                TFIELTSResultDetail = new ExamResultTFIELTSEntity(),
                SATSSATResult = sATSSATResult,
                SATSSATResultDetail = sATSSATResultDetail,
                SAT2Result = sAT2Result
            };
            return View(tpModel);
        }
Exemplo n.º 2
0
 public void SaveExamResult(ExamResultEntity examResult)
 {
     if (examResult.ResultID == Guid.Empty)
         examResult.ResultID = Guid.NewGuid();
     ExamResultEntity originResult = context.ExamResult.SingleOrDefault(e => e.ResultID == examResult.ResultID);
     if (originResult == null)
     {
         context.ExamResult.Add(examResult);
     }
     else
     {
         context.Entry(originResult).CurrentValues.SetValues(examResult);
     }
     context.SaveChanges();
 }
Exemplo n.º 3
0
 void SaveSSATResult(ExamResultEntity ssatResult, ExamResultSATSSATEntity ssatResultDetail)
 {
     repository.SaveExamResult(ssatResult);
     if (ssatResultDetail.ExamID != ssatResult.ExamID)
     {
         ssatResultDetail.ExamID = ssatResult.ExamID = Guid.NewGuid();
     }
     repository.SaveExamResultSATSSAT(ssatResultDetail);
 }
Exemplo n.º 4
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;
 }
Exemplo n.º 5
0
 ExamResultTFIELTSModel GetTFIELTSExamResult(Guid studentID)
 {
     //从数据库中根据StudentID、ExamDate、ExamType 选择考试条目
     ExamResultEntity examResult = repository.ExamResult
         .FirstOrDefault(e => e.StudentID == studentID && e.IsBeforeSign == true && (e.ExamType == ExamType.TOFEL || e.ExamType == ExamType.IELTS));
     if (examResult == null)
     {
         examResult = new ExamResultEntity
         {
             ResultID = Guid.NewGuid(),
             StudentID = studentID,
             ExamID = Guid.NewGuid(),
             IsBeforeSign = true,
             ExamType = ExamType.TOFEL
         };
     }
     ExamResultTFIELTSEntity examResultDetail = repository.ExamResultTFIELTS.SingleOrDefault(e => e.ExamID == examResult.ExamID);
     if (examResultDetail == null)
     {
         examResultDetail = new ExamResultTFIELTSEntity {
             ExamID = examResult.ExamID,
             Total = examResult.Total
         };
     }
     return new ExamResultTFIELTSModel
     {
         ExamResult = examResult,
         ExamResultDetail = examResultDetail
     };
 }
Exemplo n.º 6
0
 ExamResultEntity GetSAT2ExamResult(Guid studentID)
 {
     //从数据库中根据StudentID、ExamDate、ExamType 选择考试条目
     ExamResultEntity examResult = repository.ExamResult
         .FirstOrDefault(e => e.StudentID == studentID && e.IsBeforeSign == true && e.ExamType == ExamType.SAT2);
     if (examResult == null)
     {
         examResult = new ExamResultEntity
         {
             ResultID = Guid.NewGuid(),
             StudentID = studentID,
             ExamID = Guid.NewGuid(),
             IsBeforeSign = true,
             ExamType = ExamType.SAT2
         };
     }
     return examResult;
 }
Exemplo n.º 7
0
 public void SaveExamResult(ExamResultEntity examResult)
 {
     ExamResultEntity originResult = context.ExamResult.SingleOrDefault(e => e.ResultID == examResult.ResultID);
     if (originResult == null)
     {
         if (examResult.Total > 0)
         {
             context.ExamResult.Add(examResult);
         }
         else
         {
             return;
         }
     }
     else
     {
         if (examResult.Total > 0)
         {
             context.Entry(originResult).CurrentValues.SetValues(examResult);
         }
         else
         {
             context.ExamResult.Remove(originResult);
         }
     }
     context.SaveChanges();
 }