96 lines
3.7 KiB
VB.net
96 lines
3.7 KiB
VB.net
|
|
Imports DigitalData.Modules.Logging
|
|
Imports DigitalData.Modules.EDMI.API
|
|
Imports System.IO
|
|
Imports System.Text
|
|
|
|
Public Class frmtest
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
My.Settings.Save()
|
|
Dim oString As String
|
|
Dim oextension = ""
|
|
Dim oKeepExtension As Boolean = False
|
|
If CheckBoxKeepExtension.Checked Then
|
|
If txtFile2Import.Text <> String.Empty Then
|
|
oextension = Path.GetExtension(txtFile2Import.Text)
|
|
oKeepExtension = True
|
|
End If
|
|
|
|
End If
|
|
oString = My.Application.Service.Client.NewFileStoreObject(txtIDB_OBJ_ID.Text, txtFilestoreType.Text, txtDate.Text, oextension, oKeepExtension)
|
|
txtIDBFOPath.Text = oString
|
|
|
|
End Sub
|
|
|
|
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
|
Dim oString As String
|
|
oString = My.Application.Service.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
|
|
Try
|
|
Dim oResult As Boolean = False
|
|
|
|
Using oStream As New FileStream(txtFile2Import.Text, FileMode.Open, FileAccess.Read)
|
|
Using oMemoryStream As New MemoryStream
|
|
oStream.CopyTo(oMemoryStream)
|
|
Dim oContents As Byte() = oMemoryStream.ToArray()
|
|
oResult = Await My.Application.Service.Client.ImportIDBFOAsync(oContents, My.Application.User.UserName, txtIDB_OBJ_ID.Text, 1, txtIDBFOPath.Text)
|
|
End Using
|
|
End Using
|
|
|
|
If oResult = False Then
|
|
MsgBox("Oh no error", MsgBoxStyle.Critical)
|
|
Else
|
|
MsgBox("#Nailedit")
|
|
End If
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
|
|
Try
|
|
Dim oextension = Path.GetExtension(txtFile2Import.Text)
|
|
Dim oFile = $"E:\file{oextension}"
|
|
Using oInputStream As New FileStream(txtIDBFOPath.Text, FileMode.Open)
|
|
Using oFileStream As New FileStream(oFile, FileMode.Create, FileAccess.Write)
|
|
oInputStream.CopyTo(oFileStream)
|
|
End Using
|
|
End Using
|
|
Dim oPAth = Path.GetDirectoryName(oFile)
|
|
MsgBox($"File [{oFile}] created!", MsgBoxStyle.Information)
|
|
Process.Start(oPAth)
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.Critical)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
|
|
Try
|
|
Dim wFile As System.IO.FileStream
|
|
Dim byteData() As Byte
|
|
Dim oextension = Path.GetExtension(txtFile2Import.Text)
|
|
byteData = Encoding.ASCII.GetBytes(txtFile2Import.Text)
|
|
wFile = New FileStream($"E:\file{oextension}", FileMode.Append)
|
|
wFile.Write(byteData, 0, byteData.Length)
|
|
wFile.Close()
|
|
Catch ex As IOException
|
|
MsgBox(ex.ToString)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
|
|
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
|
|
txtFile2Import.Text = OpenFileDialog1.FileName
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
|
|
Dim oExt = Path.GetExtension(txtFile2Import.Text)
|
|
Dim oFile = $"E:\file{oExt}"
|
|
|
|
File.Copy(txtIDBFOPath.Text, oFile)
|
|
End Sub
|
|
End Class |