コード例 #1
0
        public JsonResult Create(StudentCreateModel ajaxData)
        {
            StudentInfoEntity studentInfo = ajaxData.StudentInfo;
            studentInfo.StudentID = Guid.NewGuid();

            AppRelationsEntity appRelation = ajaxData.AppRelation;
            appRelation.SignDate = new DateTime(1990, 1, 1);
            appRelation.StudentID = studentInfo.StudentID;

            if (ajaxData.ContactStudent != null)
            {
                studentInfo.Mobile = ajaxData.ContactStudent.ContactIdentity.Mobile;
                studentInfo.Email = ajaxData.ContactStudent.ContactIdentity.Email;
            }
            repository.SaveStudentInfo(studentInfo, appRelation);   //保存StudentInfo以及AppRelation信息

            if (ajaxData.ContactStudent!=null)
            {
                foreach (EasyChatTimeEntity item in ajaxData.ContactStudent.EasyChatTimes)
                {
                    item.IfStudentID = studentInfo.StudentID;
                    repository.SaveEasyChatTime(item);      //保存方便联系时间
                }
            }

            if (ajaxData.ContactFather != null)
            {
                AddParentAndChattime(ajaxData.ContactFather, studentInfo.StudentID);
            }
            if (ajaxData.ContactMother != null)
            {
                AddParentAndChattime(ajaxData.ContactMother, studentInfo.StudentID);
            }
            if (ajaxData.ContactOther != null)
            {
                AddParentAndChattime(ajaxData.ContactOther, studentInfo.StudentID);
            }

            return Json(new { CreateReslut = true,StudentID = studentInfo.StudentID});
        }
コード例 #2
0
        public JsonResult FirstRegFormInfo(StudentCreateModel ajaxData)
        {
            StudentInfoEntity studentInfo = ajaxData.StudentInfo;
            AppRelationsEntity appRelation = repository.AppRelations.SingleOrDefault(a => a.StudentID == studentInfo.StudentID);

            StudentParentEntity parent = null;

            if (ajaxData.ContactStudent != null)
            {
                studentInfo.Mobile = ajaxData.ContactStudent.ContactIdentity.Mobile;
                studentInfo.Email = ajaxData.ContactStudent.ContactIdentity.Email;
            }
            repository.SaveStudentInfo(studentInfo, appRelation);   //保存StudentInfo以及AppRelation信息

            if (ajaxData.ContactStudent.EasyChatTimes != null)
            {
                foreach (EasyChatTimeEntity item in ajaxData.ContactStudent.EasyChatTimes)
                {
                    item.IfStudentID = studentInfo.StudentID;
                    repository.SaveEasyChatTime(item);      //保存方便联系时间
                }
            }

            if (ajaxData.ContactFather != null)
            {
                parent = repository.StudentParent.SingleOrDefault(s => s.StudentID == studentInfo.StudentID && s.PersonIdentity == PersonIdentity.父亲);
                if (parent != null)
                {
                    parent.NameCn = ajaxData.ContactFather.ContactIdentity.NameCn;
                    parent.Mobile = ajaxData.ContactFather.ContactIdentity.Mobile;
                    parent.Email = ajaxData.ContactFather.ContactIdentity.Email;
                    repository.SaveStudentParent(parent);
                    if (ajaxData.ContactFather.EasyChatTimes != null)
                    {
                        foreach (EasyChatTimeEntity item in ajaxData.ContactFather.EasyChatTimes)
                        {
                            item.IfParentID = parent.ParentID;
                            repository.SaveEasyChatTime(item);  //添加EasyChatTime信息
                        }
                    }
                }
                else
                {
                    AddParentAndChattime(ajaxData.ContactFather, studentInfo.StudentID);
                }
            }
            if (ajaxData.ContactMother != null)
            {
                parent = repository.StudentParent.SingleOrDefault(s => s.StudentID == studentInfo.StudentID && s.PersonIdentity == PersonIdentity.母亲);
                if (parent != null)
                {
                    parent.NameCn = ajaxData.ContactMother.ContactIdentity.NameCn;
                    parent.Mobile = ajaxData.ContactMother.ContactIdentity.Mobile;
                    parent.Email = ajaxData.ContactMother.ContactIdentity.Email;
                    repository.SaveStudentParent(parent);
                    if (ajaxData.ContactMother.EasyChatTimes != null)
                    {
                        foreach (EasyChatTimeEntity item in ajaxData.ContactMother.EasyChatTimes)
                        {
                            item.IfParentID = parent.ParentID;
                            repository.SaveEasyChatTime(item);  //添加EasyChatTime信息
                        }
                    }
                }
                else
                {
                    AddParentAndChattime(ajaxData.ContactMother, studentInfo.StudentID);
                }
            }
            if (ajaxData.ContactOther != null)
            {
                parent = repository.StudentParent.SingleOrDefault(s => s.StudentID == studentInfo.StudentID && s.PersonIdentity == PersonIdentity.其他);
                if (parent != null)
                {
                    parent.NameCn = ajaxData.ContactOther.ContactIdentity.NameCn;
                    parent.Mobile = ajaxData.ContactOther.ContactIdentity.Mobile;
                    parent.Email = ajaxData.ContactOther.ContactIdentity.Email;
                    repository.SaveStudentParent(parent);
                    if (ajaxData.ContactOther.EasyChatTimes != null)
                    {
                        foreach (EasyChatTimeEntity item in ajaxData.ContactOther.EasyChatTimes)
                        {
                            item.IfParentID = parent.ParentID;
                            repository.SaveEasyChatTime(item);  //添加EasyChatTime信息
                        }
                    }
                }
                else
                {
                    AddParentAndChattime(ajaxData.ContactOther, studentInfo.StudentID);
                }
            }

            return Json(new { InfoResult = true,StudentID = studentInfo.StudentID });
        }
