예제 #1
0
        private Feed ToFeed(File file)
        {
            var rootFolder = new FolderDao(Tenant, DbId).GetFolder(file.FolderID);

            if (file.SharedToMeOn.HasValue)
            {
                var feed = new Feed(new Guid(file.SharedToMeBy), file.SharedToMeOn.Value, true)
                    {
                        Item = sharedFileItem,
                        ItemId = string.Format("{0}_{1}", file.ID, file.CreateByString),
                        ItemUrl = CommonLinkUtility.GetFileRedirectPreviewUrl(file.ID, true),
                        Product = Product,
                        Module = Name,
                        Title = file.Title,
                        AdditionalInfo = file.ContentLengthString,
                        AdditionalInfo2 = rootFolder.FolderType == FolderType.DEFAULT ? rootFolder.Title : string.Empty,
                        AdditionalInfo3 = rootFolder.FolderType == FolderType.DEFAULT ? CommonLinkUtility.GetFileRedirectPreviewUrl(file.FolderID, false) : string.Empty,
                        Keywords = string.Format("{0}", file.Title),
                        HasPreview = false,
                        CanComment = false,
                        Target = file.CreateByString,
                        GroupId = GetGroupId(sharedFileItem, new Guid(file.SharedToMeBy), file.FolderID.ToString())
                    };

                return feed;
            }

            var updated = file.Version != 1;
            return new Feed(file.ModifiedBy, file.ModifiedOn)
                {
                    Item = fileItem,
                    ItemId = string.Format("{0}_{1}", file.ID, file.Version > 1 ? 1 : 0),
                    ItemUrl = CommonLinkUtility.GetFileRedirectPreviewUrl(file.ID, true),
                    Product = Product,
                    Module = Name,
                    Action = updated ? FeedAction.Updated : FeedAction.Created,
                    Title = file.Title,
                    AdditionalInfo = file.ContentLengthString,
                    AdditionalInfo2 = rootFolder.FolderType == FolderType.DEFAULT ? rootFolder.Title : string.Empty,
                    AdditionalInfo3 = rootFolder.FolderType == FolderType.DEFAULT ? CommonLinkUtility.GetFileRedirectPreviewUrl(file.FolderID, false) : string.Empty,
                    Keywords = string.Format("{0}", file.Title),
                    HasPreview = false,
                    CanComment = false,
                    Target = null,
                    GroupId = GetGroupId(fileItem, file.ModifiedBy, file.FolderID.ToString(), updated ? 1 : 0)
                };
        }
예제 #2
0
        private Feed ToFeed(Tuple<File, SmallShareRecord> tuple)
        {
            var file = tuple.Item1;
            var shareRecord = tuple.Item2;

            var rootFolder = new FolderDao(Tenant, DbId).GetFolder(file.FolderID);

            if (shareRecord != null)
            {
                var feed = new Feed(shareRecord.ShareBy, shareRecord.ShareOn, true)
                    {
                        Item = sharedFileItem,
                        ItemId = string.Format("{0}_{1}", file.ID, shareRecord.ShareTo),
                        ItemUrl = FilesLinkUtility.GetFileRedirectPreviewUrl(file.ID, true),
                        Product = Product,
                        Module = Name,
                        Title = file.Title,
                        ExtraLocation = rootFolder.FolderType == FolderType.DEFAULT ? rootFolder.Title : string.Empty,
                        ExtraLocationUrl = rootFolder.FolderType == FolderType.DEFAULT ? FilesLinkUtility.GetFileRedirectPreviewUrl(file.FolderID, false) : string.Empty,
                        AdditionalInfo = file.ContentLengthString,
                        Keywords = string.Format("{0}", file.Title),
                        HasPreview = false,
                        CanComment = false,
                        Target = shareRecord.ShareTo,
                        GroupId = GetGroupId(sharedFileItem, shareRecord.ShareBy, file.FolderID.ToString())
                    };

                return feed;
            }

            var updated = file.Version != 1;
            return new Feed(file.ModifiedBy, file.ModifiedOn, true)
                {
                    Item = fileItem,
                    ItemId = string.Format("{0}_{1}", file.ID, file.Version > 1 ? 1 : 0),
                    ItemUrl = FilesLinkUtility.GetFileRedirectPreviewUrl(file.ID, true),
                    Product = Product,
                    Module = Name,
                    Action = updated ? FeedAction.Updated : FeedAction.Created,
                    Title = file.Title,
                    ExtraLocation = rootFolder.FolderType == FolderType.DEFAULT ? rootFolder.Title : string.Empty,
                    ExtraLocationUrl = rootFolder.FolderType == FolderType.DEFAULT ? FilesLinkUtility.GetFileRedirectPreviewUrl(file.FolderID, false) : string.Empty,
                    AdditionalInfo = file.ContentLengthString,
                    Keywords = string.Format("{0}", file.Title),
                    HasPreview = false,
                    CanComment = false,
                    Target = null,
                    GroupId = GetGroupId(fileItem, file.ModifiedBy, file.FolderID.ToString(), updated ? 1 : 0)
                };
        }
