First create solution
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
Imports System.Web
|
||||
Imports System.Web.Services
|
||||
Imports Nuvolar.Module
|
||||
Imports DevExpress.ExpressApp.FileAttachments
|
||||
Imports DevExpress.Persistent.BaseImpl
|
||||
Imports DevExpress.Data.Filtering
|
||||
Imports System.IO
|
||||
Imports DevExpress.Web.Internal
|
||||
|
||||
Public Class GetAttachments
|
||||
Implements System.Web.IHttpHandler
|
||||
Private _Session As DevExpress.Xpo.Session
|
||||
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
||||
Dim _Oid As String = context.Request.QueryString("id")
|
||||
Dim _ConnectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ToString
|
||||
Dim _Attachment As FileData
|
||||
|
||||
_Session = New DevExpress.Xpo.Session
|
||||
_Session.ConnectionString = _ConnectionString
|
||||
_Session.Connect()
|
||||
|
||||
If _Session.IsConnected Then
|
||||
_Attachment = _Session.FindObject(Of FileData)(CriteriaOperator.Parse("Oid=?", _Oid))
|
||||
|
||||
If _Attachment IsNot Nothing Then
|
||||
Dim _Stream As New MemoryStream
|
||||
_Attachment.SaveToStream(_Stream)
|
||||
HttpUtils.WriteFileToResponse(Nothing, _Stream, _Attachment.FileName, True, "")
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
|
||||
Get
|
||||
Return False
|
||||
End Get
|
||||
End Property
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user