private void OnReleaseUserContextMenuClick(object sender, RoutedEventArgs e) { var fse = mouseElement.DataContext as FileSystemEntity; if (fse == null) { return; } var win = new WindowSelectUser(); win.Closed += (o, ea) => { if (win.DialogResult.HasValue && win.DialogResult.Value) { foreach (var c in win.SelectedUsers) { var dr = new DocumentRelease { ReleaseType = DocumentReleaseType.SystemUser, DocumentId = fse.Type == FileSystemEntityType.Folder ? Guid.Empty : fse.FileId, FolderId = fse.Type == FileSystemEntityType.Folder ? fse.FolderId : 0, ReviewUserId = c.UserId, ReviewOrgId = string.Empty, ReleaseTime = DateTime.Now, ReleasedBy = AuthenticateStatus.CurrentUser.UserId }; docContext.ReleaseDocument(dr); } } }; win.Show(); }
//文件描述 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 int RemoveDocumentRelease(DocumentRelease dr) { if (dr == null || dr.Identity < 1) { return(-2); } return(SqlHelper.Delete(dr)); }