MS_03062016

This commit is contained in:
SchreiberM
2016-06-03 11:01:15 +02:00
parent 4610dbd656
commit 9d03e60f4c
14 changed files with 1981 additions and 191 deletions

View File

@@ -0,0 +1,92 @@
Public Class frmMass_Change
Private Sub frmMass_Change_Load(sender As Object, e As EventArgs) Handles Me.Load
Try
SUCCESSFULL = False
Dim msg = "Anzahl zu ändernde Datensätze: "
If USER_LANGUAGE <> "de-DE" Then
msg = "Record Count to be changed:"
End If
lblCount.Text = msg & MASS_RECORD_CHANGE.Count
cmbColumn.Items.Clear()
For Each Str As String In MASS_COLUMN_LIST
cmbColumn.Items.Add(Str)
Next
Catch ex As Exception
MsgBox("Unexpected Error in load form:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub btncancel_Click(sender As Object, e As EventArgs) Handles btncancel.Click
SUCCESSFULL = False
Me.Close()
End Sub
Private Sub btnRefresh_Click(sender As Object, e As EventArgs) Handles btnRefresh.Click
Try
If txtNewValue.Text <> "" And Me.cmbColumn.SelectedIndex <> -1 And cmbColumn.Text <> "" Then
Dim msg = "Sind Sie sicher, dass Sie diese Massenändeurng durchführen wollen?"
If USER_LANGUAGE <> "de-DE" Then
msg = "Are You sure You want to execute this mass change?"
End If
Dim result As MsgBoxResult
result = MessageBox.Show(msg, "Confirmation:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.Yes Then
Dim SQL = String.Format("SELECT GUID FROM TBPMO_CONTROL WHERE COL_NAME = '{0}' AND FORM_ID = {1}", cmbColumn.Text, CURRENT_FORM_ID)
Dim control_Id = ClassDatabase.Execute_Scalar(SQL)
If Not IsNothing(control_Id) Then
If control_Id > 0 Then
SQL = String.Format("SELECT CONTROL_TYPE_ID FROM TBPMO_CONTROL WHERE GUID = {0}", control_Id)
Dim control_type_ID = ClassDatabase.Execute_Scalar(SQL)
If control_type_ID = 7 Or control_type_ID = 12 Or control_type_ID = 14 Then
msg = "Achtung: für diese Spalte existieren mehrere Werte. Diese Werte werden gelöscht." & vbNewLine & "Wollen Sie dennoch fortfahren?"
If USER_LANGUAGE <> "de-DE" Then
msg = "Attention: there are multiple values for this column. These values will be deleted." & vbNewLine & "Would You like to continue?"
End If
Dim result1 As MsgBoxResult
result1 = MessageBox.Show(msg, "Confirmation:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result1 = MsgBoxResult.No Then
Exit Sub
Else
For Each Record As String In MASS_RECORD_CHANGE
Dim del = String.Format("DELETE FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {0} AND RECORD_ID = {1}", control_Id, CInt(Record))
ClassDatabase.Execute_non_Query(del)
Next
End If
End If
Try
For Each Record As String In MASS_RECORD_CHANGE
SQL = String.Format("SELECT GUID FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {0} AND RECORD_ID = {1}", control_Id, CInt(Record))
Dim ex_GUID = ClassDatabase.Execute_Scalar(SQL)
If Not IsNothing(ex_GUID) Then
SQL = String.Format("UPDATE TBPMO_CONTROL_VALUE SET VALUE = '{0}',CHANGED_WHO = '{1}' WHERE GUID = {2}", txtNewValue.Text, Environment.UserName, ex_GUID)
If ClassDatabase.Execute_non_Query(SQL) = False Then
MsgBox("Error in updating the value for Record: " & Record & vbNewLine & "Please check the logfile.", MsgBoxStyle.Exclamation)
End If
Else
SQL = String.Format("INSERT INTO TBPMO_CONTROL_VALUE (CONTROL_ID, RECORD_ID, VALUE, ADDED_WHO) VALUES ({0},{1},'{2}','{3}')", control_Id, CInt(Record), txtNewValue.Text, Environment.UserName)
If ClassDatabase.Execute_non_Query(SQL) = False Then
MsgBox("Error in inserting the value for Record: " & Record & vbNewLine & "Please check the logfile.", MsgBoxStyle.Exclamation)
End If
End If
Next
msg = "Alle Änderungen wurden ausgeführt!"
If USER_LANGUAGE <> "de-DE" Then
msg = "All changes were executed!"
End If
MsgBox(msg, MsgBoxStyle.Information)
Catch ex As Exception
MsgBox("Unexpected Error in Getting record to be changed:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End If
End If
End If
End If
Catch ex As Exception
MsgBox("Unexpected Error in Execute mass change:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
End Class