public AttachmentInfoCollection GetAttachmentsInfo(HttpContext context) { YZRequest request = new YZRequest(context); string[] ids = request.GetString("fileids").Split(',', ';'); AttachmentInfoCollection attachments = new AttachmentInfoCollection(); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { attachments = AttachmentManager.GetAttachmentsInfo(provider, cn, ids); } } AttachmentInfoCollection rv = new AttachmentInfoCollection(); foreach (string id in ids) { AttachmentInfo attachmentInfo = attachments.TryGetItem(id); if (attachmentInfo != null) { rv.Add(attachmentInfo); } } return(rv); }
public static AttachmentInfoCollection GetAttachmentsInfo(IYZDbProvider provider, IDbConnection cn, string[] fileIds) { AttachmentInfoCollection rv = new AttachmentInfoCollection(); using (IDataReader reader = provider.GetAttachmentsInfo(cn, fileIds)) { while (reader.Read()) { rv.Add(new AttachmentInfo(reader, AttachmentManager.AttachmentRootPath)); } } return(rv); }
public AttachmentInfoCollection GetAllAttachmentInfo(IYZDbProvider provider, IDbConnection cn) { AttachmentInfoCollection attachments = new AttachmentInfoCollection(); foreach (File file in this) { AttachmentInfo attachment = AttachmentManager.TryGetAttachmentInfo(provider, cn, file.FileID); if (attachment != null) { attachments.Add(attachment); } } return(attachments); }