RunUploadFile Method |
Namespace: Biolomics.BioCallback
public static int UploadFile( string p_FileFullName, string p_TableUserName, string p_FileLinkName, int p_RecordId )
Imports System Imports System.Collections Imports Biolomics.BioCallback Imports Biolomics.SharedClasses Imports Biolomics.Utility.DatabaseConstants Public Class Program <STAThread()> Shared Sub Main() Dim program As New Program program.UploadFile() program.CheckRecords() End Sub Public Sub UploadFile() ' ***** Get selected record IDs ***** Dim RecordIdList As New Generic.List(Of Integer) Dim ErrorCode As Integer = Run.GetSelRecordIdList(RecordIdList, Run.GetRecordIdListEnum.Selected) If RecordIdList.Count = 0 Then Return End If ' get the current connection Dim SqlCo As XConnection = Run.GetCurrentConnection() If SqlCo Is Nothing Then Return End If ' get the current layout table Dim CurrentLayout As XDataLayout = Run.GetCurrentLayout() If CurrentLayout Is Nothing Then Return End If ' get the current table displayed in that layout Dim TableDef As XTableDef = SqlCo.GetTableDef(CurrentLayout.TableKey) If TableDef Is Nothing Then Return End If Dim FullFileName As String = "Your_Full_Fil_Name\result.png" Dim FileLinkName As String = "Your_FileLink_Field_Name" ' attach to the first selected record Dim RecordId As Integer = RecordIdList(0) ErrorCode = Run.UploadFile(FullFileName, TableDef.UserName, FileLinkName, RecordId) If ErrorCode <> 0 Then Console.Write(vbCrLf & "Could not upload file") End If End Sub End Class