Ejemplo n.º 1
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)
            });
        }
Ejemplo n.º 2
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())
            });
        }
Ejemplo n.º 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          = 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           = 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 = 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())
            });
        }