/// <summary> /// 转换为数据传输对象 /// </summary> /// <param name="entity">实体</param> public static WctHelpTelMstrDto ToDto(this WctHelpTelMstr entity) { if (entity == null) { return(new WctHelpTelMstrDto()); } return(new WctHelpTelMstrDto { Id = entity.Id, TEL_NAME = entity.TEL_NAME, TEL_NO = entity.TEL_NO, TEL_TYPE = entity.TEL_TYPE, TEL_ID_NO = entity.TEL_ID_NO, 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, 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, BG_NO = entity.BG_NO }); }
/// <summary> /// 编辑/新增救援信息 /// </summary> /// <param name="helpDto"></param> /// <returns></returns> public WctHelpTelMstr SaveHelpTelInfo(WctHelpTelMstrDto helpDto) { try { WctHelpTelMstr mstr = null; if (string.IsNullOrEmpty(helpDto.Id)) { #region 参数验证 if (string.IsNullOrEmpty(helpDto.TEL_NAME)) { throw new Exception("号码归属不能为空"); } if (string.IsNullOrEmpty(helpDto.TEL_NO)) { throw new Exception("电话号码不能为空"); } if (string.IsNullOrEmpty(helpDto.TEL_TYPE)) { throw new Exception("电话类型不能为空"); } #endregion //新增 helpDto.Id = Guid.NewGuid().ToString("N"); helpDto.TEL_ID_NO = AbpSession.ORG_NO; _initHelper.InitAdd <WctHelpTelMstrDto>(helpDto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO); mstr = _wctHelpTelMstrRepository.Insert(helpDto.ToEntity()); } else { //修改 _initHelper.InitUpdate <WctHelpTelMstrDto>(helpDto, AbpSession.USR_ID); mstr = _wctHelpTelMstrRepository.Update(helpDto.ToEntity()); } return(mstr); } catch (Exception ex) { throw ex; } }