//文件描述 public int ReleaseDocument(DocumentRelease dr) { if (dr == null) { return(-2); } var filters = new EntityFilters { And = true }; filters.Add(new EntityFilter { Operator = FilterOperator.Equal, PropertyName = "ReleaseType", Value = dr.ReleaseType }); filters.Add(new EntityFilter { Operator = FilterOperator.Equal, PropertyName = "DocumentId", Value = dr.DocumentId }); filters.Add(new EntityFilter { Operator = FilterOperator.Equal, PropertyName = "FolderId", Value = dr.FolderId }); filters.Add(new EntityFilter { Operator = FilterOperator.Equal, PropertyName = "ReviewUserId", Value = dr.ReviewUserId }); filters.Add(new EntityFilter { Operator = FilterOperator.Equal, PropertyName = "ReviewOrgId", Value = dr.ReviewOrgId }); if (SqlHelper.Filter <DocumentRelease>(filters).Count > 0) { return(0); } dr.ReleaseTime = DateTime.Now; return(SqlHelper.Insert(dr)); }
//用户重复提醒消息 public void UserReviewSysMessage(int userId, int messageId) { var filters = new EntityFilters { And = true }; filters.Add(new EntityFilter { Operator = FilterOperator.Equal, PropertyName = "UserId", Value = userId }); filters.Add(new EntityFilter { Operator = FilterOperator.Equal, PropertyName = "MessageId", Value = messageId }); var list = SqlHelper.Filter <SystemMessageReview>(filters); if (list == null || list.Count < 1) { SqlHelper.Insert(new SystemMessageReview { Identity = -1, UserId = userId, MessageId = messageId, ReviewTimes = 1 }); } else { var smr = list[0]; smr.ReviewTimes += 1; SqlHelper.Update(smr); } }
//查找角色 public List <SystemRole> SearchRole(string searchKey) { var filters = new EntityFilters(); filters.And = false; filters.Add(new EntityFilter { Operator = FilterOperator.Like, PropertyName = "RoleCode", Value = searchKey }); filters.Add(new EntityFilter { Operator = FilterOperator.Like, PropertyName = "RoleName", Value = searchKey }); return(SqlHelper.Filter <SystemRole>(filters)); }
//搜索组织 public List <Organization> SearchOrganization(string strKey) { var filters = new EntityFilters(); filters.And = false; filters.Add(new EntityFilter { Operator = FilterOperator.StartWith, PropertyName = "Id", Value = strKey }); filters.Add(new EntityFilter { Operator = FilterOperator.StartWith, PropertyName = "ParentId", Value = strKey }); filters.Add(new EntityFilter { Operator = FilterOperator.Like, PropertyName = "Code", Value = strKey }); filters.Add(new EntityFilter { Operator = FilterOperator.Like, PropertyName = "Name", Value = strKey }); return(SqlHelper.Filter <Organization>(filters)); }
//获取子文件夹ID private int GetChildFolderId(int folderId, string folderName) { var filters = new EntityFilters { And = true }; filters.Add(new EntityFilter { Operator = FilterOperator.Equal, PropertyName = "ParentId", Value = folderId }); filters.Add(new EntityFilter { Operator = FilterOperator.Equal, PropertyName = "Name", Value = folderName }); var children = SqlHelper.Filter <DocumentFolder>(filters); if (children == null || children.Count < 1) { return(-1); } return(children[0].FolderId); }
//通过用户获取存档工作流 public List <ArchiveWorkflow> GetArchiveFlowByUser(int userId, AuditStatus status) { var filters = new EntityFilters { And = true }; filters.Add(new EntityFilter { Operator = FilterOperator.Equal, PropertyName = "SubmitUserId", Value = userId }); filters.Add(new EntityFilter { Operator = FilterOperator.Equal, PropertyName = "Status", Value = status }); var list = SqlHelper.Filter <ArchiveWorkflow>(filters); if (status == AuditStatus.Draft) { filters[1].Value = AuditStatus.Rejected; list.AddRange(SqlHelper.Filter <ArchiveWorkflow>(filters)); } return(list); }
//获取文件描述历史 public List <DocumentRelease> GetReleaseHistory(FileSystemEntity fse) { var filters = new EntityFilters { And = true }; filters.Add(fse.Type == FileSystemEntityType.File ? new EntityFilter { Operator = FilterOperator.Equal, PropertyName = "DocumentId", Value = fse.FileId } : new EntityFilter { Operator = FilterOperator.Equal, PropertyName = "FolderId", Value = fse.FolderId }); return(SqlHelper.Filter <DocumentRelease>(filters, true, false)); }
public AuditConfig IgnoreTable(Expression <Func <EntityEntry, bool> > lambda) { EntityFilters.Add(lambda.Compile()); return(this); }
public AuditConfig IgnoreTable <Entity>() { EntityFilters.Add(entity => entity.GetType() == typeof(Entity)); return(this); }
public AuditConfig IgnoreTable(Type type) { EntityFilters.Add(entity => entity.GetType() == type); return(this); }
public AuditConfig IgnoreTable(string tableName) { EntityFilters.Add(entity => entity.Metadata.GetTableName() == tableName); return(this); }