Imports DevExpress.DataAccess.Native Imports DevExpress.XtraGrid.Views.Base.ViewInfo Public Class frmWM_CreateVersion Private Sub btncancel_Click(sender As Object, e As EventArgs) Handles btncancel.Click Me.Close() End Sub Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click If WMMOD.NewFileVersion(ClassFileResult.DocumentPath, txtComment.Text) Then MsgBox("Version has been created successfully!", MsgBoxStyle.Information) 'Dim oSql = $"SELECT dwVersionID FROM VWPMO_DOC_SEARCH WHERE DocID = {BW_DocID}" 'Dim odwVersionId = MYDB_ECM.GetScalarValue(oSql) 'Dim oInsert = $"INSERT INTO TBPMO_DOC_ID_CHANGED (USER_ID,PROCESS_ID,VERSION_ID,OLD_DOC_ID,DOC_PATH) VALUES ({USER_GUID},'{ProcID.ToString}',{odwVersionId},{BW_DocID},'{BW_DocPath}')" 'MYDB_ECM.ExecuteNonQuery(oInsert) Dim sql = $"SELECT DocID from VWPMO_DOC_SYNC Where FULL_FILENAME = '{ClassFileResult.DocumentPath}'" Dim VERSION = MYDB_ECM.GetScalarValue(sql) If Not IsNothing(VERSION) Then VERSION = VERSION + 1 Dim upd = String.Format("UPDATE TBPMO_DOCRESULT_LIST SET Version = {0},Change_DateTime = GETDATE() WHERE DocID = {1}", VERSION, ClassFileResult.DocID) MYDB_ECM.ExecuteNonQuery(upd) End If Else MsgBox("Could not create a version for file '" & ClassFileResult.DocumentPath & "'! Check log", MsgBoxStyle.Exclamation) End If Me.Close() End Sub End Class