本文整理汇总了C#中ItemList.OrderByDescending方法的典型用法代码示例。如果您正苦于以下问题:C# ItemList.OrderByDescending方法的具体用法?C# ItemList.OrderByDescending怎么用?C# ItemList.OrderByDescending使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemList
的用法示例。
在下文中一共展示了ItemList.OrderByDescending方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetAceObject
public bool SetAceObject(ItemList<AceWrapper> aceWrappers, String objectID, bool notify, String message)
{
ErrorIf(string.IsNullOrEmpty(objectID), FilesCommonResource.ErrorMassage_BadRequest, true);
using (var ddao = GetFolderDao())
using (var fdao = GetFileDao())
using (var tagDao = GetTagDao())
{
Debug.Assert(objectID != null, "objectID != null");
var entryType = objectID.StartsWith("file_") ? FileEntryType.File : FileEntryType.Folder;
var entryId = objectID.Substring((entryType == FileEntryType.File ? "file_" : "folder_").Length);
var entry = entryType == FileEntryType.File
? (FileEntry) fdao.GetFile(entryId)
: (FileEntry) ddao.GetFolder(entryId);
ErrorIf(entry == null, FilesCommonResource.ErrorMassage_BadRequest, true);
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);
//ErrorIf(entry.RootFolderType == FolderType.USER && entryType == FileEntryType.Folder, FilesCommonResource.ErrorMassage_NotSupportedFormat, true);
var defaultShare = entry.RootFolderType == FolderType.COMMON
? FileSecurity.DefaultCommonShare
: FileSecurity.DefaultMyShare;
var subscriptionProvider = NotifySource.Instance.GetSubscriptionProvider();
var recipientsProvider = NotifySource.Instance.GetRecipientsProvider();
foreach (var w in aceWrappers.OrderByDescending(ace => ace.SubjectGroup))
{
var subjects = FileSecurity.GetUserSubjects(w.SubjectId);
if (entry.RootFolderType == FolderType.COMMON
&& subjects.Contains(ASC.Core.Users.Constants.GroupAdmin.ID))
continue;
var ace = FileSecurity.GetShares(entry)
.Where(r => subjects.Contains(r.Subject))
.OrderBy(r => subjects.IndexOf(r.Subject))
.ThenByDescending(r => r.Share)
.FirstOrDefault();
var parentShare = ace != null ? ace.Share : defaultShare;
var share = parentShare == w.Share ? FileShare.None : w.Share;
if (w.SubjectId == FileConstant.ShareLinkId)
share = w.Share == FileShare.Restrict ? FileShare.None : w.Share;
FileSecurity.Share(entryId, entryType, w.SubjectId, share);
if (entry.RootFolderType != FolderType.USER
|| entryType == FileEntryType.Folder
|| w.SubjectId == FileConstant.ShareLinkId)
continue;
var recipients = new List<Notify.Recipients.IRecipient>();
var listUsersId = new List<Guid>();
if (w.SubjectGroup)
listUsersId = CoreContext.UserManager.GetUsersByGroup(w.SubjectId).Select(ui => ui.ID).ToList();
else
listUsersId.Add(w.SubjectId);
listUsersId.ForEach(id =>
{
if (id == SecurityContext.CurrentAccount.ID)
return;
var recipient = recipientsProvider.GetRecipient(id.ToString());
if (share == FileShare.Read || share == FileShare.ReadWrite)
{
if (subscriptionProvider.IsSubscribed(NotifyConstants.Event_ShareDocument, recipient, null))
{
subscriptionProvider.Subscribe(NotifyConstants.Event_UpdateDocument, entry.UniqID, recipient);
recipients.Add(recipient);
}
tagDao.SaveTags(Tag.New(id, entry));
}
else
{
subscriptionProvider.UnSubscribe(NotifyConstants.Event_UpdateDocument, entry.UniqID, recipient);
recipients.Remove(recipient);
tagDao.RemoveTags(Tag.New(id, entry));
}
});
if (notify)
{
NotifyClient.SendShareNotice((File) entry, share, recipients.ToArray(), message);
}
}
entry = entryType == FileEntryType.File
? (FileEntry) fdao.GetFile(entryId)
: (FileEntry) ddao.GetFolder(entryId);
return entry.SharedByMe;
}
}