/// <summary> /// 编辑/新增题目 /// </summary> /// <param name="crmQpaperQuDto"></param> /// <returns></returns> public CrmQpaperQu SaveQpaperQuInfo(CrmQpaperQuDto crmQpaperQuDto, ref string msg) { try { CrmQpaperQu qu = null; if (CheckQuestion(crmQpaperQuDto.Id, crmQpaperQuDto.QU_NAME, crmQpaperQuDto.QU_SN, AbpSession.BG_NO, ref msg)) { if (string.IsNullOrEmpty(crmQpaperQuDto.Id)) { //新增 crmQpaperQuDto.Id = Guid.NewGuid().ToString("N"); _initHelper.InitAdd(crmQpaperQuDto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO); qu = _crmQpaperQuRepository.Insert(crmQpaperQuDto.ToEntity()); } else { //修改 _initHelper.InitUpdate(crmQpaperQuDto, AbpSession.USR_ID); qu = _crmQpaperQuRepository.Update(crmQpaperQuDto.ToEntity()); } } return(qu); } catch (Exception ex) { throw ex; } }
/// <summary> /// 转换为数据传输对象 /// </summary> /// <param name="entity">实体</param> public static CrmQpaperQuDto ToDto(this CrmQpaperQu entity) { if (entity == null) { return(new CrmQpaperQuDto()); } return(new CrmQpaperQuDto { Id = entity.Id, QU_SN = entity.QU_SN, QU_TYPE = entity.QU_TYPE, QU_NAME = entity.QU_NAME, QU_ENABLED = entity.QU_ENABLED, QU_ANSWER = entity.QU_ANSWER, PAPER_TYPE = entity.PAPER_TYPE, UDF1 = entity.UDF1, UDF2 = entity.UDF2, UDF3 = entity.UDF3, UDF4 = entity.UDF4, UDF5 = entity.UDF5, UDF6 = entity.UDF6, UDF7 = entity.UDF7, UDF8 = entity.UDF8, UDF9 = entity.UDF9, UDF10 = entity.UDF10, CREATE_ORG_NO = entity.CREATE_ORG_NO, CREATE_PSN = entity.CREATE_PSN, CREATE_DATE = entity.CREATE_DATE, UPDATE_PSN = entity.UPDATE_PSN, UPDATE_DATE = entity.UPDATE_DATE, DEL_FLAG = entity.DEL_FLAG, BG_NO = entity.BG_NO }); }