MS_04.01
This commit is contained in:
@@ -2,22 +2,34 @@
|
||||
|
||||
Public Shared Sub LockRecord(RecordId As Integer)
|
||||
Try
|
||||
If RecordId = 0 Then
|
||||
Exit Sub
|
||||
End If
|
||||
Dim Username As String = USER_USERNAME
|
||||
Dim SQL As String = String.Format("UPDATE TBPMO_RECORD SET IN_WORK = 1, IN_WORK_WHO = '{0}' WHERE GUID = {1}", Username, RecordId)
|
||||
|
||||
If ClassProxy.MyPROXYConnectionString <> String.Empty Then
|
||||
ClassDatabase.Execute_non_Query(SQL, True)
|
||||
End If
|
||||
ClassDatabase.Execute_non_Query(SQL)
|
||||
Console.WriteLine("Record " & RecordId & " locked")
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in LockRecord: " & vbNewLine & ex.Message,MsgBoxStyle.Critical)
|
||||
MsgBox("Error in LockRecord: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Shared Sub UnlockRecord(RecordId As Integer)
|
||||
Try
|
||||
If RecordId = 0 Then
|
||||
Exit Sub
|
||||
End If
|
||||
Dim RECLOCKED = IsRecordLocked(RecordId)
|
||||
If IsNothing(RECLOCKED) Then
|
||||
Exit Sub
|
||||
End If
|
||||
Dim SQL As String = String.Format("UPDATE TBPMO_RECORD SET IN_WORK = 0, IN_WORK_WHO = NULL WHERE GUID = {0}", RecordId)
|
||||
|
||||
If ClassProxy.MyPROXYConnectionString <> String.Empty Then
|
||||
ClassDatabase.Execute_non_Query(SQL, True)
|
||||
End If
|
||||
ClassDatabase.Execute_non_Query(SQL)
|
||||
Console.WriteLine("Record " & RecordId & " UNlocked")
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in UnlockRecord: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
@@ -26,7 +38,7 @@
|
||||
Public Shared Function IsRecordLocked(RecordId As Integer) As String
|
||||
Try
|
||||
Dim SQL As String = String.Format("SELECT IN_WORK, IN_WORK_WHO FROM TBPMO_RECORD WHERE GUID = {0}", RecordId)
|
||||
Dim dt As DataTable = ClassDatabase.Return_Datatable(SQL)
|
||||
Dim dt As DataTable = ClassDatabase.Return_Datatable(SQL, True)
|
||||
|
||||
If dt.Rows.Count = 1 Then
|
||||
|
||||
@@ -42,7 +54,7 @@
|
||||
End If
|
||||
|
||||
ElseIf dt.Rows.Count = 0 Then
|
||||
Throw New Exception("Record " & RecordId & " does not exist")
|
||||
Return Nothing
|
||||
Else
|
||||
Throw New Exception("Record" & RecordId & " is not unique")
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user