From 37b9722d54923d946770b6590a8e1a7e1428f465 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Tue, 26 Feb 2019 17:08:16 +0100 Subject: [PATCH] try catch /o\ --- app/DD_PM_WINDREAM/frmMain.vb | 130 ++++++++++++++++++---------------- 1 file changed, 67 insertions(+), 63 deletions(-) diff --git a/app/DD_PM_WINDREAM/frmMain.vb b/app/DD_PM_WINDREAM/frmMain.vb index 8391376..2a8ee12 100644 --- a/app/DD_PM_WINDREAM/frmMain.vb +++ b/app/DD_PM_WINDREAM/frmMain.vb @@ -959,88 +959,92 @@ Public Class frmMain End Try End Function Private Sub tsmiMarkedFilesFinish_Click(sender As Object, e As EventArgs) Handles tsmiMarkedFilesFinish.Click - Dim selectedRows As Integer() = GridView_Docs.GetSelectedRows() - Dim hitInfo As GridHitInfo = GridView_Docs.CalcHitInfo(GridCursorLocation) - Dim workedFiles As Integer = 0 + Try + Dim selectedRows As Integer() = GridView_Docs.GetSelectedRows() + Dim hitInfo As GridHitInfo = GridView_Docs.CalcHitInfo(GridCursorLocation) + Dim workedFiles As Integer = 0 - Dim profileId = 0 + Dim profileId = 0 - If selectedRows.Count = 0 Then - If USER_LANGUAGE = "de-DE" Then - MsgBox("Bitte selektieren Sie einige 1 oder mehr Dokumente", MsgBoxStyle.Exclamation, "Massenabschluss") - Else - MsgBox("Please select some documents!", MsgBoxStyle.Exclamation, "Mass Validation") - End If + If selectedRows.Count = 0 Then + If USER_LANGUAGE = "de-DE" Then + MsgBox("Bitte selektieren Sie einige 1 oder mehr Dokumente", MsgBoxStyle.Exclamation, "Massenabschluss") + Else + MsgBox("Please select some documents!", MsgBoxStyle.Exclamation, "Mass Validation") + End If - Exit Sub - End If + Exit Sub + End If - If GridView_Docs.IsGroupRow(hitInfo.RowHandle) Then - Dim groupRowHandle = hitInfo.RowHandle + If GridView_Docs.IsGroupRow(hitInfo.RowHandle) Then + Dim groupRowHandle = hitInfo.RowHandle - Dim childRows As Integer = GridView_Docs.GetChildRowCount(groupRowHandle) + Dim childRows As Integer = GridView_Docs.GetChildRowCount(groupRowHandle) - If childRows > 0 Then - Dim childRowHandle = GridView_Docs.GetChildRowHandle(groupRowHandle, 0) + If childRows > 0 Then + Dim childRowHandle = GridView_Docs.GetChildRowHandle(groupRowHandle, 0) - profileId = GridView_Docs.GetRowCellValue(childRowHandle, "PROFILE_ID") - Else - MsgBox("This profile has no documents!") - End If - Else - If hitInfo.RowHandle >= 0 Then - profileId = GridView_Docs.GetRowCellValue(hitInfo.RowHandle, "PROFILE_ID") + profileId = GridView_Docs.GetRowCellValue(childRowHandle, "PROFILE_ID") + Else + MsgBox("This profile has no documents!") + End If Else - Dim parentRowHandle = GridView_Docs.GetParentRowHandle(hitInfo.RowHandle) - Dim dataRowHandle = GridView_Docs.GetDataRowHandleByGroupRowHandle(parentRowHandle) + If hitInfo.RowHandle >= 0 Then + profileId = GridView_Docs.GetRowCellValue(hitInfo.RowHandle, "PROFILE_ID") + Else + Dim parentRowHandle = GridView_Docs.GetParentRowHandle(hitInfo.RowHandle) + Dim dataRowHandle = GridView_Docs.GetDataRowHandleByGroupRowHandle(parentRowHandle) - profileId = GridView_Docs.GetRowCellValue(dataRowHandle, "PROFILE_ID") + profileId = GridView_Docs.GetRowCellValue(dataRowHandle, "PROFILE_ID") + End If End If - End If - If Init_windream() Then + If Init_windream() Then - CURRENT_ProfilGUID = profileId - CURRENT_DT_FINAL_INDEXING = ClassDatabase.Return_Datatable(String.Format("select * from TBPM_PROFILE_FINAL_INDEXING where PROFIL_ID = {0}", CURRENT_ProfilGUID)) - CURRENT_DT_PROFILE = ClassDatabase.Return_Datatable(String.Format("select * from TBPM_PROFILE where GUID = {0}", CURRENT_ProfilGUID)) - CURRENT_PROFILE_VEKTOR_LOG = CURRENT_DT_PROFILE.Rows(0).Item("PM_VEKTOR_INDEX") - If CURRENT_PROFILE_VEKTOR_LOG = "" Then - CURRENT_PROFILE_VEKTOR_LOG = CURRENT_DT_PROFILE.Rows(0).Item("LOG_INDEX") - End If + CURRENT_ProfilGUID = profileId + CURRENT_DT_FINAL_INDEXING = ClassDatabase.Return_Datatable(String.Format("select * from TBPM_PROFILE_FINAL_INDEXING where PROFIL_ID = {0}", CURRENT_ProfilGUID)) + CURRENT_DT_PROFILE = ClassDatabase.Return_Datatable(String.Format("select * from TBPM_PROFILE where GUID = {0}", CURRENT_ProfilGUID)) + CURRENT_PROFILE_VEKTOR_LOG = CURRENT_DT_PROFILE.Rows(0).Item("PM_VEKTOR_INDEX") + If CURRENT_PROFILE_VEKTOR_LOG = "" Then + CURRENT_PROFILE_VEKTOR_LOG = CURRENT_DT_PROFILE.Rows(0).Item("LOG_INDEX") + End If - Dim dt As New DataTable - dt.Columns.Add("DOC_ID") - dt.Columns.Add("DOC_GUID") - dt.Columns.Add("FULL_PATH") - - For Each rowhandle As Integer In selectedRows - Dim R As DataRow = dt.NewRow - Dim DOC_ID = GridView_Docs.GetRowCellValue(rowhandle, "DOC_ID") - CURRENT_DOC_ID = DOC_ID - Dim DOC_PATH = GridView_Docs.GetRowCellValue(rowhandle, "FULL_FILE_PATH") - CURRENT_DOC_PATH = DOC_PATH - CURRENT_DOC_GUID = GridView_Docs.GetRowCellValue(rowhandle, "GUID") - R("DOC_ID") = CURRENT_DOC_ID - R("FULL_PATH") = CURRENT_DOC_PATH - R("DOC_GUID") = GridView_Docs.GetRowCellValue(rowhandle, "GUID") - dt.Rows.Add(R) - Next + Dim dt As New DataTable + dt.Columns.Add("DOC_ID") + dt.Columns.Add("DOC_GUID") + dt.Columns.Add("FULL_PATH") + + For Each rowhandle As Integer In selectedRows + Dim R As DataRow = dt.NewRow + Dim DOC_ID = GridView_Docs.GetRowCellValue(rowhandle, "DOC_ID") + CURRENT_DOC_ID = DOC_ID + Dim DOC_PATH = GridView_Docs.GetRowCellValue(rowhandle, "FULL_FILE_PATH") + CURRENT_DOC_PATH = DOC_PATH + CURRENT_DOC_GUID = GridView_Docs.GetRowCellValue(rowhandle, "GUID") + R("DOC_ID") = CURRENT_DOC_ID + R("FULL_PATH") = CURRENT_DOC_PATH + R("DOC_GUID") = GridView_Docs.GetRowCellValue(rowhandle, "GUID") + dt.Rows.Add(R) + Next - CURRENT_DT_MASS_CHANGE_DOCS = Nothing - CURRENT_DT_MASS_CHANGE_DOCS = dt + CURRENT_DT_MASS_CHANGE_DOCS = Nothing + CURRENT_DT_MASS_CHANGE_DOCS = dt - frmMassValidator.ShowDialog() + frmMassValidator.ShowDialog() - Load_Profile_items() - Decide_Load() - Else - If USER_LANGUAGE = "de-DE" Then - MsgBox("Massenabschluss konnte nicht ausgeführt werden, weil windream nicht initialisiert werden konnte!", MsgBoxStyle.Critical, "Massenabschluss") + Load_Profile_items() + Decide_Load() Else - MsgBox("Massvalidation could not be completed because of an error in windream", MsgBoxStyle.Critical, "Massvalidation") + If USER_LANGUAGE = "de-DE" Then + MsgBox("Massenabschluss konnte nicht ausgeführt werden, weil windream nicht initialisiert werden konnte!", MsgBoxStyle.Critical, "Massenabschluss") + Else + MsgBox("Massvalidation could not be completed because of an error in windream", MsgBoxStyle.Critical, "Massvalidation") + End If End If - End If + Catch ex As Exception + MsgBox("Unhandled Error in tsmiMarkedFilesFinish_Click: " & ex.Message) + End Try End Sub Private Sub CMGroupStart_Click(sender As Object, e As EventArgs) Handles CMGroupStart.Click Item_Scope()