Exemple #1
0
        /// <summary>
        /// 添加老师
        /// </summary>
        public ServiceInvokeDTO AddTeacher(Teacher teacher)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                // Check user name
                Teacher dbTeacher = teacherDAL.GetByUserName(teacher.UserName);
                if (dbTeacher == null)
                {
                    teacher.Password = SecurityUtil.MD5(teacher.Password + Constant.TEACHER_SALT_KEY);
                    teacherDAL.Insert(teacher);
                    result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
                }
                else
                {
                    result = new ServiceInvokeDTO(InvokeCode.ACCOUNT_TEACHER_ACCOUNT_EXIST_ERROR);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #2
0
        /// <summary>
        /// 删除老师
        /// </summary>
        public ServiceInvokeDTO DeleteTeacher(int teacherID)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                Teacher dbTeacher = teacherDAL.GetByID(teacherID);
                if (dbTeacher != null)
                {
                    // 系统管理员账号检测
                    if (dbTeacher.Level == TeacherLevel.SystemAdmin)
                    {
                        result = new ServiceInvokeDTO(InvokeCode.ACCOUNT_SYSTEM_ADMIN_NOT_DELETE_ERROR);
                    }
                    else
                    {
                        teacherDAL.DeleteByID(teacherID);
                        result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
                    }
                }
                else
                {
                    result = new ServiceInvokeDTO(InvokeCode.SYS_OBJECT_NOT_EXIST_ERROR);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #3
0
        public ActionResult AddTeacher()
        {
            log.Debug(Constant.DEBUG_START);

            string chineseName = ApiQueryUtil.QueryArgByPost("chinese_name");
            string userName = ApiQueryUtil.QueryArgByPost("user_name");
            string password = ApiQueryUtil.QueryArgByPost("password");
            string isCanMarkPaperString = ApiQueryUtil.QueryArgByPost("is_can_mark_paper");

            ServiceInvokeDTO result = null;
            try
            {
                Teacher teacher = new Teacher();
                teacher.ChineseName = chineseName;
                teacher.UserName = userName;
                teacher.Password = password;
                teacher.Level = TeacherLevel.ItemAdmin;
                teacher.IsCanMarkPaper = Convert.ToInt32(isCanMarkPaperString);

                result = accountDataService.AddTeacher(teacher);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                result = new ServiceInvokeDTO(InvokeCode.SYS_INNER_ERROR);
            }

            string json = JsonConvert.SerializeObject(result, Formatting.Indented, Constant.TIME_CONVERTER);
            log.Debug(Constant.DEBUG_END);

            return Content(json, Constant.JSON_MIME_TYPE);
        }
Exemple #4
0
        /// <summary>
        /// 添加用户意见反馈记录
        /// </summary>
        public ServiceInvokeDTO AddFeedBackRecord(FeedbackRecord feedback)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;

            try
            {
                // 验证参数
                FeedbackValidator validator = new FeedbackValidator();
                ValidationResult validatorResult = validator.Validate(feedback);
                if (validatorResult.IsValid)
                {
                    feedBackDAL.Insert(feedback);
                    result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
                }
                else
                {
                    result = new ServiceInvokeDTO(InvokeCode.SYS_ARG_ERROR);
                    log.Error(string.Format(Constant.DEBUG_ARG_ERROR_FORMATER, validatorResult.Errors[0].ErrorMessage));
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #5
0
        /// <summary>
        /// 添加机构管理员
        /// </summary>
        public ServiceInvokeDTO AddAdmin(AgencyAdmin admin)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                AgencyAdmin dbAdmin = agencyAdminDAL.GetByPhone(admin.Phone);
                if (dbAdmin == null)
                {
                    admin.Password = SecurityUtil.MD5(SecurityUtil.MD5(admin.Phone) + Constant.ADMIN_SALT_KEY);
                    agencyAdminDAL.Insert(admin);
                    result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
                }
                else
                {
                    result = new ServiceInvokeDTO(InvokeCode.ACCOUNT_ADMIN_PHONE_EXIST_ERROR);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #6
0
        /// <summary>
        /// 检测验证码是否正确
        /// </summary>
        public ServiceInvokeDTO CheckCaptcha(CaptchaCodeType type, string phone, string code)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                string dbCode = captchaRecordDAL.GetCode(type, phone, Config.CaptchaExpireTime);
                if (!string.IsNullOrEmpty(dbCode) && dbCode.Equals(code))
                {
                    result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
                }
                else
                {
                    result = new ServiceInvokeDTO(InvokeCode.SYS_CAPTCHA_ERROR);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #7
0
        /// <summary>
        /// 添加章节
        /// </summary>
        public ServiceInvokeDTO AddChapter(Chapter chapter)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                // 检测章节名称是否存在
                Chapter dbChapter = chapterDAL.GetByName(chapter.CourseID, chapter.Name);
                if (dbChapter == null)
                {
                    // 叠加章节序号
                    chapter.ChapterIndex = chapterDAL.GetLastChapterIndex(chapter.CourseID) + 1;

                    chapterDAL.Insert(chapter);
                    result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
                }
                else
                {
                    result = new ServiceInvokeDTO(InvokeCode.ITEM_CHAPTER_NAME_EXIST_ERROR);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #8
0
        /// <summary>
        /// 添加学生用户
        /// </summary>
        public ServiceInvokeDTO AddUser(User user)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                // 检测电话号码
                User dbUserWithPhone = userDAL.GetByPhone(user.Phone);
                if (dbUserWithPhone == null)
                {
                    user.Password = SecurityUtil.MD5(SecurityUtil.MD5(user.Phone) + Constant.USER_SALT_KEY);
                    userDAL.Insert(user);
                    result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
                }
                else
                {
                    result = new ServiceInvokeDTO(InvokeCode.ACCOUNT_USER_PHONE_EXIST_ERROR);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #9
0
        /// <summary>
        /// 根据主键ID获取试卷信息
        /// </summary>
        public ServiceInvokeDTO<Paper> GetPaperByID(int id)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO<Paper> result = null;
            try
            {
                Paper paper = paperDAL.GetByID(id);
                result = new ServiceInvokeDTO<Paper>(InvokeCode.SYS_INVOKE_SUCCESS, paper);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #10
0
        /// <summary>
        /// 添加分录题
        /// </summary>
        public ServiceInvokeDTO AddFenLu(FenLuItem fenlu, List<FenLuAnswer> answers)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                fenluDAL.Insert(fenlu, answers);
                result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #11
0
        /// <summary>
        /// 添加管理员操作记录
        /// </summary>
        public ServiceInvokeDTO AddAdminDoRecord(AdminDoRecord doRecord)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                adminDoRecordDAL.Insert(doRecord);
                result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
            }
            catch (Exception ex)
            {
                // 记录异常但不抛出
                log.Error(ex);
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #12
0
        /// <summary>
        /// 添加填空题
        /// </summary>
        public ServiceInvokeDTO AddBlank(BlankItem blank, List<BlankAnswer> answers)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                blankDAL.Insert(blank, answers);
                result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #13
0
        /// <summary>
        /// 添加学生用户(批量添加)
        /// </summary>
        public ServiceInvokeDTO AddUser(List<User> users)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                // 检测电话号码
                bool isPhoneExist = false;
                foreach (var user in users)
                {
                    User dbUserWithPhone = userDAL.GetByPhone(user.Phone);
                    if (dbUserWithPhone != null)
                    {
                        isPhoneExist = true;
                        break;
                    }

                    // 撒盐加密
                    user.Password = SecurityUtil.MD5(SecurityUtil.MD5(user.Phone) + Constant.USER_SALT_KEY);
                }

                if (!isPhoneExist)
                {
                    userDAL.Insert(users);
                    result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
                }
                else
                {
                    result = new ServiceInvokeDTO(InvokeCode.ACCOUNT_USER_PHONE_EXIST_ERROR);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #14
0
        /// <summary>
        /// 删除不定项选择题子选择题
        /// </summary>
        public ServiceInvokeDTO DeleteUncertainSubChoice(int id)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {

                UncertainSubChoice dbSubChoice = uncertainSubChoiceDAL.GetByID(id);
                if (dbSubChoice != null)
                {
                    uncertainSubChoiceDAL.DeleteByID(id);
                    result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
                }
                else
                {
                    result = new ServiceInvokeDTO(InvokeCode.SYS_OBJECT_NOT_EXIST_ERROR);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #15
0
        /// <summary>
        /// 删除数字填空题
        /// </summary>
        public ServiceInvokeDTO DeleteNumberBlank(int id)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                NumberBlankItem dbNumberBlank = numberBlankDAL.GetByID(id);
                if (dbNumberBlank != null)
                {
                    numberBlankDAL.DeleteByID(id);
                    result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
                }
                else
                {
                    result = new ServiceInvokeDTO(InvokeCode.SYS_OBJECT_NOT_EXIST_ERROR);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #16
0
        /// <summary>
        /// 删除章节
        /// </summary>
        public ServiceInvokeDTO DeleteChapter(int id)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                Chapter dbChapter = chapterDAL.GetByID(id);
                if (dbChapter != null)
                {
                    chapterDAL.DeleteByID(id);
                    result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
                }
                else
                {
                    result = new ServiceInvokeDTO(InvokeCode.SYS_OBJECT_NOT_EXIST_ERROR);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #17
0
        /// <summary>
        /// 根据主键ID获取判断题
        /// </summary>
        public ServiceInvokeDTO<JudgeItemDTO> GetJudgeByID(int id)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO<JudgeItemDTO> result = null;
            try
            {
                JudgeItemDTO judgeDTO = null;

                // --> DTO
                JudgeItem judge = judgeDAL.GetByID(id);
                if (judge != null)
                {
                    judgeDTO = new JudgeItemDTO(judge);
                    judgeDTO.ChapterName = chapterDAL.GetByID(judge.ChapterID).Name;
                }
                result = new ServiceInvokeDTO<JudgeItemDTO>(InvokeCode.SYS_INVOKE_SUCCESS, judgeDTO);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #18
0
        /// <summary>
        /// 根据主键ID获取分录题
        /// </summary>
        public ServiceInvokeDTO<FenLuItemDTO> GetFenLuByID(int id)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO<FenLuItemDTO> result = null;
            try
            {
                FenLuItemDTO fenluDTO = null;

                // --> DTO
                FenLuItem fenlu = fenluDAL.GetByID(id);
                if (fenlu != null)
                {
                    fenluDTO = new FenLuItemDTO(fenlu);
                    fenluDTO.ChapterName = chapterDAL.GetByID(fenlu.ChapterID).Name;
                    fenluDTO.Answers = fenluDAL.GetAnswers(fenlu.ID);
                }
                result = new ServiceInvokeDTO<FenLuItemDTO>(InvokeCode.SYS_INVOKE_SUCCESS, fenluDTO);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #19
0
        /// <summary>
        /// 获取培训机构的所有考试科目信息
        /// </summary>
        public ServiceInvokeDTO<List<Course>> GetAgencyCourses(int agencyID)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO<List<Course>> result = null;
            try
            {
                List<Course> courses = courseDAL.GetByAgencyID(agencyID);
                result = new ServiceInvokeDTO<List<Course>>(InvokeCode.SYS_INVOKE_SUCCESS, courses);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #20
0
        /// <summary>
        /// 下调章节序号
        /// </summary>
        public ServiceInvokeDTO DownChapter(int id)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                Chapter currentChapter = chapterDAL.GetByID(id);
                if (currentChapter != null)
                {
                    // 后一个章节
                    Chapter afterChapter = chapterDAL.GetAfterChapter(currentChapter.CourseID, currentChapter.ChapterIndex);

                    if (afterChapter != null)
                    {
                        // 互换章节序号
                        chapterDAL.UpdateChapterIndex(currentChapter.ID, afterChapter.ChapterIndex);
                        chapterDAL.UpdateChapterIndex(afterChapter.ID, currentChapter.ChapterIndex);
                    }

                    result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
                }
                else
                {
                    result = new ServiceInvokeDTO(InvokeCode.SYS_OBJECT_NOT_EXIST_ERROR);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #21
0
        /// <summary>
        /// 删除不定项选择题子选择题(批量删除)
        /// </summary>
        public ServiceInvokeDTO DeleteUncertainSubChoiceInBatch(List<int> ids)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                uncertainSubChoiceDAL.DeleteInBatch(ids);
                result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #22
0
        /// <summary>
        /// 更新单选题
        /// </summary>
        public ServiceInvokeDTO UpdateSingle(SingleItem single)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                SingleItem dbSingle = singleDAL.GetByID(single.ID);
                if (dbSingle != null)
                {
                    singleDAL.Update(single);
                    result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
                }
                else
                {
                    result = new ServiceInvokeDTO(InvokeCode.SYS_OBJECT_NOT_EXIST_ERROR);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #23
0
        /// <summary>
        /// 下调不定项子选择题题目序号
        /// </summary>
        public ServiceInvokeDTO DownUncertainSubChoice(int id)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                UncertainSubChoice currentSubchoice = uncertainSubChoiceDAL.GetByID(id);
                if (currentSubchoice != null)
                {
                    // 后一个题目
                    UncertainSubChoice afterSubchoice = uncertainSubChoiceDAL.GetAfterItem(currentSubchoice.UncertainItemID, currentSubchoice.ItemIndex);

                    if (afterSubchoice != null)
                    {
                        // 互换题目序号
                        uncertainSubChoiceDAL.UpdateItemIndex(currentSubchoice.ID, afterSubchoice.ItemIndex);
                        uncertainSubChoiceDAL.UpdateItemIndex(afterSubchoice.ID, currentSubchoice.ItemIndex);
                    }

                    result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
                }
                else
                {
                    result = new ServiceInvokeDTO(InvokeCode.SYS_OBJECT_NOT_EXIST_ERROR);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #24
0
        /// <summary>
        /// 更新不定项选择题
        /// </summary>
        public ServiceInvokeDTO UpdateUncertain(UncertainItem uncertain)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                UncertainItem dbUncertain = uncertainDAL.GetByID(uncertain.ID);
                if (dbUncertain != null)
                {
                    uncertainDAL.Update(uncertain);
                    result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
                }
                else
                {
                    result = new ServiceInvokeDTO(InvokeCode.SYS_OBJECT_NOT_EXIST_ERROR);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #25
0
        /// <summary>
        /// 根据科目主键ID获取科目信息
        /// </summary>
        public ServiceInvokeDTO<Course> GetCourseByID(int courseID)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO<Course> result = null;
            try
            {
                Course course = courseDAL.GetByID(courseID);
                result = new ServiceInvokeDTO<Course>(InvokeCode.SYS_INVOKE_SUCCESS, course);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #26
0
        /// <summary>
        /// 添加单选题(批量添加)
        /// </summary>
        public ServiceInvokeDTO AddSingle(List<SingleItem> singles)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                singleDAL.Insert(singles);
                result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #27
0
        /// <summary>
        /// 添加判断题
        /// </summary>
        public ServiceInvokeDTO AddJudge(JudgeItem judge)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                judgeDAL.Insert(judge);
                result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #28
0
        /// <summary>
        /// 添加不定项选择题(批量添加)
        /// </summary>
        public ServiceInvokeDTO AddUncertain(List<UncertainItem> uncertains)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                uncertainDAL.Insert(uncertains);
                result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #29
0
        /// <summary>
        /// 根据主键ID获取多选题
        /// </summary>
        public ServiceInvokeDTO<MultipleItemDTO> GetMultipleByID(int id)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO<MultipleItemDTO> result = null;
            try
            {
                MultipleItemDTO multipleDTO = null;

                // --> DTO
                MultipleItem multiple = multipleDAL.GetByID(id);
                if (multiple != null)
                {
                    multipleDTO = new MultipleItemDTO(multiple);
                    multipleDTO.ChapterName = chapterDAL.GetByID(multiple.ChapterID).Name;
                }
                result = new ServiceInvokeDTO<MultipleItemDTO>(InvokeCode.SYS_INVOKE_SUCCESS, multipleDTO);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Exemple #30
0
        /// <summary>
        /// 添加不定项选择题子选择题
        /// </summary>
        public ServiceInvokeDTO AddUncertainSubChoice(UncertainSubChoice uncertainSubChoice)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO result = null;
            try
            {
                // 叠加题目序号
                uncertainSubChoice.ItemIndex = uncertainSubChoiceDAL.GetLastItemIndex(uncertainSubChoice.UncertainItemID) + 1;

                uncertainSubChoiceDAL.Insert(uncertainSubChoice);
                result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }