EDMI Service: WIP
This commit is contained in:
parent
7abf47c2fc
commit
bb9dd66d1f
@ -17,14 +17,21 @@ Public Class Path
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Function GetActivePath(DocumentType As String)
|
Public Function GetActivePath(DocumentType As String)
|
||||||
Dim oPathParts As New List(Of String) From {_BasePath, PATH_EDMI, PATH_ACTIVE, DocumentType}
|
Dim oPathParts As New List(Of String) From {_BasePath, PATH_EDMI, PATH_ACTIVE}
|
||||||
oPathParts.AddRange(GetDatePath())
|
oPathParts.AddRange(GetRelativePath(DocumentType))
|
||||||
|
|
||||||
Return IO.Path.Combine(oPathParts.ToArray())
|
Return IO.Path.Combine(oPathParts.ToArray())
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function GetArchivePath(DocumentType As String)
|
Public Function GetArchivePath(DocumentType As String)
|
||||||
Dim oPathParts As New List(Of String) From {_BasePath, PATH_EDMI, PATH_ARCHIVE, DocumentType}
|
Dim oPathParts As New List(Of String) From {_BasePath, PATH_EDMI, PATH_ARCHIVE}
|
||||||
|
oPathParts.AddRange(GetRelativePath(DocumentType))
|
||||||
|
|
||||||
|
Return IO.Path.Combine(oPathParts.ToArray())
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function GetRelativePath(DocumentType As String)
|
||||||
|
Dim oPathParts As New List(Of String) From {DocumentType}
|
||||||
oPathParts.AddRange(GetDatePath())
|
oPathParts.AddRange(GetDatePath())
|
||||||
|
|
||||||
Return IO.Path.Combine(oPathParts.ToArray())
|
Return IO.Path.Combine(oPathParts.ToArray())
|
||||||
|
|||||||
@ -50,9 +50,9 @@ Public Class Form1
|
|||||||
Await oStream.ReadAsync(oContents, 0, oFileInfo.Length)
|
Await oStream.ReadAsync(oContents, 0, oFileInfo.Length)
|
||||||
End Using
|
End Using
|
||||||
|
|
||||||
Dim oResult As EDMIServiceReference.DocumentResult2 = Await _Channel.ImportFileAsync(oFileInfo, oContents, False, 0)
|
Dim oResult As EDMIServiceReference.DocumentResult2 = Await _Channel.ImportFileAsync(oFileInfo.Name, oContents, Environment.UserName)
|
||||||
If oResult.OK Then
|
If oResult.OK Then
|
||||||
listboxLog.Items.Add($"File {oFileInfo.Name} imported!")
|
listboxLog.Items.Add($"File [{oFileInfo.Name}] with Id [{oResult.Document.FileId}] imported!")
|
||||||
listboxFileids.Items.Add(oResult.Document.FileId)
|
listboxFileids.Items.Add(oResult.Document.FileId)
|
||||||
Else
|
Else
|
||||||
listboxLog.Items.Add($"Import Error: {oResult.ErrorMessage}")
|
listboxLog.Items.Add($"Import Error: {oResult.ErrorMessage}")
|
||||||
|
|||||||
@ -93,6 +93,7 @@
|
|||||||
<Compile Include="Constants.vb" />
|
<Compile Include="Constants.vb" />
|
||||||
<Compile Include="Exceptions.vb" />
|
<Compile Include="Exceptions.vb" />
|
||||||
<Compile Include="Firebird.vb" />
|
<Compile Include="Firebird.vb" />
|
||||||
|
<Compile Include="IDatabase.vb" />
|
||||||
<Compile Include="ODBC.vb" />
|
<Compile Include="ODBC.vb" />
|
||||||
<Compile Include="Oracle.vb" />
|
<Compile Include="Oracle.vb" />
|
||||||
<Compile Include="MSSQLServer.vb" />
|
<Compile Include="MSSQLServer.vb" />
|
||||||
|
|||||||
12
Modules.Database/IDatabase.vb
Normal file
12
Modules.Database/IDatabase.vb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
Imports System.Data.Common
|
||||||
|
|
||||||
|
Public Interface IDatabase
|
||||||
|
Function GetDatatable(SqlCommand As String, Timeout As Integer) As DataTable
|
||||||
|
Function GetDatatable(SqlCommand As String) As DataTable
|
||||||
|
|
||||||
|
Function ExecuteNonQuery(SQLCommand As String, Timeout As Integer) As Boolean
|
||||||
|
Function ExecuteNonQuery(SQLCommand As String) As Boolean
|
||||||
|
|
||||||
|
Function GetScalarValue(SQLQuery As String, Timeout As Integer) As Object
|
||||||
|
Function GetScalarValue(SQLQuery As String) As Object
|
||||||
|
End Interface
|
||||||
@ -1,7 +1,10 @@
|
|||||||
Imports System.Data.SqlClient
|
Imports System.Data.Common
|
||||||
|
Imports System.Data.SqlClient
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
|
|
||||||
Public Class MSSQLServer
|
Public Class MSSQLServer
|
||||||
|
Implements IDatabase
|
||||||
|
|
||||||
Public DBInitialized As Boolean = False
|
Public DBInitialized As Boolean = False
|
||||||
Public CurrentSQLConnectionString As String = ""
|
Public CurrentSQLConnectionString As String = ""
|
||||||
|
|
||||||
@ -40,7 +43,7 @@ Public Class MSSQLServer
|
|||||||
Dim oConnectionStringBuilder As New SqlConnectionStringBuilder() With {
|
Dim oConnectionStringBuilder As New SqlConnectionStringBuilder() With {
|
||||||
.DataSource = Server,
|
.DataSource = Server,
|
||||||
.InitialCatalog = Database,
|
.InitialCatalog = Database,
|
||||||
.UserId = UserId,
|
.UserID = UserId,
|
||||||
.Password = Password
|
.Password = Password
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +92,7 @@ Public Class MSSQLServer
|
|||||||
''' </summary>
|
''' </summary>
|
||||||
''' <param name="SqlCommand">sqlcommand for datatable (select XYZ from TableORView)</param>
|
''' <param name="SqlCommand">sqlcommand for datatable (select XYZ from TableORView)</param>
|
||||||
''' <returns>Returns a datatable</returns>
|
''' <returns>Returns a datatable</returns>
|
||||||
Public Function GetDatatable(SqlCommand As String, Timeout As Integer) As DataTable
|
Public Function GetDatatable(SqlCommand As String, Timeout As Integer) As DataTable Implements IDatabase.GetDatatable
|
||||||
Try
|
Try
|
||||||
If TestCanConnect() = False Then
|
If TestCanConnect() = False Then
|
||||||
Return Nothing
|
Return Nothing
|
||||||
@ -113,7 +116,7 @@ Public Class MSSQLServer
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function GetDatatable(SqlCommand As String) As DataTable
|
Public Function GetDatatable(SqlCommand As String) As DataTable Implements IDatabase.GetDatatable
|
||||||
Return GetDatatable(SqlCommand, _Timeout)
|
Return GetDatatable(SqlCommand, _Timeout)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
@ -128,7 +131,7 @@ Public Class MSSQLServer
|
|||||||
Return ExecuteNonQuery(executeStatement)
|
Return ExecuteNonQuery(executeStatement)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function ExecuteNonQuery(SQLCommand As String, Timeout As Integer) As Boolean
|
Public Function ExecuteNonQuery(SQLCommand As String, Timeout As Integer) As Boolean Implements IDatabase.ExecuteNonQuery
|
||||||
Try
|
Try
|
||||||
If TestCanConnect() = False Then
|
If TestCanConnect() = False Then
|
||||||
Return Nothing
|
Return Nothing
|
||||||
@ -149,7 +152,7 @@ Public Class MSSQLServer
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function ExecuteNonQuery(SQLCommand As String) As Boolean
|
Public Function ExecuteNonQuery(SQLCommand As String) As Boolean Implements IDatabase.ExecuteNonQuery
|
||||||
Return ExecuteNonQuery(SQLCommand, _Timeout)
|
Return ExecuteNonQuery(SQLCommand, _Timeout)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
@ -163,7 +166,7 @@ Public Class MSSQLServer
|
|||||||
Return GetScalarValue(ScalarSQL)
|
Return GetScalarValue(ScalarSQL)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function GetScalarValue(SQLQuery As String, Timeout As Integer) As Object
|
Public Function GetScalarValue(SQLQuery As String, Timeout As Integer) As Object Implements IDatabase.GetScalarValue
|
||||||
Try
|
Try
|
||||||
If TestCanConnect() = False Then
|
If TestCanConnect() = False Then
|
||||||
Return Nothing
|
Return Nothing
|
||||||
@ -184,10 +187,43 @@ Public Class MSSQLServer
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function GetScalarValue(SQLQuery As String) As Object
|
Public Function GetScalarValue(SQLQuery As String) As Object Implements IDatabase.GetScalarValue
|
||||||
Return GetScalarValue(SQLQuery, _Timeout)
|
Return GetScalarValue(SQLQuery, _Timeout)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Function GetScalarValue(SQLCommand As SqlCommand, OutputParameter As String, Timeout As Integer) As Object
|
||||||
|
Try
|
||||||
|
If TestCanConnect() = False Then
|
||||||
|
Return Nothing
|
||||||
|
End If
|
||||||
|
|
||||||
|
If SQLCommand.CommandText.Contains(" ") Then
|
||||||
|
SQLCommand.CommandType = CommandType.Text
|
||||||
|
Else
|
||||||
|
SQLCommand.CommandType = CommandType.StoredProcedure
|
||||||
|
End If
|
||||||
|
|
||||||
|
Using oConnection As SqlConnection = GetSQLConnection()
|
||||||
|
|
||||||
|
SQLCommand.Connection = oConnection
|
||||||
|
SQLCommand.Parameters(OutputParameter).Direction = ParameterDirection.Output
|
||||||
|
SQLCommand.CommandTimeout = Timeout
|
||||||
|
SQLCommand.ExecuteNonQuery()
|
||||||
|
oConnection.Close()
|
||||||
|
|
||||||
|
Return SQLCommand.Parameters(OutputParameter).Value
|
||||||
|
End Using
|
||||||
|
Catch ex As Exception
|
||||||
|
_Logger.Error(ex)
|
||||||
|
_Logger.Warn("SQLQuery: " & SQLCommand.CommandText)
|
||||||
|
Return Nothing
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function GetScalarValue(SQLCommand As SqlCommand, OutputParameter As String) As Object
|
||||||
|
Return GetScalarValue(SQLCommand, OutputParameter, _Timeout)
|
||||||
|
End Function
|
||||||
|
|
||||||
''' <summary>
|
''' <summary>
|
||||||
''' Executes the passed sql-statement in asyncmode
|
''' Executes the passed sql-statement in asyncmode
|
||||||
''' </summary>
|
''' </summary>
|
||||||
|
|||||||
@ -8,7 +8,6 @@
|
|||||||
<xsd:import namespace="http://schemas.datacontract.org/2004/07/System" />
|
<xsd:import namespace="http://schemas.datacontract.org/2004/07/System" />
|
||||||
<xsd:import namespace="http://schemas.datacontract.org/2004/07/System.Data" />
|
<xsd:import namespace="http://schemas.datacontract.org/2004/07/System.Data" />
|
||||||
<xsd:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Modules.Filesystem" />
|
<xsd:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Modules.Filesystem" />
|
||||||
<xsd:import namespace="http://schemas.datacontract.org/2004/07/System.IO" />
|
|
||||||
</xsd:schema>
|
</xsd:schema>
|
||||||
</wsdl:types>
|
</wsdl:types>
|
||||||
<wsdl:message name="IEDMIService_Heartbeat_InputMessage">
|
<wsdl:message name="IEDMIService_Heartbeat_InputMessage">
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
<xs:schema xmlns:tns="http://DigitalData.Services.EDMIService" elementFormDefault="qualified" targetNamespace="http://DigitalData.Services.EDMIService" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
<xs:schema xmlns:tns="http://DigitalData.Services.EDMIService" elementFormDefault="qualified" targetNamespace="http://DigitalData.Services.EDMIService" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService" />
|
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService" />
|
||||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Modules.Filesystem" />
|
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Modules.Filesystem" />
|
||||||
<xs:import namespace="http://schemas.datacontract.org/2004/07/System.IO" />
|
|
||||||
<xs:element name="Heartbeat">
|
<xs:element name="Heartbeat">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:sequence />
|
<xs:sequence />
|
||||||
@ -171,24 +170,23 @@
|
|||||||
<xs:element name="ImportFile">
|
<xs:element name="ImportFile">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element xmlns:q12="http://schemas.datacontract.org/2004/07/System.IO" minOccurs="0" name="FileInfo" nillable="true" type="q12:FileInfo" />
|
<xs:element minOccurs="0" name="FileName" nillable="true" type="xs:string" />
|
||||||
<xs:element minOccurs="0" name="Contents" nillable="true" type="xs:base64Binary" />
|
<xs:element minOccurs="0" name="Contents" nillable="true" type="xs:base64Binary" />
|
||||||
<xs:element minOccurs="0" name="ReadOnly" type="xs:boolean" />
|
<xs:element minOccurs="0" name="AddedWho" nillable="true" type="xs:string" />
|
||||||
<xs:element minOccurs="0" name="RetentionTime" type="xs:int" />
|
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
<xs:element name="ImportFileResponse">
|
<xs:element name="ImportFileResponse">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element xmlns:q13="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService" minOccurs="0" name="ImportFileResult" nillable="true" type="q13:DocumentResult2" />
|
<xs:element xmlns:q12="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService" minOccurs="0" name="ImportFileResult" nillable="true" type="q12:DocumentResult2" />
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
<xs:element name="NewFileIndex">
|
<xs:element name="NewFileIndex">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element xmlns:q14="http://schemas.datacontract.org/2004/07/DigitalData.Modules.Filesystem" minOccurs="0" name="DocObject" nillable="true" type="q14:DocumentObject" />
|
<xs:element xmlns:q13="http://schemas.datacontract.org/2004/07/DigitalData.Modules.Filesystem" minOccurs="0" name="DocObject" nillable="true" type="q13:DocumentObject" />
|
||||||
<xs:element minOccurs="0" name="Syskey" nillable="true" type="xs:string" />
|
<xs:element minOccurs="0" name="Syskey" nillable="true" type="xs:string" />
|
||||||
<xs:element minOccurs="0" name="LanguageCode" nillable="true" type="xs:string" />
|
<xs:element minOccurs="0" name="LanguageCode" nillable="true" type="xs:string" />
|
||||||
<xs:element minOccurs="0" name="Value" nillable="true" type="xs:string" />
|
<xs:element minOccurs="0" name="Value" nillable="true" type="xs:string" />
|
||||||
@ -198,7 +196,7 @@
|
|||||||
<xs:element name="NewFileIndexResponse">
|
<xs:element name="NewFileIndexResponse">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element xmlns:q15="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService" minOccurs="0" name="NewFileIndexResult" nillable="true" type="q15:IndexResult" />
|
<xs:element xmlns:q14="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService" minOccurs="0" name="NewFileIndexResult" nillable="true" type="q14:IndexResult" />
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
|||||||
@ -30,7 +30,6 @@
|
|||||||
<MetadataFile FileName="System.xsd" MetadataType="Schema" ID="e0db7004-6943-4cf8-b88f-4811ed14a341" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
<MetadataFile FileName="System.xsd" MetadataType="Schema" ID="e0db7004-6943-4cf8-b88f-4811ed14a341" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
||||||
<MetadataFile FileName="System.Data.xsd" MetadataType="Schema" ID="6c7bdb47-eea4-4d03-bc52-9747c865bbf0" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
<MetadataFile FileName="System.Data.xsd" MetadataType="Schema" ID="6c7bdb47-eea4-4d03-bc52-9747c865bbf0" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
||||||
<MetadataFile FileName="DigitalData.Modules.Filesystem.xsd" MetadataType="Schema" ID="cfa7fe70-b4f1-4a12-a957-d0134a8e6279" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
<MetadataFile FileName="DigitalData.Modules.Filesystem.xsd" MetadataType="Schema" ID="cfa7fe70-b4f1-4a12-a957-d0134a8e6279" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
||||||
<MetadataFile FileName="System.IO.xsd" MetadataType="Schema" ID="2af2d8d2-0bc4-42bc-a200-42cecb5bf98e" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
|
|
||||||
</Metadata>
|
</Metadata>
|
||||||
<Extensions>
|
<Extensions>
|
||||||
<ExtensionFile FileName="configuration91.svcinfo" Name="configuration91.svcinfo" />
|
<ExtensionFile FileName="configuration91.svcinfo" Name="configuration91.svcinfo" />
|
||||||
|
|||||||
@ -97,9 +97,7 @@ Namespace EDMIServiceReference
|
|||||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.DocumentResult2.DocumentObject)), _
|
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.DocumentResult2.DocumentObject)), _
|
||||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.IndexResult)), _
|
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.IndexResult)), _
|
||||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(System.DBNull)), _
|
System.Runtime.Serialization.KnownTypeAttribute(GetType(System.DBNull)), _
|
||||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.DocumentObject)), _
|
System.Runtime.Serialization.KnownTypeAttribute(GetType(EDMIServiceReference.DocumentObject))> _
|
||||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(System.IO.FileInfo)), _
|
|
||||||
System.Runtime.Serialization.KnownTypeAttribute(GetType(System.IO.FileSystemInfo))> _
|
|
||||||
Partial Public Class ScalarResult
|
Partial Public Class ScalarResult
|
||||||
Inherits EDMIServiceReference.BaseResult
|
Inherits EDMIServiceReference.BaseResult
|
||||||
|
|
||||||
@ -504,10 +502,10 @@ Namespace EDMIServiceReference
|
|||||||
Function GetDocumentByContainerIdAsync(ByVal ContainerId As String) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentResult)
|
Function GetDocumentByContainerIdAsync(ByVal ContainerId As String) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentResult)
|
||||||
|
|
||||||
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/ImportFile", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/ImportFileResponse")> _
|
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/ImportFile", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/ImportFileResponse")> _
|
||||||
Function ImportFile(ByVal FileInfo As System.IO.FileInfo, ByVal Contents() As Byte, ByVal [ReadOnly] As Boolean, ByVal RetentionTime As Integer) As EDMIServiceReference.DocumentResult2
|
Function ImportFile(ByVal FileName As String, ByVal Contents() As Byte, ByVal AddedWho As String) As EDMIServiceReference.DocumentResult2
|
||||||
|
|
||||||
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/ImportFile", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/ImportFileResponse")> _
|
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/ImportFile", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/ImportFileResponse")> _
|
||||||
Function ImportFileAsync(ByVal FileInfo As System.IO.FileInfo, ByVal Contents() As Byte, ByVal [ReadOnly] As Boolean, ByVal RetentionTime As Integer) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentResult2)
|
Function ImportFileAsync(ByVal FileName As String, ByVal Contents() As Byte, ByVal AddedWho As String) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentResult2)
|
||||||
|
|
||||||
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/NewFileIndex", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/NewFileIndexResponse")> _
|
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/NewFileIndex", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/NewFileIndexResponse")> _
|
||||||
Function NewFileIndex(ByVal DocObject As EDMIServiceReference.DocumentObject, ByVal Syskey As String, ByVal LanguageCode As String, ByVal Value As String) As EDMIServiceReference.IndexResult
|
Function NewFileIndex(ByVal DocObject As EDMIServiceReference.DocumentObject, ByVal Syskey As String, ByVal LanguageCode As String, ByVal Value As String) As EDMIServiceReference.IndexResult
|
||||||
@ -643,12 +641,12 @@ Namespace EDMIServiceReference
|
|||||||
Return MyBase.Channel.GetDocumentByContainerIdAsync(ContainerId)
|
Return MyBase.Channel.GetDocumentByContainerIdAsync(ContainerId)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function ImportFile(ByVal FileInfo As System.IO.FileInfo, ByVal Contents() As Byte, ByVal [ReadOnly] As Boolean, ByVal RetentionTime As Integer) As EDMIServiceReference.DocumentResult2 Implements EDMIServiceReference.IEDMIService.ImportFile
|
Public Function ImportFile(ByVal FileName As String, ByVal Contents() As Byte, ByVal AddedWho As String) As EDMIServiceReference.DocumentResult2 Implements EDMIServiceReference.IEDMIService.ImportFile
|
||||||
Return MyBase.Channel.ImportFile(FileInfo, Contents, [ReadOnly], RetentionTime)
|
Return MyBase.Channel.ImportFile(FileName, Contents, AddedWho)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function ImportFileAsync(ByVal FileInfo As System.IO.FileInfo, ByVal Contents() As Byte, ByVal [ReadOnly] As Boolean, ByVal RetentionTime As Integer) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentResult2) Implements EDMIServiceReference.IEDMIService.ImportFileAsync
|
Public Function ImportFileAsync(ByVal FileName As String, ByVal Contents() As Byte, ByVal AddedWho As String) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentResult2) Implements EDMIServiceReference.IEDMIService.ImportFileAsync
|
||||||
Return MyBase.Channel.ImportFileAsync(FileInfo, Contents, [ReadOnly], RetentionTime)
|
Return MyBase.Channel.ImportFileAsync(FileName, Contents, AddedWho)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function NewFileIndex(ByVal DocObject As EDMIServiceReference.DocumentObject, ByVal Syskey As String, ByVal LanguageCode As String, ByVal Value As String) As EDMIServiceReference.IndexResult Implements EDMIServiceReference.IEDMIService.NewFileIndex
|
Public Function NewFileIndex(ByVal DocObject As EDMIServiceReference.DocumentObject, ByVal Syskey As String, ByVal LanguageCode As String, ByVal Value As String) As EDMIServiceReference.IndexResult Implements EDMIServiceReference.IEDMIService.NewFileIndex
|
||||||
|
|||||||
@ -1,17 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<xs:schema xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:tns="http://schemas.datacontract.org/2004/07/System.IO" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/System.IO" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
|
||||||
<xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
|
|
||||||
<xs:complexType name="FileInfo">
|
|
||||||
<xs:complexContent mixed="false">
|
|
||||||
<xs:extension base="tns:FileSystemInfo" />
|
|
||||||
</xs:complexContent>
|
|
||||||
</xs:complexType>
|
|
||||||
<xs:element name="FileInfo" nillable="true" type="tns:FileInfo" />
|
|
||||||
<xs:complexType name="FileSystemInfo">
|
|
||||||
<xs:sequence>
|
|
||||||
<xs:any minOccurs="0" maxOccurs="unbounded" namespace="##local" processContents="skip" />
|
|
||||||
</xs:sequence>
|
|
||||||
<xs:attribute ref="ser:FactoryType" />
|
|
||||||
</xs:complexType>
|
|
||||||
<xs:element name="FileSystemInfo" nillable="true" type="tns:FileSystemInfo" />
|
|
||||||
</xs:schema>
|
|
||||||
@ -55,12 +55,10 @@ Public Class Document
|
|||||||
''' <returns>A document object</returns>
|
''' <returns>A document object</returns>
|
||||||
Public Async Function ImportFileAsync(FilePath As String, Optional [ReadOnly] As Boolean = False, Optional RetentionPeriod As Integer = 0) As Task(Of DocumentResult2)
|
Public Async Function ImportFileAsync(FilePath As String, Optional [ReadOnly] As Boolean = False, Optional RetentionPeriod As Integer = 0) As Task(Of DocumentResult2)
|
||||||
Try
|
Try
|
||||||
Dim oInfo As New FileInfo(FilePath)
|
|
||||||
|
|
||||||
Using oStream As New FileStream(FilePath, FileMode.Open)
|
Using oStream As New FileStream(FilePath, FileMode.Open)
|
||||||
Dim oContents As Byte() = {}
|
Dim oContents As Byte() = {}
|
||||||
Dim oBytesRead = Await oStream.ReadAsync(oContents, 0, oStream.Length)
|
Dim oBytesRead = Await oStream.ReadAsync(oContents, 0, oStream.Length)
|
||||||
Dim oResult = Await _channel.ImportFileAsync(oInfo, oContents, [ReadOnly], RetentionPeriod)
|
Dim oResult = Await _channel.ImportFileAsync(FilePath, oContents, Environment.UserName)
|
||||||
|
|
||||||
Return oResult
|
Return oResult
|
||||||
End Using
|
End Using
|
||||||
@ -75,11 +73,11 @@ Public Class Document
|
|||||||
''' </summary>
|
''' </summary>
|
||||||
''' <param name="FilePath">The filename to import</param>
|
''' <param name="FilePath">The filename to import</param>
|
||||||
''' <returns>A document object</returns>
|
''' <returns>A document object</returns>
|
||||||
Public Function ImportFile(FilePath As String, Optional [ReadOnly] As Boolean = False, Optional RetentionPeriod As Integer = 0) As DocumentResult2
|
Public Function ImportFile(FilePath As String) As DocumentResult2
|
||||||
Try
|
Try
|
||||||
Dim oContents As Byte() = File.ReadAllBytes(FilePath)
|
Dim oContents As Byte() = File.ReadAllBytes(FilePath)
|
||||||
Dim oInfo As New FileInfo(FilePath)
|
Dim oInfo As New FileInfo(FilePath)
|
||||||
Dim oDocObject = _channel.ImportFile(oInfo, oContents, [ReadOnly], RetentionPeriod)
|
Dim oDocObject = _channel.ImportFile(FilePath, oContents, Environment.UserName)
|
||||||
Return oDocObject
|
Return oDocObject
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_logger.Error(ex)
|
_logger.Error(ex)
|
||||||
|
|||||||
@ -141,9 +141,6 @@
|
|||||||
<None Include="Connected Services\EDMIServiceReference\System.Data.xsd">
|
<None Include="Connected Services\EDMIServiceReference\System.Data.xsd">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</None>
|
</None>
|
||||||
<None Include="Connected Services\EDMIServiceReference\System.IO.xsd">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</None>
|
|
||||||
<None Include="Connected Services\EDMIServiceReference\System.xsd">
|
<None Include="Connected Services\EDMIServiceReference\System.xsd">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</None>
|
</None>
|
||||||
|
|||||||
@ -8,6 +8,10 @@
|
|||||||
<add key="FIREBIRD_DATABASE_PASS" value=""/>
|
<add key="FIREBIRD_DATABASE_PASS" value=""/>
|
||||||
<!-- END FIREBIRD SETTINGS -->
|
<!-- END FIREBIRD SETTINGS -->
|
||||||
|
|
||||||
|
<!-- MSSQL SETTINGS -->
|
||||||
|
<add key="MSSQ_CONNECTION_STRING" value=""/>
|
||||||
|
<!-- END MSSQL SETTINGS -->
|
||||||
|
|
||||||
<!-- DATASTORE SETTINGS -->
|
<!-- DATASTORE SETTINGS -->
|
||||||
<add key="DATASTORE_PATH" value=""/>
|
<add key="DATASTORE_PATH" value=""/>
|
||||||
<!-- END DATASTORE SETTINGS -->
|
<!-- END DATASTORE SETTINGS -->
|
||||||
|
|||||||
@ -8,6 +8,7 @@ Public Class AppConfig
|
|||||||
Public Shared ContainerPath As String
|
Public Shared ContainerPath As String
|
||||||
Public Shared ContainerPassword As String
|
Public Shared ContainerPassword As String
|
||||||
Public Shared DatastorePath As String
|
Public Shared DatastorePath As String
|
||||||
|
Public Shared MSSQLConnectionString As String
|
||||||
|
|
||||||
Public Shared Sub Load()
|
Public Shared Sub Load()
|
||||||
With ConfigurationManager.AppSettings
|
With ConfigurationManager.AppSettings
|
||||||
@ -15,9 +16,22 @@ Public Class AppConfig
|
|||||||
FirebirdDatabase = .Item("FIREBIRD_DATABASE_NAME")
|
FirebirdDatabase = .Item("FIREBIRD_DATABASE_NAME")
|
||||||
FirebirdUser = .Item("FIREBIRD_DATABASE_USER")
|
FirebirdUser = .Item("FIREBIRD_DATABASE_USER")
|
||||||
FirebirdPassword = .Item("FIREBIRD_DATABASE_PASS")
|
FirebirdPassword = .Item("FIREBIRD_DATABASE_PASS")
|
||||||
|
|
||||||
|
MSSQLConnectionString = .Item("MSSQL_CONNECTION_STRING")
|
||||||
|
|
||||||
ContainerPath = .Item("CONTAINER_PATH")
|
ContainerPath = .Item("CONTAINER_PATH")
|
||||||
ContainerPassword = .Item("CONTAINER_PASSWORD")
|
ContainerPassword = .Item("CONTAINER_PASSWORD")
|
||||||
|
|
||||||
DatastorePath = .Item("DATASTORE_PATH")
|
DatastorePath = .Item("DATASTORE_PATH")
|
||||||
End With
|
End With
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Public Shared Function IsFirebirdConfigured() As Boolean
|
||||||
|
Dim oProps As New List(Of String) From {FirebirdDataSource, FirebirdDatabase, FirebirdUser, FirebirdPassword}
|
||||||
|
Return Not oProps.Any(Function(Prop) String.IsNullOrWhiteSpace(Prop))
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Shared Function IsMSSQLConfigured() As Boolean
|
||||||
|
Return Not String.IsNullOrWhiteSpace(MSSQLConnectionString)
|
||||||
|
End Function
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
3
Service.EDMIService/Database/IDatabase.vb
Normal file
3
Service.EDMIService/Database/IDatabase.vb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Public Interface IDatabase
|
||||||
|
Function NewDocument(RelativePath As String, AddedWho As String, ObjectStoreId As Int64, ReferenceId As Int64) As Int64
|
||||||
|
End Interface
|
||||||
20
Service.EDMIService/Database/MSSQL.vb
Normal file
20
Service.EDMIService/Database/MSSQL.vb
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
Imports DigitalData.Modules.Database
|
||||||
|
Imports DigitalData.Modules.Logging
|
||||||
|
|
||||||
|
Public Class MSSQL
|
||||||
|
Implements IDatabase
|
||||||
|
|
||||||
|
Private ReadOnly LogConfig As LogConfig
|
||||||
|
Private ReadOnly Database As MSSQLServer
|
||||||
|
Private ReadOnly Logger As Logger
|
||||||
|
|
||||||
|
Public Sub New(LogConfig As LogConfig, Database As MSSQLServer)
|
||||||
|
Me.LogConfig = LogConfig
|
||||||
|
Me.Database = Database
|
||||||
|
Me.Logger = LogConfig.GetLogger()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Function NewDocument(RelativePath As String, AddedWho As String, ObjectStoreId As Long, ReferenceId As Long) As Long Implements IDatabase.NewDocument
|
||||||
|
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
@ -6,13 +6,15 @@ Imports DigitalData.Modules
|
|||||||
Imports System.IO
|
Imports System.IO
|
||||||
Imports System.ServiceModel.Description
|
Imports System.ServiceModel.Description
|
||||||
Imports System.ServiceModel.Channels
|
Imports System.ServiceModel.Channels
|
||||||
|
Imports System.Data.SqlClient
|
||||||
|
|
||||||
<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession)>
|
<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession)>
|
||||||
Public Class EDMIService
|
Public Class EDMIService
|
||||||
Implements IEDMIService
|
Implements IEDMIService
|
||||||
|
|
||||||
Public Shared LogConfig As LogConfig
|
Public Shared LogConfig As LogConfig
|
||||||
Public Shared Database As Firebird
|
Public Shared MSSQL As MSSQLServer
|
||||||
|
Public Shared Firebird As Firebird
|
||||||
Public Shared AppConfig As AppConfig
|
Public Shared AppConfig As AppConfig
|
||||||
Public Shared Filesystem As Filesystem.File
|
Public Shared Filesystem As Filesystem.File
|
||||||
Public Shared EDMIPath As EDMI.File.Path
|
Public Shared EDMIPath As EDMI.File.Path
|
||||||
@ -54,7 +56,7 @@ Public Class EDMIService
|
|||||||
#End Region
|
#End Region
|
||||||
#Region "Request"
|
#Region "Request"
|
||||||
Public Sub CreateRequest(Name As String, Optional Debug As Boolean = False)
|
Public Sub CreateRequest(Name As String, Optional Debug As Boolean = False)
|
||||||
_request = New Request(Name, _username, Database, Debug)
|
_request = New Request(Name, _username, Firebird, Debug)
|
||||||
_debug = Debug
|
_debug = Debug
|
||||||
|
|
||||||
_logger.Info("Creating request {0}/{1}", _request.Name, _request.RequestId)
|
_logger.Info("Creating request {0}/{1}", _request.Name, _request.RequestId)
|
||||||
@ -91,7 +93,7 @@ Public Class EDMIService
|
|||||||
_logger.Info($"ReturnDatatable, SQL: {SQL}")
|
_logger.Info($"ReturnDatatable, SQL: {SQL}")
|
||||||
_request.LogDebug($"ReturnDatatable, SQL: {SQL}")
|
_request.LogDebug($"ReturnDatatable, SQL: {SQL}")
|
||||||
|
|
||||||
Dim oResult As DataTable = Database.GetDatatableWithConnection(SQL, _request.Connection)
|
Dim oResult As DataTable = Firebird.GetDatatableWithConnection(SQL, _request.Connection)
|
||||||
Return New TableResult(oResult)
|
Return New TableResult(oResult)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_logger.Error(ex)
|
_logger.Error(ex)
|
||||||
@ -107,7 +109,7 @@ Public Class EDMIService
|
|||||||
_logger.Info($"ReturnScalar, SQL: {SQL}")
|
_logger.Info($"ReturnScalar, SQL: {SQL}")
|
||||||
_request.LogDebug($"ReturnScalar, SQL: {SQL}")
|
_request.LogDebug($"ReturnScalar, SQL: {SQL}")
|
||||||
|
|
||||||
Dim oResult As Object = Database.GetScalarValueWithConnection(SQL, _request.Connection)
|
Dim oResult As Object = Firebird.GetScalarValueWithConnection(SQL, _request.Connection)
|
||||||
Return New ScalarResult(oResult)
|
Return New ScalarResult(oResult)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_logger.Error(ex)
|
_logger.Error(ex)
|
||||||
@ -123,7 +125,7 @@ Public Class EDMIService
|
|||||||
_logger.Info($"ExecuteNonQuery, SQL: {SQL}")
|
_logger.Info($"ExecuteNonQuery, SQL: {SQL}")
|
||||||
_request.LogDebug($"ExecuteNonQuery, SQL: {SQL}")
|
_request.LogDebug($"ExecuteNonQuery, SQL: {SQL}")
|
||||||
|
|
||||||
Dim oResult As Boolean = Database.ExecuteNonQueryWithConnection(SQL, _request.Connection)
|
Dim oResult As Boolean = Firebird.ExecuteNonQueryWithConnection(SQL, _request.Connection)
|
||||||
Return New NonQueryResult()
|
Return New NonQueryResult()
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_logger.Error(ex)
|
_logger.Error(ex)
|
||||||
@ -152,7 +154,7 @@ Public Class EDMIService
|
|||||||
_logger.Debug("File extension of file {0} is {1}", FileName, oExtension)
|
_logger.Debug("File extension of file {0} is {1}", FileName, oExtension)
|
||||||
|
|
||||||
Dim oSQL = $"SELECT FNICM_NEW_DOC('010', '{oContainerId}', '{GetContainerName(oContainerId)}', '{FileName}', '{oExtension}', '{_username}') FROM RDB$DATABASE;"
|
Dim oSQL = $"SELECT FNICM_NEW_DOC('010', '{oContainerId}', '{GetContainerName(oContainerId)}', '{FileName}', '{oExtension}', '{_username}') FROM RDB$DATABASE;"
|
||||||
Dim oDocId As Int64 = Database.GetScalarValue(oSQL)
|
Dim oDocId As Int64 = Firebird.GetScalarValue(oSQL)
|
||||||
|
|
||||||
If oDocId = -1 Then
|
If oDocId = -1 Then
|
||||||
_logger.Warn("Database returned -1 while creating Document Entry. File was not saved!")
|
_logger.Warn("Database returned -1 while creating Document Entry. File was not saved!")
|
||||||
@ -244,7 +246,7 @@ Public Class EDMIService
|
|||||||
Public Function GetDocumentByDocumentId(DocumentId As Long) As DocumentResult Implements IEDMIService.GetDocumentByDocumentId
|
Public Function GetDocumentByDocumentId(DocumentId As Long) As DocumentResult Implements IEDMIService.GetDocumentByDocumentId
|
||||||
Try
|
Try
|
||||||
Dim oSQL = $"SELECT GUID, CONTAINER_ID, ORIGINAL_FILENAME FROM TBIDB_DOCUMENT WHERE GUID = {DocumentId}"
|
Dim oSQL = $"SELECT GUID, CONTAINER_ID, ORIGINAL_FILENAME FROM TBIDB_DOCUMENT WHERE GUID = {DocumentId}"
|
||||||
Dim oTable = Database.GetDatatable(oSQL)
|
Dim oTable = Firebird.GetDatatable(oSQL)
|
||||||
|
|
||||||
If oTable.Rows.Count = 0 Then
|
If oTable.Rows.Count = 0 Then
|
||||||
Return New DocumentResult("Document not found")
|
Return New DocumentResult("Document not found")
|
||||||
@ -272,7 +274,7 @@ Public Class EDMIService
|
|||||||
Public Function GetDocumentByContainerId(ContainerId As String) As DocumentResult Implements IEDMIService.GetDocumentByContainerId
|
Public Function GetDocumentByContainerId(ContainerId As String) As DocumentResult Implements IEDMIService.GetDocumentByContainerId
|
||||||
Try
|
Try
|
||||||
Dim oSQL = $"SELECT GUID, CONTAINER_ID, ORIGINAL_FILENAME FROM TBIDB_DOCUMENT WHERE CONTAINER_ID = '{ContainerId}'"
|
Dim oSQL = $"SELECT GUID, CONTAINER_ID, ORIGINAL_FILENAME FROM TBIDB_DOCUMENT WHERE CONTAINER_ID = '{ContainerId}'"
|
||||||
Dim oTable = Database.GetDatatable(oSQL)
|
Dim oTable = Firebird.GetDatatable(oSQL)
|
||||||
|
|
||||||
If oTable.Rows.Count = 0 Then
|
If oTable.Rows.Count = 0 Then
|
||||||
Return New DocumentResult("Document not found")
|
Return New DocumentResult("Document not found")
|
||||||
@ -299,11 +301,12 @@ Public Class EDMIService
|
|||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "Document"
|
#Region "Document"
|
||||||
Public Function ImportFile(FileInfo As FileInfo, Contents() As Byte, [Readonly] As Boolean, RetentionPeriod As Integer) As DocumentResult2 Implements IEDMIService.ImportFile
|
Public Function ImportFile(FileName As String, Contents() As Byte, AddedWho As String) As DocumentResult2 Implements IEDMIService.ImportFile
|
||||||
Dim oDocumentType As String = "DummyDocumentType"
|
Dim oDocumentType As String = "DummyDocumentType"
|
||||||
Dim oDirectoryPath = EDMIPath.GetActivePath(oDocumentType)
|
Dim oDirectoryPath = EDMIPath.GetActivePath(oDocumentType)
|
||||||
Dim oFilePath = Path.Combine(oDirectoryPath, FileInfo.Name)
|
Dim oAbsPath = Path.Combine(oDirectoryPath, FileName)
|
||||||
Dim oDocument = New DocumentResult2.DocumentObject() With {.FileName = FileInfo.Name, .FileId = Guid.NewGuid.ToString}
|
Dim oRelativePath = EDMIPath.GetRelativePath(oDocumentType)
|
||||||
|
Dim oDocument = New DocumentResult2.DocumentObject With {.FileName = FileName}
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Directory.CreateDirectory(oDirectoryPath)
|
Directory.CreateDirectory(oDirectoryPath)
|
||||||
@ -313,16 +316,26 @@ Public Class EDMIService
|
|||||||
End Try
|
End Try
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Dim oVersionedFileName As String = Filesystem.GetVersionedFilename(oFilePath)
|
Dim oVersionedFileName As String = Filesystem.GetVersionedFilename(oAbsPath)
|
||||||
|
|
||||||
_logger.Info("Saving file [{0}] to path [{1}]", FileInfo.Name, oVersionedFileName)
|
_logger.Info("Saving file [{0}] to path [{1}]", FileName, oVersionedFileName)
|
||||||
Using oStream = New FileStream(oVersionedFileName, FileMode.CreateNew)
|
Using oStream = New FileStream(oVersionedFileName, FileMode.CreateNew)
|
||||||
oStream.Write(Contents, 0, Contents.Length)
|
oStream.Write(Contents, 0, Contents.Length)
|
||||||
oStream.Flush(True)
|
oStream.Flush(True)
|
||||||
oStream.Close()
|
oStream.Close()
|
||||||
End Using
|
End Using
|
||||||
|
|
||||||
EDMIArchive.SetRetention(oVersionedFileName, RetentionPeriod, [Readonly])
|
' insert into db
|
||||||
|
Dim oCommand As New SqlCommand("PRIDB_NEW_DOCUMENT")
|
||||||
|
oCommand.Parameters.AddWithValue("@OBJ_ST_ID", 1)
|
||||||
|
oCommand.Parameters.AddWithValue("@REL_PATH", oDirectoryPath)
|
||||||
|
oCommand.Parameters.AddWithValue("@WHO", AddedWho)
|
||||||
|
oCommand.Parameters.AddWithValue("@REF_DOCID", 0)
|
||||||
|
oCommand.Parameters.Add(New SqlParameter("@IDB_OBJ_ID", SqlDbType.BigInt))
|
||||||
|
|
||||||
|
Dim oObjectId = MSSQL.GetScalarValue(oCommand, "@IDB_OBJ_ID")
|
||||||
|
|
||||||
|
oDocument.FileId = oObjectId
|
||||||
|
|
||||||
Return New DocumentResult2(oDocument)
|
Return New DocumentResult2(oDocument)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
@ -330,13 +343,14 @@ Public Class EDMIService
|
|||||||
Return New DocumentResult2(ex.Message)
|
Return New DocumentResult2(ex.Message)
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "Index"
|
#Region "Index"
|
||||||
Public Function NewFileIndex(DocObject As DocumentObject, Syskey As String, LanguageCode As String, Value As String) As IndexResult Implements IEDMIService.NewFileIndex
|
Public Function NewFileIndex(DocObject As DocumentObject, Syskey As String, LanguageCode As String, Value As String) As IndexResult Implements IEDMIService.NewFileIndex
|
||||||
Try
|
Try
|
||||||
Dim oSQL = $"SELECT FNIDB_NEW_DOC_VALUE({DocObject.DocumentId},'{Syskey}','{LanguageCode}','{Value}','{_username}') FROM RDB$DATABASE;"
|
Dim oSQL = $"SELECT FNIDB_NEW_DOC_VALUE({DocObject.DocumentId},'{Syskey}','{LanguageCode}','{Value}','{_username}') FROM RDB$DATABASE;"
|
||||||
Dim oIndexId As Int64 = Database.GetScalarValue(oSQL)
|
Dim oIndexId As Int64 = Firebird.GetScalarValue(oSQL)
|
||||||
|
|
||||||
Return New IndexResult(oIndexId)
|
Return New IndexResult(oIndexId)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
|||||||
@ -101,6 +101,8 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AppConfig.vb" />
|
<Compile Include="AppConfig.vb" />
|
||||||
|
<Compile Include="Database\IDatabase.vb" />
|
||||||
|
<Compile Include="Database\MSSQL.vb" />
|
||||||
<Compile Include="Results\BaseResult.vb" />
|
<Compile Include="Results\BaseResult.vb" />
|
||||||
<Compile Include="Results\ContainerResult.vb" />
|
<Compile Include="Results\ContainerResult.vb" />
|
||||||
<Compile Include="Results\DocumentResult.vb" />
|
<Compile Include="Results\DocumentResult.vb" />
|
||||||
|
|||||||
@ -49,7 +49,7 @@ Interface IEDMIService
|
|||||||
|
|
||||||
#Region "Document (New)"
|
#Region "Document (New)"
|
||||||
<OperationContract>
|
<OperationContract>
|
||||||
Function ImportFile(FileInfo As FileInfo, Contents As Byte(), [ReadOnly] As Boolean, RetentionTime As Integer) As DocumentResult2
|
Function ImportFile(FileName As String, Contents As Byte(), AddedWho As String) As DocumentResult2
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "Index"
|
#Region "Index"
|
||||||
|
|||||||
@ -13,8 +13,10 @@ Public Class WindowsService
|
|||||||
|
|
||||||
Private _logConfig As LogConfig
|
Private _logConfig As LogConfig
|
||||||
Private _logger As Logger
|
Private _logger As Logger
|
||||||
Private _db As Firebird
|
|
||||||
Private _clientsConnected As Integer = 0
|
Private _firebird As Firebird
|
||||||
|
Private _mssql As MSSQLServer
|
||||||
|
|
||||||
Private _config As AppConfig
|
Private _config As AppConfig
|
||||||
Private _Path As EDMI.File.Path
|
Private _Path As EDMI.File.Path
|
||||||
Private _Archive As EDMI.File.Archive
|
Private _Archive As EDMI.File.Archive
|
||||||
@ -39,17 +41,28 @@ Public Class WindowsService
|
|||||||
_logger = _logConfig.GetLogger()
|
_logger = _logConfig.GetLogger()
|
||||||
|
|
||||||
_logger.Info("Service {0} is starting...", SERVICE_DISPLAY_NAME)
|
_logger.Info("Service {0} is starting...", SERVICE_DISPLAY_NAME)
|
||||||
_logger.Debug("Connecting to database...")
|
|
||||||
|
|
||||||
_db = New Firebird(
|
If AppConfig.IsFirebirdConfigured() Then
|
||||||
_logConfig,
|
_logger.Debug("Connecting to Firebird...")
|
||||||
AppConfig.FirebirdDataSource,
|
_firebird = New Firebird(
|
||||||
AppConfig.FirebirdDatabase,
|
_logConfig,
|
||||||
AppConfig.FirebirdUser,
|
AppConfig.FirebirdDataSource,
|
||||||
AppConfig.FirebirdPassword
|
AppConfig.FirebirdDatabase,
|
||||||
)
|
AppConfig.FirebirdUser,
|
||||||
|
AppConfig.FirebirdPassword
|
||||||
|
)
|
||||||
|
_logger.Info("Database connection established.")
|
||||||
|
Else
|
||||||
|
_logger.Info("Firebird is not configured, will not be used!")
|
||||||
|
End If
|
||||||
|
|
||||||
_logger.Info("Database connection established.")
|
If AppConfig.IsMSSQLConfigured() Then
|
||||||
|
_logger.Debug("Connecting to MSSQL...")
|
||||||
|
_mssql = New MSSQLServer(_logConfig, AppConfig.MSSQLConnectionString)
|
||||||
|
_logger.Info("Database connection established.")
|
||||||
|
Else
|
||||||
|
_logger.Info("MSSQL is not configured, will not be used!")
|
||||||
|
End If
|
||||||
|
|
||||||
_logger.Debug("Initializing EDMI Functions")
|
_logger.Debug("Initializing EDMI Functions")
|
||||||
|
|
||||||
@ -57,9 +70,10 @@ Public Class WindowsService
|
|||||||
_Archive = New EDMI.File.Archive(_logConfig)
|
_Archive = New EDMI.File.Archive(_logConfig)
|
||||||
_filesystem = New Filesystem.File(_logConfig)
|
_filesystem = New Filesystem.File(_logConfig)
|
||||||
|
|
||||||
_logger.Debug("EDMI Functions initialized.")
|
_logger.Info("EDMI Functions initialized.")
|
||||||
|
|
||||||
EDMIService.Database = _db
|
EDMIService.MSSQL = _mssql
|
||||||
|
EDMIService.Firebird = _firebird
|
||||||
EDMIService.LogConfig = _logConfig
|
EDMIService.LogConfig = _logConfig
|
||||||
EDMIService.AppConfig = _config
|
EDMIService.AppConfig = _config
|
||||||
EDMIService.EDMIArchive = _Archive
|
EDMIService.EDMIArchive = _Archive
|
||||||
@ -71,7 +85,7 @@ Public Class WindowsService
|
|||||||
_serviceHost = New ServiceHost(GetType(EDMIService))
|
_serviceHost = New ServiceHost(GetType(EDMIService))
|
||||||
_serviceHost.Open()
|
_serviceHost.Open()
|
||||||
|
|
||||||
_logger.Debug("WCF ServiceHost started.")
|
_logger.Info("WCF ServiceHost started.")
|
||||||
|
|
||||||
_logger.Info("Service {0} successfully started.", SERVICE_DISPLAY_NAME)
|
_logger.Info("Service {0} successfully started.", SERVICE_DISPLAY_NAME)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user