This commit is contained in:
SchreiberM
2016-11-23 17:04:30 +01:00
parent fc9f391307
commit 8f457040bb
18 changed files with 2020 additions and 659 deletions

View File

@@ -12,22 +12,28 @@ Public Class frmNewVariant
End If
result = MessageBox.Show(msg, "Create variant:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.Yes Then
Dim SQL = String.Format("EXEC PRDD_COPY_RECORD {0}, '{1}'", CURRENT_RECORD_ID, USER_USERNAME)
msg = "Wollen Sie die der Vorgängerversion zugeordenten Dateien mit der neuen Variante verlinken?"
If USER_LANGUAGE <> "de-DE" Then
msg = "Would You like to link the files of the 'old' varaint with the new variant?"
End If
Dim RelinkFiles As Integer = 0
result = MessageBox.Show(msg, "Create variant:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.Yes Then
RelinkFiles = 1
End If
Dim SQL = String.Format("PRPMO_CREATE_VARIANT {0},'{1}','{2}','{3}','{4}'", CURRENT_RECORD_ID, USER_USERNAME, cmbReason.Text, txtComment.Text, RelinkFiles)
If ClassDatabase.Execute_non_Query_withConn(SQL, 1) = True Then
Dim sel = String.Format("SELECT MAX(GUID) FROM TBPMO_RECORD WHERE UPPER(ADDED_WHO) = '{0}'", USER_USERNAME.ToUpper)
Dim REC_ID = ClassDatabase.Execute_Scalar(sel)
Dim Upd = String.Format("UPDATE TBPMO_RECORD SET PARENT_RECORD = {0},CHANGED_WHO = '{1}' WHERE GUID = {2}", REC_ID, USER_USERNAME, CURRENT_RECORD_ID)
If ClassDatabase.Execute_non_Query(Upd) = True Then
Dim ins = String.Format("INSERT INTO TBPMO_RECORD_VARIANT (RECORD_ID,REASON_CODE,COMMENT,ADDED_WHO) VALUES ({0},'{1}','{2}','{3}')", CURRENT_RECORD_ID, cmbReason.SelectedText, txtComment.Text, USER_USERNAME)
If ClassDatabase.Execute_non_Query(ins) = True Then
Upd = String.Format("UPDATE TBPMO_RECORD SET RECORD_ENTITY_ID = (SELECT RECORD_ENTITY_ID FROM TBPMO_RECORD WHERE GUID = {0}),CHANGED_WHO = '{1}' WHERE GUID = {2}", CURRENT_RECORD_ID, USER_USERNAME, REC_ID)
If ClassDatabase.Execute_non_Query(Upd) = True Then
CURRENT_RECORD_ID = REC_ID
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
End If
End If
CURRENT_RECORD_ID = ClassDatabase.Execute_Scalar(sel)
msg = "Die neue Variante wurde erzeugt?"
If USER_LANGUAGE <> "de-DE" Then
msg = "The new variant was created successfully?"
End If
MsgBox(msg, MsgBoxStyle.Information)
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
Else
MsgBox("Unexpected Error in Creating Variant. Please check the log!", MsgBoxStyle.Critical)
End If
End If
Else