Ejemplo n.º 1
0
        /// <summary>
        /// 规则编号不能重复
        /// </summary>
        /// <param name="code">编号</param>
        /// <param name="keyValue">主键</param>
        /// <returns></returns>
        public bool ExistEnCode(string code, string keyValue)
        {
            try
            {
                var strSql = new StringBuilder();
                strSql.Append(" SELECT t.F_Id FROM LR_IM_SysUser t WHERE t.F_DeleteMark = 0 AND t.F_Code = @code ");
                if (!string.IsNullOrEmpty(keyValue))
                {
                    strSql.Append(" AND t.F_Id != @keyValue  ");
                }
                IMSysUserEntity entity = this.BaseRepository().FindEntity <IMSysUserEntity>(strSql.ToString(), new { code = code, keyValue = keyValue });

                return(entity == null ? true : false);
            }
            catch (Exception ex)
            {
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity(string keyValue, IMSysUserEntity entity)
 {
     try
     {
         if (!string.IsNullOrEmpty(keyValue))
         {
             entity.Modify(keyValue);
             this.BaseRepository().Update(entity);
         }
         else
         {
             entity.Create();
             this.BaseRepository().Insert(entity);
         }
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowServiceException(ex);
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity(string keyValue, IMSysUserEntity entity)
 {
     try
     {
         iMSysUserService.SaveEntity(keyValue, entity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 删除实体数据(虚拟)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void DeleteEntity(string keyValue)
 {
     try
     {
         IMSysUserEntity entity = new IMSysUserEntity();
         entity.F_Id         = keyValue;
         entity.F_DeleteMark = 1;
         this.BaseRepository().Update(entity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowServiceException(ex);
         }
     }
 }