Example #1
0
        /// <summary>
        /// 修改学生信息
        /// <para>作     者:Huang GaoLiang </para>
        /// <para>创建时间: 2019-03-14 </para>
        /// </summary>
        /// <param name="studentId">学生编号</param>
        /// <param name="request">修改输入参数</param>
        /// <returns>返回修改结果受影响的行数</returns>
        /// <exception>
        /// 异常ID:1,系统不存在该学生
        /// </exception>
        public static void Modify(long studentId, StudentRegisterRequest request)
        {
            TblCstStudentContactRepository contactRepository = new TblCstStudentContactRepository();
            TblCstStudentRepository        studentRepository = new TblCstStudentRepository();
            // 1、根据编号查询学生信息
            TblCstStudent rawStudent = studentRepository.GetCstStudentId(studentId);     //原学生信息

            if (rawStudent == null)
            {
                throw new BussinessException((byte)ModelType.Customer, 1);
            }
            List <TblCstStudentContact> rawContacts = contactRepository.GetByStudentId(studentId);              //原学生联系人
            TblCstStudent newStudent = TransExpV2 <TblCstStudent, TblCstStudent> .Trans(rawStudent);            //新学生


            // 2、验证
            Verification(studentId, request.StudentName, request.LinkMobile);

            // 3、学生信息和学生联系人信息
            List <TblCstStudentContact> newContacts = GetStudentContact(newStudent.StudentId, JsonConvert.SerializeObject(request.ContactPerson));

            SetStudentInfo(request, newStudent);


            //4、数据存储操作
            studentRepository.Update(newStudent);                                          //更新学生信息
            contactRepository.DeleteByStudentId(new List <long> {
                newStudent.StudentId
            });                                                                            //删除原来的学生联系人
            contactRepository.Add(newContacts);                                            //添加学生联系人


            // 5、推送学生至档案库
            StudentRequest s = GetStudentToAC(rawStudent);

            new ACService().StudentInfoToArtLibrary(s);


            // 6、记录操作日志
            AddOperationLog(rawStudent, newStudent, request);

            // 7、将手机号信息推送至家校互联账户
            StudentPublish(rawStudent, newStudent, rawContacts, newContacts);
        }