예제 #3
0
        private Feed ToFeed(Folder folder)
        {
            var rootFolder = new FolderDao(Tenant, DbId).GetFolder(folder.ParentFolderID);

            if (folder.SharedToMeOn.HasValue)
            {
                var feed = new Feed(new Guid(folder.SharedToMeBy), folder.SharedToMeOn.Value, true)
                    {
                        Item = sharedFolderItem,
                        ItemId = string.Format("{0}_{1}", folder.ID, folder.CreateByString),
                        ItemUrl = CommonLinkUtility.GetFileRedirectPreviewUrl(folder.ID, false),
                        Product = Product,
                        Module = Name,
                        Title = folder.Title,
                        AdditionalInfo = rootFolder.FolderType == FolderType.DEFAULT ? rootFolder.Title : string.Empty,
                        AdditionalInfo2 = rootFolder.FolderType == FolderType.DEFAULT ? CommonLinkUtility.GetFileRedirectPreviewUrl(folder.ParentFolderID, false) : string.Empty,
                        Keywords = string.Format("{0}", folder.Title),
                        HasPreview = false,
                        CanComment = false,
                        Target = folder.CreateByString,
                        GroupId = GetGroupId(sharedFolderItem, new Guid(folder.SharedToMeBy), folder.ParentFolderID.ToString())
                    };

                return feed;
            }

            return new Feed(folder.CreateBy, folder.CreateOn)
                {
                    Item = folderItem,
                    ItemId = folder.ID.ToString(),
                    ItemUrl = CommonLinkUtility.GetFileRedirectPreviewUrl(folder.ID, false),
                    Product = Product,
                    Module = Name,
                    Title = folder.Title,
                    AdditionalInfo = rootFolder.FolderType == FolderType.DEFAULT ? rootFolder.Title : string.Empty,
                    AdditionalInfo2 = rootFolder.FolderType == FolderType.DEFAULT ? CommonLinkUtility.GetFileRedirectPreviewUrl(folder.ParentFolderID, false) : string.Empty,
                    Keywords = string.Format("{0}", folder.Title),
                    HasPreview = false,
                    CanComment = false,
                    Target = null,
                    GroupId = GetGroupId(folderItem, folder.CreateBy, folder.ParentFolderID.ToString())
                };
        }
예제 #4
0
        private Feed ToFeed(Tuple<Folder, SmallShareRecord> tuple)
        {
            var folder = tuple.Item1;
            var shareRecord = tuple.Item2;

            var rootFolder = new FolderDao(Tenant, DbId).GetFolder(folder.ParentFolderID);

            if (shareRecord != null)
            {
                var feed = new Feed(shareRecord.ShareBy, shareRecord.ShareOn, true)
                    {
                        Item = sharedFolderItem,
                        ItemId = string.Format("{0}_{1}", folder.ID, shareRecord.ShareTo),
                        ItemUrl = FilesLinkUtility.GetFileRedirectPreviewUrl(folder.ID, false),
                        Product = Product,
                        Module = Name,
                        Title = folder.Title,
                        ExtraLocation = rootFolder.FolderType == FolderType.DEFAULT ? rootFolder.Title : string.Empty,
                        ExtraLocationUrl = rootFolder.FolderType == FolderType.DEFAULT ? FilesLinkUtility.GetFileRedirectPreviewUrl(folder.ParentFolderID, false) : string.Empty,
                        Keywords = string.Format("{0}", folder.Title),
                        HasPreview = false,
                        CanComment = false,
                        Target = shareRecord.ShareTo,
                        GroupId = GetGroupId(sharedFolderItem, shareRecord.ShareBy, folder.ParentFolderID.ToString())
                    };

                return feed;
            }

            return new Feed(folder.CreateBy, folder.CreateOn)
                {
                    Item = folderItem,
                    ItemId = folder.ID.ToString(),
                    ItemUrl = FilesLinkUtility.GetFileRedirectPreviewUrl(folder.ID, false),
                    Product = Product,
                    Module = Name,
                    Title = folder.Title,
                    ExtraLocation = rootFolder.FolderType == FolderType.DEFAULT ? rootFolder.Title : string.Empty,
                    ExtraLocationUrl = rootFolder.FolderType == FolderType.DEFAULT ? FilesLinkUtility.GetFileRedirectPreviewUrl(folder.ParentFolderID, false) : string.Empty,
                    Keywords = string.Format("{0}", folder.Title),
                    HasPreview = false,
                    CanComment = false,
                    Target = null,
                    GroupId = GetGroupId(folderItem, folder.CreateBy, folder.ParentFolderID.ToString())
                };
        }