public dtoAttachment(ProjectAttachmentLink link) { IdAttachmentLink = link.Id; IdActivity = (link.Activity == null) ? 0 : link.Activity.Id; IdAttachment = (link.Attachment == null) ? 0 : link.Attachment.Id; if (IdAttachment > 0) { Link = link.Attachment.Link; ModuleLinkId = (Link == null) ? 0 : link.Attachment.Link.Id; Type = link.Attachment.Type; if (link.Attachment != null) { File = new RepositoryItemObject(link.Attachment.Item); } Url = link.Attachment.Url; UrlName = link.Attachment.UrlName; IsShared = link.Attachment.SharedItems.Where(s => s.Deleted == BaseStatusDeleted.None && s.Type == AttachmentLinkType.Shared).Any(); } IdProject = link.Project.Id; DisplayOrder = link.DisplayOrder; IsForProject = link.IsForProject; InSharing = (link.Type == AttachmentLinkType.Shared); CreatedOn = link.CreatedOn.Value; Deleted = link.Deleted; }
public dtoAttachment(EventItemFile itemFile) { Id = itemFile.Id; IdEvent = itemFile.IdEventOwner; IdEventItem = itemFile.IdItemOwner; IdCommunity = itemFile.IdCommunity; Link = itemFile.Link; IdModuleLink = (Link == null) ? 0 : Link.Id; if (itemFile.Item != null) { File = new RepositoryItemObject(itemFile.Item); } CreatedOn = itemFile.CreatedOn.Value; if (ModifiedOn.HasValue) { ModifiedOn = itemFile.ModifiedOn.Value; } Deleted = itemFile.Deleted; IsVisible = itemFile.isVisible; }