Пример #1
0
 /// <summary>
 /// 更新文件
 /// </summary>
 /// <param name="folderModel"></param>
 /// <returns></returns>
 public CommonResult Update(DocumentFolder DocumentFolderModel)
 {
     db.DocumentFolder.Where(documentFolder => documentFolder.UID == DocumentFolderModel.UID).Update(u => DocumentFolderModel);
     if (db.SaveChanges() < 0)
     {
         return(CommonResult.Instance("新建失败"));
     }
     Log4NetHelper.Info("更新关联文件记录", DocumentFolderModel.ToJson());
     //AllServices.ActionLogService.AddLog("更新项目信息",model.ToJson(),Enums.ActionCategory.Update);
     return(CommonResult.Instance());
 }
Пример #2
0
        ///// <summary>
        ///// 加载分页数据
        ///// </summary>
        ///// <param name="intPageIndex"></param>
        ///// <param name="intPageSize"></param>
        ///// <param name="whereLambda"></param>
        ///// <param name="dicOrderBy"></param>
        ///// <returns></returns>
        //public Page<Folder> GetByPage(int intPageIndex,int intPageSize,Expression<Func<Folder,bool>> whereLambda = null,Dictionary<string,string> dicOrderBy = null)
        //{
        //	if(whereLambda == null)
        //	{
        //		whereLambda = u => 1 == 1;
        //	}
        //	var q = db.Folder.Where(whereLambda).OrderBy(dicOrderBy);
        //	var list = q.Skip((intPageIndex - 1) * intPageSize).Take(intPageSize).ToList();
        //	return new Page<Folder>(intPageIndex,intPageSize,q.Count(),list);
        //}
        /// <summary>
        /// 新增文件关联
        /// </summary>
        /// <param name="folderModel"></param>
        /// <returns></returns>
        public CommonResult Add(DocumentFolder documentfolderModel)
        {
            if (IsRepeatFolderUIDwithDocumentUID(documentfolderModel.UID, documentfolderModel.FolderUID))
            {
                return(CommonResult.Instance("已存在此项目名,请换一个再试"));
            }
            documentfolderModel.DocumentFolderNo = db.Database.SqlQuery <string>("select ([dbo].[GetNextTN]('DocumentFolder'))").FirstOrDefault();

            db.DocumentFolder.Add(documentfolderModel);
            if (db.SaveChanges() < 0)
            {
                return(CommonResult.Instance("新建失败"));
            }
            //AllServices.ActionLogService.AddLog("新增文件",folderModel.ToJson(),Enums.ActionCategory.Add);
            Log4NetHelper.Info("新增关联文件记录", documentfolderModel.ToJson());
            return(CommonResult.Instance(documentfolderModel.UID));
        }