コード例 #1
0
        public JsonResult PostFirstInterviewRegTPForm(FirstInterviewRegModel ajaxData)
        {
            if (ajaxData == null || ajaxData.StudentInfo == null)
            {
                return(Json(false));
            }

            StudentTPInfoEntity studentTPInfo = ajaxData.StudentTPInfo;
            StudentInfoEntity   studentInfo   = repository.StudentInfo.SingleOrDefault(s => s.StudentID == ajaxData.StudentInfo.StudentID);
            AppRelationsEntity  appRelation   = repository.AppRelation.SingleOrDefault(a => a.StudentID == studentInfo.StudentID);

            studentInfo.EducationIntention = ajaxData.StudentInfo.EducationIntention;

            studentInfoRepository.SaveStudentTPInfo(studentTPInfo);
            studentInfoRepository.SaveStudentInfo(studentInfo, appRelation);

            ExamResultEntity        _TFIELTSResult       = ajaxData.TFIELTSResult;
            ExamResultTFIELTSEntity _TFIELTSResultDetail = ajaxData.TFIELTSResultDetail;

            if ((_TFIELTSResult.ExamType == ExamType.TOFEL || _TFIELTSResult.ExamType == ExamType.IELTS))
            {
                repository.SaveExamResult(_TFIELTSResult);
                if (_TFIELTSResultDetail.ExamID != _TFIELTSResult.ExamID)
                {
                    _TFIELTSResultDetail.ExamID = _TFIELTSResult.ExamID = Guid.NewGuid();
                }
                repository.SaveExamResultTFIELTS(_TFIELTSResultDetail);
            }

            EducationIntention eduIntention = studentInfo.EducationIntention;

            switch (eduIntention)
            {
            case EducationIntention.高中:
            {
                ajaxData.SATSSATResult.ExamType = ExamType.SSAT;
                SaveSSATResult(ajaxData.SATSSATResult, ajaxData.SATSSATResultDetail);
                break;
            }

            case EducationIntention.本科:
            {
                ajaxData.SATSSATResult.ExamType = ExamType.SAT;
                repository.SaveExamResult(ajaxData.SAT2Result);
                SaveSATResult(ajaxData.SATSSATResult, ajaxData.SATSSATResultDetail);
                break;
            }

            case EducationIntention.研究生:
                SaveGreGmatResult(ajaxData.GREGMATResult, ajaxData.GREGMATResultDetail);
                break;

            default:
                break;
            }

            return(Json(true));
        }
コード例 #2
0
        /// <summary>
        /// 根据学生ID返回课程信息TPInfo
        /// </summary>
        /// <param name="studentID"></param>
        /// <returns></returns>
        StudentTPInfoEntity GetStudentTP(Guid studentID)
        {
            StudentTPInfoEntity tpInfo = repository.StudentTPInfo.SingleOrDefault(s => s.StudentID == studentID);

            if (tpInfo == null)
            {
                tpInfo = new StudentTPInfoEntity {
                    StudentID = studentID
                };
                return(tpInfo);
            }
            else
            {
                return(tpInfo);
            }
        }
コード例 #3
0
        public void SaveStudentTPInfo(StudentTPInfoEntity studentTPInfo)
        {
            if (studentTPInfo.StudentID == Guid.Empty || context.StudentsInfo.SingleOrDefault(s => s.StudentID == studentTPInfo.StudentID) == null)
            {
                throw new Exception("不存在相关联的学生,StudentID为空或无该ID");
            }
            StudentTPInfoEntity originTPInfo = context.StudentTPInfo.SingleOrDefault(s => s.StudentID == studentTPInfo.StudentID);

            if (originTPInfo == null)
            {
                context.StudentTPInfo.Add(studentTPInfo);
            }
            else
            {
                context.Entry(originTPInfo).CurrentValues.SetValues(studentTPInfo);
            }
            context.SaveChanges();
        }
コード例 #4
0
        /// <summary>
        /// 根据学生ID获取初访数据
        /// </summary>
        /// <param name="studentID">学生ID</param>
        /// <returns></returns>
        public JsonResult GetFirstInterviewRegData(string studentID)
        {
            if (studentID == null || studentID == string.Empty)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
            Guid id = new Guid(studentID);
            StudentInfoEntity      studentInfo  = repository.StudentInfo.SingleOrDefault(s => s.StudentID == id);
            AppRelationsEntity     appRelation  = repository.AppRelation.SingleOrDefault(a => a.StudentID == id);
            StudentTPInfoEntity    studentTP    = GetStudentTP(id);
            ExamResultTFIELTSModel tfIELTSModel = GetTFIELTSExamResult(id);
            ExamResultSATSSATModel satSSATModel = GetSATSSATExamResult(id);
            ExamResultEntity       sat2Model    = GetSAT2ExamResult(id);
            ExamResultGREGMATModel greGmatModel = GetGREGMATExamResult(id);
            ExamResultEntity       apModel      = GetAPResult(id);
            IEnumerable <StudentSourceItemEntity> studentSourceList     = GetStudentSourceList();
            IEnumerable <StudentFromEntity>       studentFromList       = GetStudentFromList(id);
            IEnumerable <StudentFlashPointEntity> studentFlashPointList = GetFlashPointList(id);

            FirstInterviewRegModel firstInterviewRegMode = new FirstInterviewRegModel
            {
                StudentInfo           = studentInfo,
                AppRelation           = appRelation,
                StudentTPInfo         = studentTP,
                TFIELTSResult         = tfIELTSModel.ExamResult,
                TFIELTSResultDetail   = tfIELTSModel.ExamResultDetail,
                SATSSATResult         = satSSATModel.ExamResult,
                SATSSATResultDetail   = satSSATModel.ExamResultDetail,
                SAT2Result            = sat2Model,
                GREGMATResult         = greGmatModel.ExamResult,
                GREGMATResultDetail   = greGmatModel.ExamResultDetail,
                APResult              = apModel,
                StudentSourceList     = studentSourceList,
                StudentFromList       = studentFromList,
                StudentFlashPointList = studentFlashPointList
            };

            return(Json(firstInterviewRegMode, JsonRequestBehavior.AllowGet));
        }
コード例 #5
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));
        }
コード例 #6
0
        public JsonResult FirstRegTPInfo(FirstInterviewTPModel ajaxData)
        {
            StudentInfoEntity studentInfo = repository.StudentsInfo.SingleOrDefault(s => s.StudentID == ajaxData.StudentInfo.StudentID);

            StudentTPInfoEntity studentTPInfo = ajaxData.StudentTPInfo;

            studentTPInfo.StudentID = studentInfo.StudentID;
            repository.SaveStudentTPInfo(studentTPInfo);


            ExamResultEntity _TFIELTSResult = ajaxData.TFIELTSResult;

            if (_TFIELTSResult != null)
            {
                if (_TFIELTSResult.ResultID == Guid.Empty)
                {
                    _TFIELTSResult.ResultID = Guid.NewGuid();
                }
                _TFIELTSResult.StudentID = studentInfo.StudentID;
                repository.SaveExamResult(_TFIELTSResult);
            }


            ExamResultEntity        _SATSSATResult       = ajaxData.SATSSATResult;
            ExamResultSATSSATEntity _SATSSATResultDetail = ajaxData.SATSSATResultDetail;

            if (_SATSSATResult != null)
            {
                if (_SATSSATResultDetail != null)
                {
                    if (_SATSSATResultDetail.ExamID == Guid.Empty)
                    {
                        _SATSSATResultDetail.ExamID = Guid.NewGuid();
                    }

                    repository.SaveExamResultSATSSAT(_SATSSATResultDetail);

                    _SATSSATResult.ExamID = _SATSSATResultDetail.ExamID;
                }
                else
                {
                    _SATSSATResult.ExamID = Guid.Empty;
                }

                if (_SATSSATResult.ResultID == Guid.Empty)
                {
                    _SATSSATResult.ResultID = Guid.NewGuid();
                }

                _SATSSATResult.StudentID = studentInfo.StudentID;
                repository.SaveExamResult(_SATSSATResult);
            }

            ExamResultEntity _SAT2Result = ajaxData.SAT2Result;

            if (_SAT2Result != null)
            {
                if (_SAT2Result.ResultID == Guid.Empty)
                {
                    _SAT2Result.ResultID = Guid.NewGuid();
                }
                _SAT2Result.StudentID = studentInfo.StudentID;
                repository.SaveExamResult(_SAT2Result);
            }

            return(Json(new
            {
                TPInfo = true,
                StudentId = studentInfo.StudentID
            }));
        }