From c681bfb6744d9a902f9ee3b90ae65c27ebf21cfd Mon Sep 17 00:00:00 2001 From: Digital Data - Marlon Schreiber Date: Thu, 11 Mar 2021 09:37:24 +0100 Subject: [PATCH] MS FlowSearch EDMIService ObjectAdd --- GUIs.ZooFlow/App.config | 10 ++ GUIs.ZooFlow/My Project/Settings.Designer.vb | 14 +- GUIs.ZooFlow/My Project/Settings.settings | 3 + GUIs.ZooFlow/Search/frmFlowSearch.Designer.vb | 1 + GUIs.ZooFlow/Search/frmFlowSearch.vb | 36 +++-- GUIs.ZooFlow/frmFlowForm.vb | 2 + GUIs.ZooFlow/frmtest.Designer.vb | 133 +++++++++++++----- GUIs.ZooFlow/frmtest.vb | 30 +++- Modules.EDMIAPI/Client.vb | 28 ++++ ...nce.DocumentImportIDBFOResponse.datasource | 10 ++ .../DigitalData.Services.EDMIService.wsdl | 28 ++++ .../DigitalData.Services.EDMIService.xsd | 34 +++++ .../EDMIServiceReference/Reference.vb | 112 +++++++++++++++ .../EDMIServiceReference/service.wsdl | 24 ++++ Modules.EDMIAPI/EDMI.API.vbproj | 3 + Service.EDMIService/EDMIService.vb | 43 ++++++ Service.EDMIService/Helpers/Messages.vb | 21 +++ Service.EDMIService/IEDMIService.vb | 7 + 18 files changed, 484 insertions(+), 55 deletions(-) create mode 100644 Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Modules.EDMI.API.EDMIServiceReference.DocumentImportIDBFOResponse.datasource diff --git a/GUIs.ZooFlow/App.config b/GUIs.ZooFlow/App.config index a9a7426a..1752fe92 100644 --- a/GUIs.ZooFlow/App.config +++ b/GUIs.ZooFlow/App.config @@ -5,6 +5,9 @@
+ +
+ --> + + + + 17255 + + + \ No newline at end of file diff --git a/GUIs.ZooFlow/My Project/Settings.Designer.vb b/GUIs.ZooFlow/My Project/Settings.Designer.vb index 18419c23..1f07a27d 100644 --- a/GUIs.ZooFlow/My Project/Settings.Designer.vb +++ b/GUIs.ZooFlow/My Project/Settings.Designer.vb @@ -14,7 +14,7 @@ Option Explicit On _ Partial Friend NotInheritable Class Settings Inherits Global.System.Configuration.ApplicationSettingsBase @@ -94,6 +94,18 @@ Partial Friend NotInheritable Class Settings Return CType(Me("DD_ECM_TESTConnectionString"),String) End Get End Property + + _ + Public Property IDBOBJID() As String + Get + Return CType(Me("IDBOBJID"),String) + End Get + Set + Me("IDBOBJID") = value + End Set + End Property End Class Namespace My diff --git a/GUIs.ZooFlow/My Project/Settings.settings b/GUIs.ZooFlow/My Project/Settings.settings index 4cc84e61..3c2ac50d 100644 --- a/GUIs.ZooFlow/My Project/Settings.settings +++ b/GUIs.ZooFlow/My Project/Settings.settings @@ -28,5 +28,8 @@ </SerializableConnectionString> Data Source=SDD-VMP04-SQL17\DD_DEVELOP01;Initial Catalog=DD_ECM_TEST;Persist Security Info=True;User ID=sa;Password=dd + + 17255 + \ No newline at end of file diff --git a/GUIs.ZooFlow/Search/frmFlowSearch.Designer.vb b/GUIs.ZooFlow/Search/frmFlowSearch.Designer.vb index 34869f95..025300ae 100644 --- a/GUIs.ZooFlow/Search/frmFlowSearch.Designer.vb +++ b/GUIs.ZooFlow/Search/frmFlowSearch.Designer.vb @@ -456,6 +456,7 @@ Partial Class frmFlowSearch Me.Controls.Add(Me.RibbonStatusBar1) Me.Controls.Add(Me.RibbonControl1) Me.IconOptions.Image = Global.DigitalData.GUIs.ZooFlow.My.Resources.Resources.Flow + Me.KeyPreview = True Me.Name = "frmFlowSearch" Me.Ribbon = Me.RibbonControl1 Me.StatusBar = Me.RibbonStatusBar1 diff --git a/GUIs.ZooFlow/Search/frmFlowSearch.vb b/GUIs.ZooFlow/Search/frmFlowSearch.vb index 97c291df..643c3eb6 100644 --- a/GUIs.ZooFlow/Search/frmFlowSearch.vb +++ b/GUIs.ZooFlow/Search/frmFlowSearch.vb @@ -75,20 +75,7 @@ Public Class frmFlowSearch End Sub Private Sub txtSearch_TextChanged(sender As Object, e As EventArgs) Handles txtSearchTerm.TextChanged - Try - - If txtSearchTerm.Text = String.Empty Then - Reset_Form() - Exit Sub - End If - lblFoundResult.Visible = False - Start_FlowSearch() - Catch ex As Exception - lblFoundResult.Text = "Unexpected error in FlowSearch - Check Your log" - lblFoundResult.Visible = True - Logger.Error(ex) - End Try End Sub Sub Reset_Form() TileControlMatch.Groups.Clear() @@ -146,9 +133,11 @@ Public Class frmFlowSearch oNewTable = oNewTable.DefaultView.ToTable '#### CREATE THE GROUPS FOR EACH ATTRIBUTE #### + Dim oCountGroup As Int16 = 0 For Each oGroupRow As DataRow In oNewTable.Rows + oCountGroup += 1 Dim oGroup As New TileGroup - oGroup.Text = $"{oGroupRow.Item(0).ToString} ({oGroupRow.Item(1).ToString} {Language_Term_Object})" + oGroup.Text = $"[{oCountGroup}] {oGroupRow.Item(0).ToString} ({oGroupRow.Item(1).ToString} {Language_Term_Object})" oGroup.Tag = oGroupRow.Item(0) oGroup.Visible = True For Each oitemRow As DataRow In oResultsfromSearchDT.Rows @@ -259,7 +248,7 @@ Public Class frmFlowSearch End Function Private Function GetResultString(CountObjects As Integer, CountAttribute As Integer, SearchContent As String) As String Dim oResultString = $"wurden {CountObjects} Objekte" ' IIf(CountAttribute = 1, $"wurden {CountObjects} Objekte", $"wurden {CountObjects} Objekte in {CountAttribute} Attributen") - Dim oProfileString = IIf(CountAttribute = 1, "einem Attribut", $"{CountAttribute} Attributen") + Dim oProfileString = IIf(CountAttribute = 1, "[einem] Attribut", $"[{CountAttribute}] Attributen") Dim oBase = "Es {0} in {1} für Ihre Suche nach '{2}' gefunden:" Return String.Format(oBase, oResultString, oProfileString, SearchContent) @@ -538,5 +527,22 @@ Public Class frmFlowSearch Start_FlowSearch() End Sub + Private Sub txtSearchTerm_KeyUp(sender As Object, e As KeyEventArgs) Handles txtSearchTerm.KeyUp + If e.KeyCode = Keys.Return Then + Try + If txtSearchTerm.Text = String.Empty Then + Reset_Form() + Exit Sub + End If + lblFoundResult.Visible = False + Start_FlowSearch() + Catch ex As Exception + lblFoundResult.Text = "Unexpected error in FlowSearch - Check Your log" + lblFoundResult.Visible = True + Logger.Error(ex) + End Try + End If + + End Sub End Class \ No newline at end of file diff --git a/GUIs.ZooFlow/frmFlowForm.vb b/GUIs.ZooFlow/frmFlowForm.vb index aba37363..90e0e7f6 100644 --- a/GUIs.ZooFlow/frmFlowForm.vb +++ b/GUIs.ZooFlow/frmFlowForm.vb @@ -1002,6 +1002,8 @@ Public Class frmFlowForm End Sub Private Sub TestToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles TestToolStripMenuItem.Click + frmtest.Show() + End Sub End Class diff --git a/GUIs.ZooFlow/frmtest.Designer.vb b/GUIs.ZooFlow/frmtest.Designer.vb index 14930530..bf4ee5fc 100644 --- a/GUIs.ZooFlow/frmtest.Designer.vb +++ b/GUIs.ZooFlow/frmtest.Designer.vb @@ -22,83 +22,142 @@ Partial Class frmtest 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. _ Private Sub InitializeComponent() - Me.txtIDBOBJID = New System.Windows.Forms.TextBox() - Me.Label1 = New System.Windows.Forms.Label() Me.txtFilestoreType = New System.Windows.Forms.TextBox() Me.Button1 = New System.Windows.Forms.Button() - Me.txtResult = New System.Windows.Forms.TextBox() + Me.txtIDBFOPath = New System.Windows.Forms.TextBox() Me.txtDate = New System.Windows.Forms.TextBox() + Me.Label2 = New System.Windows.Forms.Label() + Me.Label3 = New System.Windows.Forms.Label() + Me.Button2 = New System.Windows.Forms.Button() + Me.txtIDB_OBJ_ID = New System.Windows.Forms.TextBox() + Me.Button3 = New System.Windows.Forms.Button() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.Label1 = New System.Windows.Forms.Label() Me.SuspendLayout() ' - 'txtIDBOBJID - ' - Me.txtIDBOBJID.Location = New System.Drawing.Point(27, 29) - Me.txtIDBOBJID.Name = "txtIDBOBJID" - Me.txtIDBOBJID.Size = New System.Drawing.Size(100, 20) - Me.txtIDBOBJID.TabIndex = 0 - ' - 'Label1 - ' - Me.Label1.AutoSize = True - Me.Label1.Location = New System.Drawing.Point(24, 13) - Me.Label1.Name = "Label1" - Me.Label1.Size = New System.Drawing.Size(61, 13) - Me.Label1.TabIndex = 1 - Me.Label1.Text = "IDB ObJ ID" - ' 'txtFilestoreType ' - Me.txtFilestoreType.Location = New System.Drawing.Point(157, 29) + Me.txtFilestoreType.Location = New System.Drawing.Point(16, 62) Me.txtFilestoreType.Name = "txtFilestoreType" Me.txtFilestoreType.Size = New System.Drawing.Size(100, 20) Me.txtFilestoreType.TabIndex = 2 ' 'Button1 ' - Me.Button1.Location = New System.Drawing.Point(293, 25) + Me.Button1.Location = New System.Drawing.Point(152, 58) Me.Button1.Name = "Button1" - Me.Button1.Size = New System.Drawing.Size(75, 23) + Me.Button1.Size = New System.Drawing.Size(137, 23) Me.Button1.TabIndex = 3 - Me.Button1.Text = "getFileName" + Me.Button1.Text = "2. GetFileName" Me.Button1.UseVisualStyleBackColor = True ' - 'txtResult + 'txtIDBFOPath ' - Me.txtResult.Location = New System.Drawing.Point(293, 54) - Me.txtResult.Name = "txtResult" - Me.txtResult.ReadOnly = True - Me.txtResult.Size = New System.Drawing.Size(495, 20) - Me.txtResult.TabIndex = 4 + Me.txtIDBFOPath.Location = New System.Drawing.Point(152, 87) + Me.txtIDBFOPath.Name = "txtIDBFOPath" + Me.txtIDBFOPath.ReadOnly = True + Me.txtIDBFOPath.Size = New System.Drawing.Size(495, 20) + Me.txtIDBFOPath.TabIndex = 4 ' 'txtDate ' - Me.txtDate.Location = New System.Drawing.Point(157, 55) + Me.txtDate.Location = New System.Drawing.Point(16, 101) Me.txtDate.Name = "txtDate" Me.txtDate.Size = New System.Drawing.Size(100, 20) Me.txtDate.TabIndex = 5 ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(16, 43) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(72, 13) + Me.Label2.TabIndex = 6 + Me.Label2.Text = "FileStoreType" + ' + 'Label3 + ' + Me.Label3.AutoSize = True + Me.Label3.Location = New System.Drawing.Point(16, 85) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(30, 13) + Me.Label3.TabIndex = 7 + Me.Label3.Text = "Date" + ' + 'Button2 + ' + Me.Button2.Location = New System.Drawing.Point(12, 12) + Me.Button2.Name = "Button2" + Me.Button2.Size = New System.Drawing.Size(277, 23) + Me.Button2.TabIndex = 8 + Me.Button2.Text = "1. Get IDB_OBJ_ID" + Me.Button2.UseVisualStyleBackColor = True + ' + 'txtIDB_OBJ_ID + ' + Me.txtIDB_OBJ_ID.DataBindings.Add(New System.Windows.Forms.Binding("Text", Global.DigitalData.GUIs.ZooFlow.Settings.Default, "IDBOBJID", True, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)) + Me.txtIDB_OBJ_ID.Location = New System.Drawing.Point(295, 12) + Me.txtIDB_OBJ_ID.Name = "txtIDB_OBJ_ID" + Me.txtIDB_OBJ_ID.Size = New System.Drawing.Size(100, 20) + Me.txtIDB_OBJ_ID.TabIndex = 9 + Me.txtIDB_OBJ_ID.Text = Global.DigitalData.GUIs.ZooFlow.Settings.Default.IDBOBJID + ' + 'Button3 + ' + Me.Button3.Location = New System.Drawing.Point(16, 188) + Me.Button3.Name = "Button3" + Me.Button3.Size = New System.Drawing.Size(175, 23) + Me.Button3.TabIndex = 10 + Me.Button3.Text = "3. Import/StreamFile" + Me.Button3.UseVisualStyleBackColor = True + ' + 'TextBox1 + ' + Me.TextBox1.Location = New System.Drawing.Point(16, 162) + Me.TextBox1.Name = "TextBox1" + Me.TextBox1.Size = New System.Drawing.Size(631, 20) + Me.TextBox1.TabIndex = 11 + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(16, 143) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(58, 13) + Me.Label1.TabIndex = 12 + Me.Label1.Text = "File2Import" + ' 'frmtest ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(800, 450) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.TextBox1) + Me.Controls.Add(Me.Button3) + Me.Controls.Add(Me.txtIDB_OBJ_ID) + Me.Controls.Add(Me.Button2) + Me.Controls.Add(Me.Label3) + Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.txtDate) - Me.Controls.Add(Me.txtResult) + Me.Controls.Add(Me.txtIDBFOPath) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.txtFilestoreType) - Me.Controls.Add(Me.Label1) - Me.Controls.Add(Me.txtIDBOBJID) Me.Name = "frmtest" Me.Text = "frmtest" Me.ResumeLayout(False) Me.PerformLayout() End Sub - - Friend WithEvents txtIDBOBJID As TextBox - Friend WithEvents Label1 As Label Friend WithEvents txtFilestoreType As TextBox Friend WithEvents Button1 As Button - Friend WithEvents txtResult As TextBox + Friend WithEvents txtIDBFOPath As TextBox Friend WithEvents txtDate As TextBox + Friend WithEvents Label2 As Label + Friend WithEvents Label3 As Label + Friend WithEvents Button2 As Button + Friend WithEvents txtIDB_OBJ_ID As TextBox + Friend WithEvents Button3 As Button + Friend WithEvents TextBox1 As TextBox + Friend WithEvents Label1 As Label End Class diff --git a/GUIs.ZooFlow/frmtest.vb b/GUIs.ZooFlow/frmtest.vb index 7078a161..1d172292 100644 --- a/GUIs.ZooFlow/frmtest.vb +++ b/GUIs.ZooFlow/frmtest.vb @@ -1,10 +1,36 @@  Imports DigitalData.Modules.Logging Imports DigitalData.Modules.EDMI.API +Imports System.IO + Public Class frmtest Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click + My.Settings.Save() Dim oString As String - oString = _Client.NewFileStoreObject(txtIDBOBJID.Text, txtFilestoreType.Text, txtDate.Text) - txtResult.Text = oString + oString = _Client.NewFileStoreObject(txtIDB_OBJ_ID.Text, txtFilestoreType.Text, txtDate.Text) + txtIDBFOPath.Text = oString + End Sub + + Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click + Dim oString As String + oString = _Client.NewIDB_OBJ_ID("DOC", My.Application.User.UserName, "") + txtIDB_OBJ_ID.Text = oString + End Sub + + Private Async Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click + Dim oResult As Boolean + Dim oStream As New FileStream(TextBox1.Text, FileMode.Open) + Dim oContents(oStream.Length) As Byte + Dim oBytesRead = Await oStream.ReadAsync(oContents, 0, oStream.Length) + + + + oResult = Await _Client.ImportIDBFOAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, 1, txtIDBFOPath.Text) + If oResult = False Then + MsgBox("Oh no error", MsgBoxStyle.Critical) + Else + MsgBox("#Nailedit") + + End If End Sub End Class \ No newline at end of file diff --git a/Modules.EDMIAPI/Client.vb b/Modules.EDMIAPI/Client.vb index c7a2e033..e3c3411e 100644 --- a/Modules.EDMIAPI/Client.vb +++ b/Modules.EDMIAPI/Client.vb @@ -290,4 +290,32 @@ Public Class Client Throw ex End Try End Function + Public Function NewIDB_OBJ_ID(pKindType As String, pWho As String, pBusinessEntity As String) As Long + Try + Dim oResponse = _channel.New_IDB_OBJECT(pKindType, pWho, pBusinessEntity) + Return oResponse + Catch ex As Exception + _logger.Error(ex) + Throw ex + End Try + End Function + Public Async Function ImportIDBFOAsync(pContent As Byte(), pWho As String, pIDB_OBJ_ID As Long, pObjectStoreID As Short, pIDBFOPath As String) As Task(Of Boolean) + Try + Dim oData As New DocumentImportIDBFORequest() With { + .Contents = pContent, + .pWho = pWho, + .pIDBFilePath = pIDBFOPath, + .pIDB_OBJ_ID = pIDB_OBJ_ID, + .pObjectStoreID = pObjectStoreID + } + + Dim oResponse = Await _channel.ImportNewIDBFOAsync(oData) + + Return oResponse.Result + + Catch ex As Exception + _logger.Error(ex) + Throw ex + End Try + End Function End Class diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Modules.EDMI.API.EDMIServiceReference.DocumentImportIDBFOResponse.datasource b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Modules.EDMI.API.EDMIServiceReference.DocumentImportIDBFOResponse.datasource new file mode 100644 index 00000000..6d491231 --- /dev/null +++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Modules.EDMI.API.EDMIServiceReference.DocumentImportIDBFOResponse.datasource @@ -0,0 +1,10 @@ + + + + DigitalData.Modules.EDMI.API.EDMIServiceReference.DocumentImportIDBFOResponse, Connected Services.EDMIServiceReference.Reference.vb.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.wsdl b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.wsdl index a8ddd74d..575b7946 100644 --- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.wsdl +++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.wsdl @@ -160,6 +160,24 @@ + + + + + + + + + + + + + + + + + + @@ -242,5 +260,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.xsd b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.xsd index e1afd00e..1f5add91 100644 --- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.xsd +++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/DigitalData.Services.EDMIService.xsd @@ -242,4 +242,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.vb b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.vb index 9c121b2e..251d8f4a 100644 --- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.vb +++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/Reference.vb @@ -454,6 +454,25 @@ Namespace EDMIServiceReference _ Function New_FileStore_ObjectAsync(ByVal IDB_OBJ_ID As Long, ByVal pStoreType As String, ByVal pDate As String) As System.Threading.Tasks.Task(Of String) + + _ + Function New_IDB_OBJECT(ByVal KindType As String, ByVal pWho As String, ByVal pBusinessEntity As String) As String + + _ + Function New_IDB_OBJECTAsync(ByVal KindType As String, ByVal pWho As String, ByVal pBusinessEntity As String) As System.Threading.Tasks.Task(Of String) + + 'CODEGEN: Der Nachrichtenvertrag wird generiert, da der Wrappername (DocumentImportIDBFORequest) von Nachricht "DocumentImportIDBFORequest" nicht mit dem Standardwert (ImportNewIDBFO) übereinstimmt. + _ + Function ImportNewIDBFO(ByVal request As EDMIServiceReference.DocumentImportIDBFORequest) As EDMIServiceReference.DocumentImportIDBFOResponse + + _ + Function ImportNewIDBFOAsync(ByVal request As EDMIServiceReference.DocumentImportIDBFORequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentImportIDBFOResponse) End Interface _ + Partial Public Class DocumentImportIDBFORequest + + _ + Public Contents() As Byte + + _ + Public pIDBFilePath As String + + _ + Public pIDB_OBJ_ID As Long + + _ + Public pObjectStoreID As Integer + + _ + Public pWho As String + + Public Sub New() + MyBase.New + End Sub + + Public Sub New(ByVal Contents() As Byte, ByVal pIDBFilePath As String, ByVal pIDB_OBJ_ID As Long, ByVal pObjectStoreID As Integer, ByVal pWho As String) + MyBase.New + Me.Contents = Contents + Me.pIDBFilePath = pIDBFilePath + Me.pIDB_OBJ_ID = pIDB_OBJ_ID + Me.pObjectStoreID = pObjectStoreID + Me.pWho = pWho + End Sub + End Class + + _ + Partial Public Class DocumentImportIDBFOResponse + + _ + Public Result As Boolean + + Public Sub New() + MyBase.New + End Sub + + Public Sub New(ByVal Result As Boolean) + MyBase.New + Me.Result = Result + End Sub + End Class + _ Public Interface IEDMIServiceChannel Inherits EDMIServiceReference.IEDMIService, System.ServiceModel.IClientChannel @@ -846,5 +919,44 @@ Namespace EDMIServiceReference Public Function New_FileStore_ObjectAsync(ByVal IDB_OBJ_ID As Long, ByVal pStoreType As String, ByVal pDate As String) As System.Threading.Tasks.Task(Of String) Implements EDMIServiceReference.IEDMIService.New_FileStore_ObjectAsync Return MyBase.Channel.New_FileStore_ObjectAsync(IDB_OBJ_ID, pStoreType, pDate) End Function + + Public Function New_IDB_OBJECT(ByVal KindType As String, ByVal pWho As String, ByVal pBusinessEntity As String) As String Implements EDMIServiceReference.IEDMIService.New_IDB_OBJECT + Return MyBase.Channel.New_IDB_OBJECT(KindType, pWho, pBusinessEntity) + End Function + + Public Function New_IDB_OBJECTAsync(ByVal KindType As String, ByVal pWho As String, ByVal pBusinessEntity As String) As System.Threading.Tasks.Task(Of String) Implements EDMIServiceReference.IEDMIService.New_IDB_OBJECTAsync + Return MyBase.Channel.New_IDB_OBJECTAsync(KindType, pWho, pBusinessEntity) + End Function + + _ + Function EDMIServiceReference_IEDMIService_ImportNewIDBFO(ByVal request As EDMIServiceReference.DocumentImportIDBFORequest) As EDMIServiceReference.DocumentImportIDBFOResponse Implements EDMIServiceReference.IEDMIService.ImportNewIDBFO + Return MyBase.Channel.ImportNewIDBFO(request) + End Function + + Public Function ImportNewIDBFO(ByVal Contents() As Byte, ByVal pIDBFilePath As String, ByVal pIDB_OBJ_ID As Long, ByVal pObjectStoreID As Integer, ByVal pWho As String) As Boolean + Dim inValue As EDMIServiceReference.DocumentImportIDBFORequest = New EDMIServiceReference.DocumentImportIDBFORequest() + inValue.Contents = Contents + inValue.pIDBFilePath = pIDBFilePath + inValue.pIDB_OBJ_ID = pIDB_OBJ_ID + inValue.pObjectStoreID = pObjectStoreID + inValue.pWho = pWho + Dim retVal As EDMIServiceReference.DocumentImportIDBFOResponse = CType(Me,EDMIServiceReference.IEDMIService).ImportNewIDBFO(inValue) + Return retVal.Result + End Function + + _ + Function EDMIServiceReference_IEDMIService_ImportNewIDBFOAsync(ByVal request As EDMIServiceReference.DocumentImportIDBFORequest) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentImportIDBFOResponse) Implements EDMIServiceReference.IEDMIService.ImportNewIDBFOAsync + Return MyBase.Channel.ImportNewIDBFOAsync(request) + End Function + + Public Function ImportNewIDBFOAsync(ByVal Contents() As Byte, ByVal pIDBFilePath As String, ByVal pIDB_OBJ_ID As Long, ByVal pObjectStoreID As Integer, ByVal pWho As String) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentImportIDBFOResponse) + Dim inValue As EDMIServiceReference.DocumentImportIDBFORequest = New EDMIServiceReference.DocumentImportIDBFORequest() + inValue.Contents = Contents + inValue.pIDBFilePath = pIDBFilePath + inValue.pIDB_OBJ_ID = pIDB_OBJ_ID + inValue.pObjectStoreID = pObjectStoreID + inValue.pWho = pWho + Return CType(Me,EDMIServiceReference.IEDMIService).ImportNewIDBFOAsync(inValue) + End Function End Class End Namespace diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/service.wsdl b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/service.wsdl index adb07e09..54f74fff 100644 --- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/service.wsdl +++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/service.wsdl @@ -237,6 +237,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Modules.EDMIAPI/EDMI.API.vbproj b/Modules.EDMIAPI/EDMI.API.vbproj index e6fb780c..b81b7d70 100644 --- a/Modules.EDMIAPI/EDMI.API.vbproj +++ b/Modules.EDMIAPI/EDMI.API.vbproj @@ -106,6 +106,9 @@ + + Reference.svcmap + Reference.svcmap diff --git a/Service.EDMIService/EDMIService.vb b/Service.EDMIService/EDMIService.vb index e61b6539..f498fbc8 100644 --- a/Service.EDMIService/EDMIService.vb +++ b/Service.EDMIService/EDMIService.vb @@ -551,6 +551,49 @@ Public Class EDMIService Return "" End Try End Function + + Public Function NewIDB_Object(pKindType As String, pWho As String, pBusinessEntity As String) As String Implements IEDMIService.New_IDB_OBJECT + Try + Dim oSQL As String = $"DECLARE @NEW_IDB_OBJ_ID BIGINT + EXEC PRIDB_NEW_OBJECT '{pKindType}','{pWho}','{pBusinessEntity}',0, @IDB_OBJ_ID = @NEW_IDB_OBJ_ID OUTPUT; + SELECT @NEW_IDB_OBJ_ID" + Dim oObjectId = MSSQL_IDB.GetScalarValue(oSQL) + Return oObjectId + Catch ex As Exception + _Logger.Error(ex) + Return 0 + End Try + End Function + Public Function ImportFileIDBFO(Data As DocumentImportIDBFORequest) As DocumentImportIDBFOResponse Implements IEDMIService.ImportNewIDBFO + Dim oObjectStore = GlobalState.ObjectStores.First() + Dim EDMIPath = New EDMI.File.Path(LogConfig, oObjectStore.Path) + + Try + _Logger.Info("ImportFile: Saving file to path [{0}]", Data.pIDBFilePath) + Using oStream = New FileStream(Data.pIDBFilePath, FileMode.CreateNew) + oStream.Write(Data.Contents, 0, Data.Contents.Length) + oStream.Flush(True) + oStream.Close() + End Using + + ' insert into db + Dim oSQL As String = $"EXEC PRIDB_NEW_IDBFO '{Data.pIDBFilePath},'{Data.pWho}','{Data.pIDB_OBJ_ID}',{Data.pObjectStoreID}" + + Dim oResult As Boolean = MSSQL_IDB.ExecuteNonQuery(oSQL) + + Return New DocumentImportIDBFOResponse() With {.Result = oResult} + + Catch ex As FaultException + _Logger.Error(ex) + Throw ex + + Catch ex As Exception + _Logger.Error(ex) + Dim oDetails As New UnexpectedErrorFault(ex) + Throw New FaultException(Of UnexpectedErrorFault)(oDetails, oDetails.ErrorMessage) + + End Try + End Function Private Function GetDigitalDataFileObject(IDB_OBJ_ID As Long) As String Return $"{IDB_OBJ_ID}.ddfo" End Function diff --git a/Service.EDMIService/Helpers/Messages.vb b/Service.EDMIService/Helpers/Messages.vb index aa5c8d00..c224fce6 100644 --- a/Service.EDMIService/Helpers/Messages.vb +++ b/Service.EDMIService/Helpers/Messages.vb @@ -26,6 +26,27 @@ Namespace Messages Public ObjectId As Long End Class #End Region +#Region "DocumentImportIDBFO" + + Public Class DocumentImportIDBFORequest + + Public Contents() As Byte + + Public pWho As String + + Public pIDBFilePath As String + + Public pIDB_OBJ_ID As Long + + Public pObjectStoreID As Integer + End Class + + + Public Class DocumentImportIDBFOResponse + + Public Result As Boolean + End Class +#End Region #Region "DocumentStream" diff --git a/Service.EDMIService/IEDMIService.vb b/Service.EDMIService/IEDMIService.vb index f266c362..6367bcca 100644 --- a/Service.EDMIService/IEDMIService.vb +++ b/Service.EDMIService/IEDMIService.vb @@ -82,6 +82,13 @@ Interface IEDMIService Function New_FileStore_Object(IDB_OBJ_ID As Long, pStoreType As String, pDate As String) As String + + + Function New_IDB_OBJECT(KindType As String, pWho As String, pBusinessEntity As String) As String + + + + Function ImportNewIDBFO(Data As DocumentImportIDBFORequest) As DocumentImportIDBFOResponse #End Region End Interface \ No newline at end of file