Ejemplo n.º 1
0
        /// <summary>
        /// 保存部门信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ReturnMsg SaveMdmDeptInfo(MdmDeptMstrDto dto)
        {
            var rm     = new ReturnMsg();
            var entity = new MdmDeptMstr();
            var isOk   = CheckMdmDeptInfo(dto, rm);

            if (!isOk.IsSuccess)
            {
                return(rm);
            }
            if (dto.Id == 0)
            {
                dto.ORG_NO = AbpSession.ORG_NO;
                _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                entity = dto.ToEntity();
                _mdmDeptMstrRepository.Insert(entity);
            }
            else
            {
                _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                entity = dto.ToEntity();
                _mdmDeptMstrRepository.Update(entity);
            }
            rm.IsSuccess = true;

            return(rm);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 转换为数据传输对象
 /// </summary>
 /// <param name="entity">实体</param>
 public static MdmDeptMstrDto ToDto(this MdmDeptMstr entity)
 {
     if (entity == null)
     {
         return(new MdmDeptMstrDto());
     }
     return(new MdmDeptMstrDto {
         Id = entity.Id,
         DEPT_NO = entity.DEPT_NO,
         DEPT_NAME = entity.DEPT_NAME,
         DEPT_PARENT_ID = entity.DEPT_PARENT_ID,
         ORG_NO = entity.ORG_NO,
         DEPT_STATUS = entity.DEPT_STATUS,
         CREATE_PSN = entity.CREATE_PSN,
         CREATE_DATE = entity.CREATE_DATE,
         UPDATE_PSN = entity.UPDATE_PSN,
         UPDATE_DATE = entity.UPDATE_DATE,
         CREATE_ORG_NO = entity.CREATE_ORG_NO,
         DEL_FLAG = entity.DEL_FLAG,
         BG_NO = entity.BG_NO
     });
 }