コード例 #3
0
        /// <summary>
        /// 渲染初访登记表——学生信息与联系时间
        /// </summary>
        /// <param name="id">学生ID</param>
        /// <returns></returns>
        public ViewResult FirstRegFormInfo(Guid id)
        {
            StudentInfoEntity studentInfo = repository.StudentInfo.SingleOrDefault(s => s.StudentID == id);
            if (studentInfo.NationIntention == null)
                studentInfo.NationIntention = string.Empty;

            StudentCreateModel regFromInfo = new StudentCreateModel
            {
                StudentInfo = studentInfo,
                AppRelation = repository.AppRelation.SingleOrDefault(a=>a.StudentID == studentInfo.StudentID)
            };

            StudentParentEntity father = repository.StudentParent.SingleOrDefault(s => s.StudentID == id && s.PersonIdentity == PersonIdentity.父亲);
            StudentParentEntity mother = repository.StudentParent.SingleOrDefault(s => s.StudentID == id && s.PersonIdentity == PersonIdentity.母亲);
            StudentParentEntity other = repository.StudentParent.SingleOrDefault(s => s.StudentID == id && s.PersonIdentity == PersonIdentity.其他);

            EasyChatTimeModel contactFather = null;
            EasyChatTimeModel contactMother = null;
            EasyChatTimeModel contactOther = null;
            EasyChatTimeModel contactStudent = null;

            if (studentInfo != null)
            {
                contactStudent = ReturnEasyChatTimeModel(PersonIdentity.学生, studentInfo.NameCn, studentInfo.Email, studentInfo.Mobile, studentInfo.StudentID);
                regFromInfo.ContactStudent = contactStudent;
            }
            if (father != null)
            {
                contactFather = ReturnEasyChatTimeModel(father.PersonIdentity, father.NameCn, father.Email, father.Mobile, father.ParentID);
                regFromInfo.ContactFather = contactFather;
            }
            if (mother != null)
            {
                contactMother = ReturnEasyChatTimeModel(mother.PersonIdentity, mother.NameCn, mother.Email, mother.Mobile, mother.ParentID);
                regFromInfo.ContactMother = contactMother;
            }
            if (other != null)
            {
                contactOther = ReturnEasyChatTimeModel(other.PersonIdentity, other.NameCn, other.Email, other.Mobile, other.ParentID);
                regFromInfo.ContactOther = contactOther;
            }

            return View(regFromInfo);
        }