本文整理汇总了C#中ItemList.Any方法的典型用法代码示例。如果您正苦于以下问题:C# ItemList.Any方法的具体用法?C# ItemList.Any怎么用?C# ItemList.Any使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemList
的用法示例。
在下文中一共展示了ItemList.Any方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSharedInfo
public ItemList<AceWrapper> GetSharedInfo(String objectId)
{
ErrorIf(!SecurityContext.IsAuthenticated, FilesCommonResource.ErrorMassage_SecurityException, true);
ErrorIf(string.IsNullOrEmpty(objectId), FilesCommonResource.ErrorMassage_BadRequest, true);
var entryType = objectId.StartsWith("file_") ? FileEntryType.File : FileEntryType.Folder;
var entryId = objectId.Substring((entryType == FileEntryType.File ? "file_" : "folder_").Length);
var shareLink = FileShare.Restrict;
var result = new ItemList<AceWrapper>();
using (var folderDao = GetFolderDao())
using (var fileDao = GetFileDao())
{
var entry = entryType == FileEntryType.File
? (FileEntry) fileDao.GetFile(entryId)
: (FileEntry) folderDao.GetFolder(entryId);
ErrorIf(entry.RootFolderType == FolderType.COMMON && !Global.IsAdministrator, FilesCommonResource.ErrorMassage_SecurityException, true);
ErrorIf(entry.RootFolderType == FolderType.USER && !Equals(entry.RootFolderId, Global.FolderMy), FilesCommonResource.ErrorMassage_SecurityException, true);
var records = FileSecurity
.GetShares(entry)
.GroupBy(r => r.Subject)
.Select(g => g.OrderBy(r => r.Level).ThenByDescending(r => r.Share).FirstOrDefault());
foreach (var r in records)
{
if (r.Subject == FileConstant.ShareLinkId)
{
shareLink = r.Share;
}
else
{
var u = CoreContext.UserManager.GetUsers(r.Subject);
var isgroup = false;
var title = u.DisplayUserName(false);
if (u.ID == ASC.Core.Users.Constants.LostUser.ID)
{
var g = CoreContext.GroupManager.GetGroupInfo(r.Subject);
isgroup = true;
title = g.Name;
if (g.ID == ASC.Core.Users.Constants.GroupAdmin.ID)
title = FilesCommonResource.Admin;
if (g.ID == ASC.Core.Users.Constants.GroupEveryone.ID)
title = FilesCommonResource.Everyone;
if (g.ID == ASC.Core.Users.Constants.LostGroupInfo.ID)
{
FileSecurity.RemoveSubject(r.Subject);
continue;
}
}
var w = new AceWrapper
{
SubjectId = r.Subject,
SubjectName = title,
SubjectGroup = isgroup,
Share = r.Share,
Owner =
entry.RootFolderType == FolderType.USER
? entry.RootFolderCreator == r.Subject
: entry.CreateBy == r.Subject,
};
result.Add(w);
}
}
if (entryType == FileEntryType.File && !result.Any(w => w.SubjectId == FileConstant.ShareLinkId))
{
var w = new AceWrapper
{
SubjectId = FileConstant.ShareLinkId,
SubjectName = DocumentUtils.GetShareLinkParam(entryId),
SubjectGroup = true,
Share = shareLink,
Owner = false
};
result.Add(w);
}
if (!result.Any(w => w.Owner))
{
var ownerId = entry.RootFolderType == FolderType.USER ? entry.RootFolderCreator : entry.CreateBy;
var w = new AceWrapper
{
SubjectId = ownerId,
SubjectName = FileEntry.GetUserName(ownerId),
SubjectGroup = false,
Share = FileShare.ReadWrite,
Owner = true,
};
result.Add(w);
}
if (entry.RootFolderType == FolderType.COMMON)
{
//.........这里部分代码省略.........