Beispiel #1
0
        /// <summary>
        /// 保存系统模块信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ReturnMsg SaveSysMoudleInfo(WctSysmoduleMstrDto dto)
        {
            var rm     = new ReturnMsg();
            var entity = new WctSysmoduleMstr();
            var isOk   = CheckSysMoudleInfo(dto, rm);

            if (!isOk.IsSuccess)
            {
                return(rm);
            }
            if (string.IsNullOrEmpty(dto.Id))
            {
                dto.Id = Guid.NewGuid().ToString("N");
                _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                entity = dto.ToEntity();
                _wctSysmoduleMstrRepository.Insert(entity);
            }
            else
            {
                _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                entity = dto.ToEntity();
                _wctSysmoduleMstrRepository.Update(entity);
            }
            rm.IsSuccess = true;

            return(rm);
        }
Beispiel #2
0
        /// <summary>
        /// 校验公众号信息
        /// </summary>
        /// <param name="dto"></param>
        /// <param name="rm"></param>
        /// <returns></returns>
        public ReturnMsg CheckSysMoudleInfo(WctSysmoduleMstrDto dto, ReturnMsg rm)
        {
            if (string.IsNullOrEmpty(dto.SYSM_KEY))
            {
                rm.IsSuccess = false;
                rm.msg       = "请输入模块唯一标识";
                return(rm);
            }
            if (string.IsNullOrEmpty(dto.SYSM_TITLE))
            {
                rm.IsSuccess = false;
                rm.msg       = "请输入模块标题";
                return(rm);
            }
            if (string.IsNullOrEmpty(dto.SYSM_URL_TEMPLATE))
            {
                rm.IsSuccess = false;
                rm.msg       = "请输入模块页面地址";
                return(rm);
            }
            var result = string.IsNullOrEmpty(dto.Id) ? _wctSysmoduleMstrRepository.GetAllList(c => c.SYSM_KEY == dto.SYSM_KEY && c.DEL_FLAG == 1 && c.BG_NO == AbpSession.BG_NO)
                : _wctSysmoduleMstrRepository.GetAllList(c => c.SYSM_KEY == dto.SYSM_KEY && 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);
        }
Beispiel #3
0
 public ActionResult SaveSysMoudleInfo([FromBody] WctSysmoduleMstrDto dto)
 {
     try
     {
         var result = _wctSysmoduleMstrService.SaveSysMoudleInfo(dto);
         if (!result.IsSuccess)
         {
             return(Fail(result.msg));
         }
         return(Success("保存成功"));
     }
     catch (Exception ex)
     {
         return(Fail(ex.Message));
     }
 }