/// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity(int keyValue, dm_task_person_settingEntity entity)
 {
     try
     {
         if (keyValue > 0)
         {
             entity.Modify(keyValue);
             this.BaseRepository("dm_data").Update(entity);
         }
         else
         {
             entity.Create();
             this.BaseRepository("dm_data").Insert(entity);
         }
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowServiceException(ex);
         }
     }
 }
Пример #2
0
        /// <summary>
        /// 保存实体数据(新增、修改)
        /// <param name="keyValue">主键</param>
        /// <summary>
        /// <returns></returns>
        public void SaveEntity(int keyValue, dm_task_person_settingEntity entity)
        {
            try
            {
                UserInfo userInfo = LoginUserInfo.Get();

                if (keyValue > 0)
                {
                    entity.Modify(keyValue);
                    this.BaseRepository("dm_data").Update(entity);
                }
                else
                {
                    entity.appid = userInfo.companyId;
                    entity.Create();
                    this.BaseRepository("dm_data").Insert(entity);
                }

                #region 清除缓存
                string cacheKey = "PersonSetting" + userInfo.companyId;

                redisCache.Remove(cacheKey, 7);
                #endregion
            }
            catch (Exception ex)
            {
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }