Esempio n. 1
0
 /// <summary>
 /// 保存岗位(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="postEntity">岗位实体</param>
 /// <returns></returns>
 public void SaveEntity(string keyValue, PostEntity postEntity)
 {
     try
     {
         if (!string.IsNullOrEmpty(keyValue))
         {
             postEntity.Modify(keyValue);
             this.BaseRepository().Update(postEntity);
         }
         else
         {
             postEntity.Create();
             this.BaseRepository().Insert(postEntity);
         }
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowServiceException(ex);
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 虚拟删除
        /// </summary>
        /// <param name="keyValue">主键</param>
        public void VirtualDelete(string keyValue)
        {
            var db = this.BaseRepository().BeginTrans();

            try
            {
                PostEntity entity = new PostEntity()
                {
                    F_PostId     = keyValue,
                    F_DeleteMark = 1
                };
                db.Update(entity);
                db.ExecuteBySql(" Delete  From LR_BASE_USERRELATION where F_OBJECTID = @keyValue  ", new { keyValue = keyValue });

                //db.Delete<UserRelationEntity>(t=>t.F_ObjectId == keyValue);

                db.Commit();
            }
            catch (Exception ex)
            {
                db.Rollback();
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 获取上级岗位人员ID
        /// </summary>
        /// <param name="strPostIds">岗位id</param>
        /// <param name="level">级数</param>
        /// <returns></returns>
        public List <string> GetUpIdList(string strPostIds, int level)
        {
            List <string> res = new List <string>();

            if (!string.IsNullOrEmpty(strPostIds) && level > 0 && level < 6)  // 现在支持1-5级查找
            {
                string[] postIdList = strPostIds.Split(',');
                bool     isHave     = false; // 判断是否指定级数的职位
                foreach (var postId in postIdList)
                {
                    isHave = false;
                    var entity = postService.GetEntity(postId);
                    if (entity != null)
                    {
                        string     parentId     = entity.F_ParentId;
                        PostEntity parentEntity = null;
                        for (int i = 0; i < level; i++)
                        {
                            parentEntity = postService.GetEntity(parentId);
                            if (parentEntity != null)
                            {
                                parentId = parentEntity.F_ParentId;
                                if (i == (level - 1))
                                {
                                    isHave = true;
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                        if (isHave)
                        {
                            if (parentEntity != null)
                            {
                                res.Add(parentEntity.F_PostId);
                            }
                        }
                    }
                }
            }
            return(res);
        }
Esempio n. 4
0
 /// <summary>
 /// 保存岗位(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="postEntity">岗位实体</param>
 /// <returns></returns>
 public void SaveEntity(string keyValue, PostEntity postEntity)
 {
     try
     {
         cache.Remove(cacheKey + postEntity.F_CompanyId, CacheId.post);
         postService.SaveEntity(keyValue, postEntity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }
Esempio n. 5
0
 /// <summary>
 /// 虚拟删除
 /// </summary>
 /// <param name="keyValue">主键</param>
 public void VirtualDelete(string keyValue)
 {
     try
     {
         PostEntity entity = GetEntity(keyValue);
         cache.Remove(cacheKey + entity.F_CompanyId, CacheId.post);
         postService.VirtualDelete(keyValue);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }