コード例 #1
0
        /// <summary>
        /// 保存职务信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ReturnMsg SaveMdmDutyInfo(MdmDutyMstrDto dto)
        {
            var rm     = new ReturnMsg();
            var entity = new MdmDutyMstr();
            var isOk   = CheckMdmDutyInfo(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();
                _mdmDutyMstrRepository.Insert(entity);
            }
            else
            {
                _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                entity = dto.ToEntity();
                _mdmDutyMstrRepository.Update(entity);
            }
            rm.IsSuccess = true;

            return(rm);
        }
コード例 #2
0
 public ActionResult SaveMdmDutyInfo([FromBody] MdmDutyMstrDto dto)
 {
     try
     {
         var result = _mdmDutyMstrService.SaveMdmDutyInfo(dto);
         if (!result.IsSuccess)
         {
             return(Fail(result.msg));
         }
         return(Success("保存成功"));
     }
     catch (Exception ex)
     {
         return(Fail(ex.Message));
     }
 }
コード例 #3
0
        /// <summary>
        /// 校验职务信息
        /// </summary>
        /// <param name="dto"></param>
        /// <param name="rm"></param>
        /// <returns></returns>
        public ReturnMsg CheckMdmDutyInfo(MdmDutyMstrDto dto, ReturnMsg rm)
        {
            if (string.IsNullOrEmpty(dto.DUTY_NO))
            {
                rm.IsSuccess = false;
                rm.msg       = "请输入职务编号";
                return(rm);
            }
            if (string.IsNullOrEmpty(dto.DUTY_NAME))
            {
                rm.IsSuccess = false;
                rm.msg       = "请输入职务名称";
                return(rm);
            }
            var result = new List <MdmDutyMstr>();

            result = dto.Id == 0 ? _mdmDutyMstrRepository.GetAllList(c => c.DUTY_NO == dto.DUTY_NO && c.DEL_FLAG == 1 && c.BG_NO == AbpSession.BG_NO)
                : _mdmDutyMstrRepository.GetAllList(c => c.DUTY_NO == dto.DUTY_NO && c.Id != dto.Id & c.DEL_FLAG == 1 && c.BG_NO == AbpSession.BG_NO);
            if (result.Count > 0)
            {
                rm.IsSuccess = false;
                rm.msg       = "职务编号已存在,请重新输入";
                return(rm);
            }
            result = dto.Id == 0 ? _mdmDutyMstrRepository.GetAllList(c => c.DUTY_NAME == dto.DUTY_NAME && c.DEL_FLAG == 1 && c.BG_NO == AbpSession.BG_NO)
                : _mdmDutyMstrRepository.GetAllList(c => c.DUTY_NAME == dto.DUTY_NAME && c.Id != dto.Id & c.DEL_FLAG == 1 && c.BG_NO == AbpSession.BG_NO);
            if (result.Count > 0)
            {
                rm.IsSuccess = false;
                rm.msg       = "职务名称已存在,请重新输入";
                return(rm);
            }
            rm.IsSuccess = true;

            return(rm);
        }