Initial commit

This commit is contained in:
2020-10-21 10:44:38 +02:00
commit 039adbbadf
1125 changed files with 854026 additions and 0 deletions

View File

@@ -0,0 +1,390 @@
Imports System
Imports System.Data
Imports System.Data.SqlTypes
Imports System.Data.SqlClient
Namespace DB
Public Class clsDefinition_Massnahmeplan
Inherits clsDBInteractionBase
#Region " Class Member Declarations "
Private m_bAktiv As SqlBoolean
Private m_daErstellt_am, m_daGueltig_Bis, m_daMutiert_am As SqlDateTime
Private m_iMutierer, m_iDefinitionNr, m_iMassnahmeplanNr, m_iDefinition_MassnahmeplanNr As SqlInt32
#End Region
Public Sub New()
' // Nothing for now.
End Sub
Overrides Public Function Insert() As Boolean
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_Definition_Massnahmeplan_Insert]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@iDefinitionNr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iDefinitionNr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@iMassnahmeplanNr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iMassnahmeplanNr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@daGueltig_Bis", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_daGueltig_Bis))
scmCmdToExecute.Parameters.Add(New SqlParameter("@bAktiv", SqlDbType.Bit, 1, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_bAktiv))
scmCmdToExecute.Parameters.Add(New SqlParameter("@daErstellt_am", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_daErstellt_am))
scmCmdToExecute.Parameters.Add(New SqlParameter("@daMutiert_am", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_daMutiert_am))
scmCmdToExecute.Parameters.Add(New SqlParameter("@iMutierer", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iMutierer))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iDefinition_MassnahmeplanNr", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iDefinition_MassnahmeplanNr))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
m_iRowsAffected = scmCmdToExecute.ExecuteNonQuery()
m_iDefinition_MassnahmeplanNr = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iDefinition_MassnahmeplanNr").Value, Integer))
m_iErrorCode = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32))
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_Definition_Massnahmeplan_Insert' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
Return True
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsDefinition_Massnahmeplan::Insert::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
End Try
End Function
Overrides Public Function Update() As Boolean
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_Definition_Massnahmeplan_Update]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@iDefinition_MassnahmeplanNr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iDefinition_MassnahmeplanNr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@iDefinitionNr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iDefinitionNr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@iMassnahmeplanNr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iMassnahmeplanNr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@daGueltig_Bis", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_daGueltig_Bis))
scmCmdToExecute.Parameters.Add(New SqlParameter("@bAktiv", SqlDbType.Bit, 1, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_bAktiv))
scmCmdToExecute.Parameters.Add(New SqlParameter("@daErstellt_am", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_daErstellt_am))
scmCmdToExecute.Parameters.Add(New SqlParameter("@daMutiert_am", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_daMutiert_am))
scmCmdToExecute.Parameters.Add(New SqlParameter("@iMutierer", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iMutierer))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
m_iRowsAffected = scmCmdToExecute.ExecuteNonQuery()
m_iErrorCode = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32))
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_Definition_Massnahmeplan_Update' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
Return True
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsDefinition_Massnahmeplan::Update::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
End Try
End Function
Overrides Public Function Delete() As Boolean
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_Definition_Massnahmeplan_Delete]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(New SqlParameter("@iDefinition_MassnahmeplanNr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iDefinition_MassnahmeplanNr))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
m_iRowsAffected = scmCmdToExecute.ExecuteNonQuery()
m_iErrorCode = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32))
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_Definition_Massnahmeplan_Delete' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
Return True
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsDefinition_Massnahmeplan::Delete::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
End Try
End Function
Overrides Public Function SelectOne() As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_Definition_Massnahmeplan_SelectOne]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = new DataTable("Definition_Massnahmeplan")
Dim sdaAdapter As SqlDataAdapter = new SqlDataAdapter(scmCmdToExecute)
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(new SqlParameter("@iDefinition_MassnahmeplanNr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iDefinition_MassnahmeplanNr))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
sdaAdapter.Fill(dtToReturn)
m_iErrorCode = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32))
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_Definition_Massnahmeplan_SelectOne' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
If dtToReturn.Rows.Count > 0 Then
m_iDefinition_MassnahmeplanNr = New SqlInt32(CType(dtToReturn.Rows(0)("Definition_MassnahmeplanNr"), Integer))
If dtToReturn.Rows(0)("DefinitionNr") Is System.DBNull.Value Then
m_iDefinitionNr = SqlInt32.Null
Else
m_iDefinitionNr = New SqlInt32(CType(dtToReturn.Rows(0)("DefinitionNr"), Integer))
End If
If dtToReturn.Rows(0)("MassnahmeplanNr") Is System.DBNull.Value Then
m_iMassnahmeplanNr = SqlInt32.Null
Else
m_iMassnahmeplanNr = New SqlInt32(CType(dtToReturn.Rows(0)("MassnahmeplanNr"), Integer))
End If
If dtToReturn.Rows(0)("Gueltig_Bis") Is System.DBNull.Value Then
m_daGueltig_Bis = SqlDateTime.Null
Else
m_daGueltig_Bis = New SqlDateTime(CType(dtToReturn.Rows(0)("Gueltig_Bis"), Date))
End If
If dtToReturn.Rows(0)("Aktiv") Is System.DBNull.Value Then
m_bAktiv = SqlBoolean.Null
Else
m_bAktiv = New SqlBoolean(CType(dtToReturn.Rows(0)("Aktiv"), Boolean))
End If
If dtToReturn.Rows(0)("Erstellt_am") Is System.DBNull.Value Then
m_daErstellt_am = SqlDateTime.Null
Else
m_daErstellt_am = New SqlDateTime(CType(dtToReturn.Rows(0)("Erstellt_am"), Date))
End If
If dtToReturn.Rows(0)("Mutiert_am") Is System.DBNull.Value Then
m_daMutiert_am = SqlDateTime.Null
Else
m_daMutiert_am = New SqlDateTime(CType(dtToReturn.Rows(0)("Mutiert_am"), Date))
End If
If dtToReturn.Rows(0)("Mutierer") Is System.DBNull.Value Then
m_iMutierer = SqlInt32.Null
Else
m_iMutierer = New SqlInt32(CType(dtToReturn.Rows(0)("Mutierer"), Integer))
End If
End If
Return dtToReturn
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsDefinition_Massnahmeplan::SelectOne::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
Overrides Public Function SelectAll() As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_Definition_Massnahmeplan_SelectAll]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = new DataTable("Definition_Massnahmeplan")
Dim sdaAdapter As SqlDataAdapter = new SqlDataAdapter(scmCmdToExecute)
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
If m_bMainConnectionIsCreatedLocal Then
' // Open connection.
m_scoMainConnection.Open()
Else
If m_cpMainConnectionProvider.bIsTransactionPending Then
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
End If
End If
' // Execute query.
sdaAdapter.Fill(dtToReturn)
m_iErrorCode = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32))
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_Definition_Massnahmeplan_SelectAll' reported the ErrorCode: " & m_iErrorCode.ToString())
End If
Return dtToReturn
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("clsDefinition_Massnahmeplan::SelectAll::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
#Region " Class Property Declarations "
Public Property [iDefinition_MassnahmeplanNr]() As SqlInt32
Get
Return m_iDefinition_MassnahmeplanNr
End Get
Set(ByVal Value As SqlInt32)
Dim iDefinition_MassnahmeplanNrTmp As SqlInt32 = Value
If iDefinition_MassnahmeplanNrTmp.IsNull Then
Throw New ArgumentOutOfRangeException("iDefinition_MassnahmeplanNr", "iDefinition_MassnahmeplanNr can't be NULL")
End If
m_iDefinition_MassnahmeplanNr = Value
End Set
End Property
Public Property [iDefinitionNr]() As SqlInt32
Get
Return m_iDefinitionNr
End Get
Set(ByVal Value As SqlInt32)
m_iDefinitionNr = Value
End Set
End Property
Public Property [iMassnahmeplanNr]() As SqlInt32
Get
Return m_iMassnahmeplanNr
End Get
Set(ByVal Value As SqlInt32)
m_iMassnahmeplanNr = Value
End Set
End Property
Public Property [daGueltig_Bis]() As SqlDateTime
Get
Return m_daGueltig_Bis
End Get
Set(ByVal Value As SqlDateTime)
m_daGueltig_Bis = Value
End Set
End Property
Public Property [bAktiv]() As SqlBoolean
Get
Return m_bAktiv
End Get
Set(ByVal Value As SqlBoolean)
m_bAktiv = Value
End Set
End Property
Public Property [daErstellt_am]() As SqlDateTime
Get
Return m_daErstellt_am
End Get
Set(ByVal Value As SqlDateTime)
m_daErstellt_am = Value
End Set
End Property
Public Property [daMutiert_am]() As SqlDateTime
Get
Return m_daMutiert_am
End Get
Set(ByVal Value As SqlDateTime)
m_daMutiert_am = Value
End Set
End Property
Public Property [iMutierer]() As SqlInt32
Get
Return m_iMutierer
End Get
Set(ByVal Value As SqlInt32)
m_iMutierer = Value
End Set
End Property
#End Region
End Class
End Namespace

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,256 @@
Imports C1.Win.C1TrueDBGrid
Imports System
Imports System.Data
Imports System.Data.SqlTypes
Imports System.Data.SqlClient
Imports System.Drawing
Imports System.Windows.Forms
Public Class frmAuswertung
#Region "Deklarationen"
Dim Auswertungsdaten As DataSet
Dim Auswertungsname As String
#End Region
''' <summary>
''' Initialisierung des Formulars
''' </summary>
''' <param name="Auswertungnr"></param>
''' <remarks></remarks>
Sub New(ByVal Auswertungname As String, ByRef Auswerungsdaten As DataSet, Optional tempfilepath As String = "")
Me.InitializeComponent()
If tempfilepath <> "" Then Globals.TmpFilepath = tempfilepath
Me.Text = Me.Text + ": " + Auswertungname
Me.Auswertungsdaten = Auswerungsdaten
Me.Auswertungsname = Auswertungname
End Sub
Private Sub frmAuswertung_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Me.C1Daten.DataSource = Me.Auswertungsdaten
Me.C1Daten.DataMember = Me.Auswertungsdaten.Tables(0).TableName
Dim i As Integer
For i = 0 To Me.Auswertungsdaten.Tables(0).Columns.Count - 1
Me.C1Daten.Splits(0).DisplayColumns(i).AutoSize()
If C1Daten.Columns(i).DataType.Name = "DateTime" Then
C1Daten.Columns(i).NumberFormat = "dd.MM.yyyy HH:mm:ss"
End If
If C1Daten.Columns(i).Caption = "Journaleintrag" Then
C1Daten.Splits(0).DisplayColumns(i).Width = 250
End If
C1Daten.Splits(0).DisplayColumns(i).Locked = True
Next
Catch
End Try
End Sub
Private Sub TSBtnExcelExport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TSBtnExcelExport.Click
Cursor = Cursors.WaitCursor
Dim fn As String = System.IO.Path.GetRandomFileName
fn = fn.Substring(0, Len(fn) - 4)
fn = Globals.TmpFilepath + "\" + fn + ""
'Dim xls As New XLSLib.clsXLSLib
''xls.Write_Excel(fn, Me.Auswertungsdaten.Tables(0))
'xls.Write_Excel(Me.Auswertungsdaten.Tables(0), True)
Dim fnn As String = fn + ".xlsx"
' Rename(fn, fnn)
'Process.Start(fnn)
Me.DatatableToExcel(Me.Auswertungsdaten.Tables(0), fnn)
Cursor = Cursors.Default
Exit Sub
Me.SaveFileDialog1.AddExtension = True
Me.SaveFileDialog1.Filter = "Excel-Dateien|*.xlsx|CSV-Dateien|*.CSV"
Me.SaveFileDialog1.DefaultExt.Insert(0, "*.xlsx")
Me.SaveFileDialog1.ShowDialog()
If Me.SaveFileDialog1.FileName <> "" Then
If Me.SaveFileDialog1.FileName.EndsWith("xlsx") Then
Me.DatatableToExcel(Me.Auswertungsdaten.Tables(0), Me.SaveFileDialog1.FileName)
Else
Me.C1Daten.ExportToDelimitedFile(Me.SaveFileDialog1.FileName, C1.Win.C1TrueDBGrid.RowSelectorEnum.AllRows, ";", "", "", True, System.Text.Encoding.Default.BodyName)
End If
End If
Exit Sub
If Me.C1Daten.Splits(0).Rows.Count > 0 Then
Me.SaveFileDialog1.AddExtension = True
Me.SaveFileDialog1.DefaultExt.Insert(0, "*.csv")
Me.SaveFileDialog1.Filter = "CSV-Dateien|*.CSV"
Me.SaveFileDialog1.ShowDialog()
If Me.SaveFileDialog1.FileName <> "" Then
' Me.C1Daten.ExportToDelimitedFile(Me.SaveFileDialog1.FileName, C1.Win.C1TrueDBGrid.RowSelectorEnum.AllRows, ";", "", "", "", True, System.Text.Encoding.Default.BodyName)
Me.C1Daten.ExportToDelimitedFile(Me.SaveFileDialog1.FileName, C1.Win.C1TrueDBGrid.RowSelectorEnum.AllRows, ";", "", "", True, System.Text.Encoding.Default.BodyName)
End If
End If
End Sub
Public Shared Function DatatableToExcel(ByVal aDataTable As DataTable, ByVal aOutputFilename As String) As Boolean
Application.DoEvents()
'Dim f As New FrmFortschritt
Dim app As New Object
Dim wb As New Object
Dim ws As New Object
Try
' f.Show()
Application.DoEvents()
' f.ProgressBar1.Minimum = 0
' f.ProgressBar1.Maximum = aDataTable.Rows.Count
app = CreateObject("Excel.application")
'Dim wb As Object
'Dim ws As Object
' Dim app As New Excel.ApplicationClass
' Dim wb As Excel.Workbook
' Dim ws As Excel.Worksheet
wb = app.Workbooks.add()
'wb = app.Workbooks.Add()
ws = wb.ActiveSheet()
Dim dc As DataColumn
Dim dr As DataRow
Dim colIndex As Integer
Dim rowIndex As Integer
' Columns erstellen
For Each dc In aDataTable.Columns
colIndex += 1
app.Cells(1, colIndex) = dc.ColumnName
Next
' Rows hinzufügen
For Each dr In aDataTable.Rows
' f.ProgressBar1.Value = rowIndex
rowIndex += 1
colIndex = 0
For Each dc In aDataTable.Columns
colIndex += 1
Try
app.Cells(rowIndex + 1, colIndex) = dr(dc.ColumnName)
Catch ex As Exception
Dim s As String = dr(dc.ColumnName)
s = "'" + s
Try
app.Cells(rowIndex + 1, colIndex) = s
Catch ex1 As Exception
app.Cells(rowIndex + 1, colIndex) = "'* Text beim Export entfernt"
End Try
End Try
Next
Next
ws.Columns.AutoFit()
wb.SaveAs(aOutputFilename)
app.Workbooks.Open(aOutputFilename)
' Excel anzeigen wenn fertig exportiert
app.Visible = True
ws = Nothing
wb = Nothing
app = Nothing
'f.Close()
Return True
Catch ex As Exception
'f.Close()
MsgBox(ex.Message)
End Try
End Function
Private Sub TSBtnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TSBtnPrint.Click
Dim fontbold As New Font("Arial", 12, FontStyle.Bold)
Dim fontregular As New Font("Arial", 12, FontStyle.Regular)
With Me.C1Daten.PrintInfo
.PageHeaderStyle.Font = fontbold
.PageSettings.Margins.Bottom = 20
.PageSettings.Margins.Top = 80
.PageSettings.Landscape = True
.PageFooter = "Seite \p von \P" & vbLf & "Druckdatum " & Now()
.PageHeader = Me.Auswertungsname
.ShowProgressForm = True
.UseGridColors = True
.RepeatColumnHeaders = True
.VarRowHeight = .RowHeightEnum.StretchToFit
.WrapText = C1.Win.C1TrueDBGrid.PrintInfo.WrapTextEnum.NoWrap
.PageBreak = .PageBreaksEnum.OnColumn
.FillAreaWidth = .FillEmptyEnum.None
.PrintPreview()
End With
End Sub
Private Sub TSBtnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TSBtnQuit.Click
Me.Close()
End Sub
Private Sub BeendenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BeendenToolStripMenuItem.Click
Me.Close()
End Sub
Private Sub C1Daten_FetchScrollTips(ByVal sender As Object, ByVal e As C1.Win.C1TrueDBGrid.FetchScrollTipsEventArgs) Handles C1Daten.FetchScrollTips
Try
Select Case e.ScrollBar
Case C1.Win.C1TrueDBGrid.ScrollBarEnum.Horizontal
e.ScrollTip = Me.C1Daten.Columns(e.ColIndex).Caption
Case C1.Win.C1TrueDBGrid.ScrollBarEnum.Vertical
e.ScrollTip = CStr(e.Row + 1) & " / " & CStr(Me.Auswertungsdaten.Tables(0).Rows.Count)
End Select
e.TipStyle.ForeColor = Color.Blue
Catch
End Try
End Sub
Private Sub ContextMenuStrip1_Opening(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStrip1.Opening
If Me.C1Daten.SelectedCols.Count > 0 Then SpalteLöschenToolStripMenuItem.Enabled = True Else Me.SpalteLöschenToolStripMenuItem.Enabled = False
End Sub
Private Sub SpalteLöschenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SpalteLöschenToolStripMenuItem.Click
Dim i As Integer
For i = 0 To Me.C1Daten.SelectedCols.Count - 1
Me.Auswertungsdaten.Tables(0).Columns.Remove(Me.C1Daten.SelectedCols(i).Caption)
Me.Auswertungsdaten.AcceptChanges()
Next
Me.C1Daten.DataSource = Nothing
Me.C1Daten.DataSource = Me.Auswertungsdaten
Me.C1Daten.DataMember = Me.Auswertungsdaten.Tables(0).TableName
For i = 0 To Me.Auswertungsdaten.Tables(0).Columns.Count - 1
Me.C1Daten.Splits(0).DisplayColumns(i).AutoSize()
If C1Daten.Columns(i).DataType.Name = "DateTime" Then
C1Daten.Columns(i).NumberFormat = "dd.MM.yyyy HH:mm:ss"
End If
If C1Daten.Columns(i).Caption = "Journaleintrag" Then
C1Daten.Splits(0).DisplayColumns(i).Width = 250
End If
C1Daten.Splits(0).DisplayColumns(i).Locked = True
Next
End Sub
Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click
Me.SaveFileDialog1.AddExtension = True
Me.SaveFileDialog1.Filter = "Excel-Dateien|*.xlsx|CSV-Dateien|*.CSV"
Me.SaveFileDialog1.DefaultExt.Insert(0, "*.xlsx")
Me.SaveFileDialog1.ShowDialog()
If Me.SaveFileDialog1.FileName <> "" Then
If Me.SaveFileDialog1.FileName.EndsWith("xlsx") Then
Me.DatatableToExcel(Me.Auswertungsdaten.Tables(0), Me.SaveFileDialog1.FileName)
Process.Start(Me.SaveFileDialog1.FileName)
Else
Me.C1Daten.ExportToDelimitedFile(Me.SaveFileDialog1.FileName, C1.Win.C1TrueDBGrid.RowSelectorEnum.AllRows, ";", "", "", True, System.Text.Encoding.Default.BodyName)
Process.Start(Me.SaveFileDialog1.FileName)
End If
End If
End Sub
End Class