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 static ProjectAttachmentLink CreateFromAttachment(ProjectAttachment attachment, long displayOrder = 0) { ProjectAttachmentLink link = new ProjectAttachmentLink(); link.Activity = attachment.Activity; link.Attachment = attachment; link.IdCreatedBy = attachment.IdCreatedBy; link.CreatedOn = attachment.CreatedOn; link.CreatorIpAddress = attachment.CreatorIpAddress; link.CreatorProxyIpAddress = attachment.CreatorProxyIpAddress; link.Description = attachment.Description; link.DisplayOrder = displayOrder; link.IsForProject = attachment.IsForProject; link.IdModifiedBy = attachment.IdModifiedBy; link.ModifiedIpAddress = attachment.ModifiedIpAddress; link.ModifiedOn = attachment.ModifiedOn; link.ModifiedProxyIpAddress = attachment.ModifiedProxyIpAddress; link.Project = attachment.Project; link.Type = AttachmentLinkType.Owner; return(link); }
public dtoAttachment(ProjectAttachmentLink link, Dictionary <Int32, String> users, String unknownUser) : this(link) { CreatedBy = (users.ContainsKey(link.IdCreatedBy) ? users[link.IdCreatedBy] : unknownUser); }