Ejemplo n.º 1
0
 /// <summary>
 /// 保存数据
 /// </summary>
 /// <param name="keyValue">文件列表主键</param>
 /// <param name="fileBInfoEntity">文件主信息</param>
 /// <param name="filelistEntity">文件列表信息</param>
 public void SaveEntity(string keyValue, FileBInfoEntity fileBInfoEntity, FilelistEntity filelistEntity)
 {
     try
     {
         fileInfoService.SaveEntity(keyValue, fileBInfoEntity, filelistEntity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="keyValue">文件列表主键</param>
        /// <param name="fileBInfoEntity">文件主信息</param>
        /// <param name="filelistEntity">文件列表信息</param>
        public void SaveEntity(string keyValue, FileBInfoEntity fileBInfoEntity, FilelistEntity filelistEntity)
        {
            var db = this.BaseRepository().BeginTrans();

            try
            {
                if (string.IsNullOrEmpty(fileBInfoEntity.F_Id))
                {
                    fileBInfoEntity.Create();
                    db.Insert(fileBInfoEntity);
                }
                else
                {
                    db.Update(fileBInfoEntity);
                }
                filelistEntity.F_FileInfoId = fileBInfoEntity.F_Id;
                if (string.IsNullOrEmpty(keyValue))
                {
                    filelistEntity.Create();

                    db.Insert(filelistEntity);
                }
                else
                {
                    filelistEntity.Modify(keyValue);
                    db.Update(filelistEntity);
                }
                db.Commit();
            }
            catch (Exception ex)
            {
                db.Rollback();
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新文件发布状态
        /// </summary>
        /// <param name="processId"></param>
        public void UpdateEntity(string processId)
        {
            var fileList = this.BaseRepository().FindEntity <FilelistEntity>(processId);

            var db = this.BaseRepository().BeginTrans();

            try
            {
                db.ExecuteBySql(" update lr_base_filelist set F_IsPublish = 0 where F_FileInfoId=@id ", new { id = fileList.F_FileInfoId });

                FilelistEntity filelistEntity = new FilelistEntity()
                {
                    F_Id          = fileList.F_Id,
                    F_IsPublish   = 1,
                    F_PublishTime = DateTime.Now
                };
                FileBInfoEntity fileBInfoEntity = new FileBInfoEntity
                {
                    F_Id         = fileList.F_FileInfoId,
                    F_IsPublish  = 1,
                    F_DeleteMark = 0,
                    F_KeyWord    = fileList.F_KeyWord,
                    F_Name       = fileList.F_Name,
                    F_Folder     = fileList.F_Folder
                };

                db.Update(filelistEntity);
                db.Update(fileBInfoEntity);

                // 更新权限
                // 删除上从层文件夹继承的权限
                var authList = db.FindList <FileAuthEntity>(" select * from lr_base_fileauth t where t.F_FileInfoId = @F_FileInfoId ", new { F_FileInfoId = fileList.F_FileInfoId });
                foreach (var item in authList)
                {
                    if (item.F_Type != 0)
                    {
                        db.ExecuteBySql(" delete from lr_base_fileauth where F_Id =@id", new { id = item.F_Id });
                    }
                    else
                    {
                        db.ExecuteBySql(" delete from lr_base_fileauth where F_from =@fromId ", new { fromId = item.F_Id });
                    }
                }
                // 添加
                var authList2 = db.FindList <FileAuthEntity>(" select * from lr_base_fileauth t where t.F_FileInfoId = @F_FileInfoId AND F_Type != 2 ", new { F_FileInfoId = fileList.F_Folder });
                foreach (var item in authList2)
                {
                    if (item.F_Type == 0)
                    {
                        item.F_from = item.F_Id;
                    }
                    FileAuthEntity authEntity = new FileAuthEntity()
                    {
                        F_Id         = Guid.NewGuid().ToString(),
                        F_AuthType   = item.F_AuthType,
                        F_FileInfoId = fileList.F_FileInfoId,
                        F_from       = item.F_from,
                        F_ObjId      = item.F_ObjId,
                        F_ObjName    = item.F_ObjName,
                        F_ObjType    = item.F_ObjType,
                        F_Time       = item.F_Time,
                        F_Type       = 1,
                        F_IsFolder   = 0,
                        F_Level      = item.F_Level + 1
                    };
                    db.Insert(authEntity);
                }

                db.Commit();
            }
            catch (Exception ex)
            {
                db.Rollback();
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }