Esempio n. 1
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;
        }
Esempio n. 2
0
        /// <summary>
        /// 以分页的形式查询分录题
        /// </summary>
        public ServiceInvokeDTO<QueryResultDTO<FenLuItemDTO>> QueryFenLu(QueryArgsDTO<FenLuItem> queryDTO, int courseID)
        {
            log.Debug(Constant.DEBUG_START);
            ServiceInvokeDTO<QueryResultDTO<FenLuItemDTO>> result = null;
            try
            {
                QueryResultDTO<FenLuItemDTO> resultData = null;

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

                    List<FenLuItemDTO> dtos = new List<FenLuItemDTO>();
                    if (queryData.List != null)
                    {
                        foreach (var fenlu in queryData.List)
                        {
                            FenLuItemDTO fenluDTO = new FenLuItemDTO(fenlu);
                            fenluDTO.ChapterName = chapterDAL.GetByID(fenlu.ChapterID).Name;
                            fenluDTO.Answers = fenluDAL.GetAnswers(fenlu.ID);
                            dtos.Add(fenluDTO);
                        }
                    }

                    resultData.List = dtos;
                }

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

            return result;
        }