Beispiel #1
0
        /// <summary>
        /// 以分页的形式查询数字填空题
        /// </summary>
        public ServiceInvokeDTO<QueryResultDTO<NumberBlankItemDTO>> QueryNumberBlank(QueryArgsDTO<NumberBlankItem> queryDTO, int courseID)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO<QueryResultDTO<NumberBlankItemDTO>> result = null;
            try
            {
                QueryResultDTO<NumberBlankItemDTO> resultData = null;

                // -->DTO
                QueryResultDTO<NumberBlankItem> queryData = numberBlankDAL.Query(queryDTO, courseID);
                if (queryData != null)
                {
                    resultData = new QueryResultDTO<NumberBlankItemDTO>();
                    resultData.PageIndex = queryData.PageIndex;
                    resultData.PageSize = queryData.PageSize;
                    resultData.TotalRecordCount = queryData.TotalRecordCount;

                    List<NumberBlankItemDTO> dtos = new List<NumberBlankItemDTO>();
                    if (queryData.List != null)
                    {
                        foreach (var numberBlank in queryData.List)
                        {
                            NumberBlankItemDTO numberBlankDTO = new NumberBlankItemDTO(numberBlank);
                            numberBlankDTO.ChapterName = chapterDAL.GetByID(numberBlank.ChapterID).Name;
                            numberBlankDTO.Answers = numberBlankDAL.GetAnswers(numberBlank.ID);
                            dtos.Add(numberBlankDTO);
                        }
                    }

                    resultData.List = dtos;
                }

                result = new ServiceInvokeDTO<QueryResultDTO<NumberBlankItemDTO>>(InvokeCode.SYS_INVOKE_SUCCESS, resultData);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                result = new ServiceInvokeDTO<QueryResultDTO<NumberBlankItemDTO>>(InvokeCode.SYS_INNER_ERROR);
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }
Beispiel #2
0
        /// <summary>
        /// 根据主键ID获取数字填空题
        /// </summary>
        public ServiceInvokeDTO<NumberBlankItemDTO> GetNumberBlankByID(int id)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO<NumberBlankItemDTO> result = null;
            try
            {
                NumberBlankItemDTO numberBlankDTO = null;

                // --> DTO
                NumberBlankItem numberBlank = numberBlankDAL.GetByID(id);
                if (numberBlank != null)
                {
                    numberBlankDTO = new NumberBlankItemDTO(numberBlank);
                    numberBlankDTO.ChapterName = chapterDAL.GetByID(numberBlank.ChapterID).Name;
                    numberBlankDTO.Answers = numberBlankDAL.GetAnswers(numberBlank.ID);
                }
                result = new ServiceInvokeDTO<NumberBlankItemDTO>(InvokeCode.SYS_INVOKE_SUCCESS, numberBlankDTO);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                throw ex;
            }
            log.Debug(Constant.DEBUG_END);

            return result;
        }