You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1404 lines
60 KiB
1404 lines
60 KiB
Imports System.Data.SqlClient
|
|
Imports System.Data.SqlDbType
|
|
Imports System.Data.SqlTypes
|
|
Imports System.IO
|
|
|
|
Public Class FrmDomainOfficeVorlageDatei
|
|
Inherits _frmDomainEditor
|
|
|
|
#Region " Vom Windows Form Designer generierter Code "
|
|
|
|
Public Sub New()
|
|
MyBase.New()
|
|
|
|
' Dieser Aufruf ist für den Windows Form-Designer erforderlich.
|
|
InitializeComponent()
|
|
|
|
' Initialisierungen nach dem Aufruf InitializeComponent() hinzufügen
|
|
|
|
End Sub
|
|
|
|
' Die Form überschreibt den Löschvorgang der Basisklasse, um Komponenten zu bereinigen.
|
|
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
|
|
If disposing Then
|
|
If Not (components Is Nothing) Then
|
|
components.Dispose()
|
|
End If
|
|
End If
|
|
MyBase.Dispose(disposing)
|
|
End Sub
|
|
|
|
' Für Windows Form-Designer erforderlich
|
|
Private components As System.ComponentModel.IContainer
|
|
|
|
'HINWEIS: Die folgende Prozedur ist für den Windows Form-Designer erforderlich
|
|
'Sie kann mit dem Windows Form-Designer modifiziert werden.
|
|
'Verwenden Sie nicht den Code-Editor zur Bearbeitung.
|
|
Friend WithEvents ContextMenu1 As System.Windows.Forms.ContextMenu
|
|
Friend WithEvents mnuGenerate As System.Windows.Forms.MenuItem
|
|
Friend WithEvents MnuImport As System.Windows.Forms.MenuItem
|
|
Friend WithEvents MenuItem7 As System.Windows.Forms.MenuItem
|
|
Friend WithEvents MenuItem8 As System.Windows.Forms.MenuItem
|
|
Friend WithEvents MenuItem4 As System.Windows.Forms.MenuItem
|
|
Friend WithEvents MenuItem5 As System.Windows.Forms.MenuItem
|
|
Friend WithEvents MenuItem6 As System.Windows.Forms.MenuItem
|
|
Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
|
|
Friend WithEvents SaveFileDialog1 As System.Windows.Forms.SaveFileDialog
|
|
Friend WithEvents MenuItem9 As System.Windows.Forms.MenuItem
|
|
Friend WithEvents MenuItem10 As System.Windows.Forms.MenuItem
|
|
Friend WithEvents MenuItem11 As System.Windows.Forms.MenuItem
|
|
Friend WithEvents MenuItem12 As System.Windows.Forms.MenuItem
|
|
Friend WithEvents MenuItem13 As System.Windows.Forms.MenuItem
|
|
Friend WithEvents MenuItem14 As System.Windows.Forms.MenuItem
|
|
Friend WithEvents DataSet3 As System.Data.DataSet
|
|
Friend WithEvents C1TrueDBGrid1 As C1.Win.C1TrueDBGrid.C1TrueDBGrid
|
|
Friend WithEvents MenuItemVorlage As System.Windows.Forms.MenuItem
|
|
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
|
|
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(FrmDomainOfficeVorlageDatei))
|
|
Dim GridLines1 As C1.Win.C1TrueDBGrid.Util.GridLines = New C1.Win.C1TrueDBGrid.Util.GridLines()
|
|
Me.ContextMenu1 = New System.Windows.Forms.ContextMenu()
|
|
Me.mnuGenerate = New System.Windows.Forms.MenuItem()
|
|
Me.MnuImport = New System.Windows.Forms.MenuItem()
|
|
Me.MenuItem9 = New System.Windows.Forms.MenuItem()
|
|
Me.MenuItem7 = New System.Windows.Forms.MenuItem()
|
|
Me.MenuItem8 = New System.Windows.Forms.MenuItem()
|
|
Me.MenuItem4 = New System.Windows.Forms.MenuItem()
|
|
Me.MenuItem10 = New System.Windows.Forms.MenuItem()
|
|
Me.MenuItem11 = New System.Windows.Forms.MenuItem()
|
|
Me.MenuItem12 = New System.Windows.Forms.MenuItem()
|
|
Me.MenuItem13 = New System.Windows.Forms.MenuItem()
|
|
Me.MenuItem14 = New System.Windows.Forms.MenuItem()
|
|
Me.MenuItem5 = New System.Windows.Forms.MenuItem()
|
|
Me.MenuItem6 = New System.Windows.Forms.MenuItem()
|
|
Me.MenuItemVorlage = New System.Windows.Forms.MenuItem()
|
|
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
|
|
Me.SaveFileDialog1 = New System.Windows.Forms.SaveFileDialog
|
|
Me.DataSet3 = New System.Data.DataSet()
|
|
Me.C1TrueDBGrid1 = New C1.Win.C1TrueDBGrid.C1TrueDBGrid()
|
|
CType(Me.DataSet3, System.ComponentModel.ISupportInitialize).BeginInit()
|
|
CType(Me.C1TrueDBGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
|
|
Me.SuspendLayout()
|
|
'
|
|
'ContextMenu1
|
|
'
|
|
Me.ContextMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuGenerate, Me.MnuImport, Me.MenuItem9, Me.MenuItem7, Me.MenuItem8, Me.MenuItem4, Me.MenuItem10, Me.MenuItemVorlage, Me.MenuItem11, Me.MenuItem12, Me.MenuItem13, Me.MenuItem14})
|
|
'
|
|
'mnuGenerate
|
|
'
|
|
Me.mnuGenerate.Index = 0
|
|
Me.mnuGenerate.Text = "IDV-Dokument generieren und importieren"
|
|
'
|
|
'MnuImport
|
|
'
|
|
Me.MnuImport.Index = 1
|
|
Me.MnuImport.Text = "Dokumentvorlage importieren"
|
|
'
|
|
'MenuItem9
|
|
'
|
|
Me.MenuItem9.Index = 2
|
|
Me.MenuItem9.Text = "-"
|
|
'
|
|
'MenuItem7
|
|
'
|
|
Me.MenuItem7.Index = 3
|
|
Me.MenuItem7.Text = "Vorlage für Übernahme freigeben"
|
|
'
|
|
'MenuItem8
|
|
'
|
|
Me.MenuItem8.Index = 4
|
|
Me.MenuItem8.Text = "Freigabe der Vorlage aufheben"
|
|
|
|
'
|
|
'MenuItem4
|
|
'
|
|
Me.MenuItem4.Index = 5
|
|
Me.MenuItem4.Text = "-"
|
|
'
|
|
'MenuItem10
|
|
'
|
|
Me.MenuItem10.Index = 6
|
|
Me.MenuItem10.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem5, Me.MenuItem6})
|
|
Me.MenuItem10.Text = "Export/Import"
|
|
'
|
|
'MenuItem5
|
|
'
|
|
Me.MenuItem5.Index = 0
|
|
Me.MenuItem5.Text = "Vorlagen für Übernahme exportieren"
|
|
'
|
|
'MenuItem6
|
|
'
|
|
Me.MenuItem6.Index = 1
|
|
Me.MenuItem6.Text = "&Vorlagen importieren"
|
|
'
|
|
'MenuItemVorlage
|
|
'
|
|
Me.MenuItemVorlage.Index = 7
|
|
Me.MenuItemVorlage.Text = "&Office-Vorlagenr Produktion vergeben"
|
|
'
|
|
Me.MenuItem11.Index = 8
|
|
Me.MenuItem11.Text = "Vorlage exportieren"
|
|
|
|
Me.MenuItem12.Index = 9
|
|
Me.MenuItem12.Text = "Office 2010-Vorlage importieren"
|
|
|
|
Me.MenuItem13.Index = 10
|
|
Me.MenuItem13.Text = "Office 2010-Vorlage exportieren"
|
|
|
|
Me.MenuItem14.Index = 11
|
|
Me.MenuItem14.Text = "Office 2010-Vorlage löschen"
|
|
|
|
'DataSet3
|
|
'
|
|
Me.DataSet3.DataSetName = "NewDataSet"
|
|
'
|
|
'C1TrueDBGrid1
|
|
'
|
|
Me.C1TrueDBGrid1.AllowFilter = True
|
|
Me.C1TrueDBGrid1.AllowRowSizing = C1.Win.C1TrueDBGrid.RowSizingEnum.AllRows
|
|
Me.C1TrueDBGrid1.AllowSort = True
|
|
Me.C1TrueDBGrid1.AlternatingRows = True
|
|
Me.C1TrueDBGrid1.CaptionHeight = 17
|
|
Me.C1TrueDBGrid1.CollapseColor = System.Drawing.Color.Black
|
|
Me.C1TrueDBGrid1.DataChanged = False
|
|
Me.C1TrueDBGrid1.DeadAreaBackColor = System.Drawing.Color.Empty
|
|
Me.C1TrueDBGrid1.ExpandColor = System.Drawing.Color.Black
|
|
Me.C1TrueDBGrid1.FetchRowStyles = True
|
|
Me.C1TrueDBGrid1.GroupByCaption = "Drag a column header here to group by that column"
|
|
Me.C1TrueDBGrid1.Images.Add(CType(resources.GetObject("resource.Images"), System.Drawing.Bitmap))
|
|
Me.C1TrueDBGrid1.MarqueeStyle = C1.Win.C1TrueDBGrid.MarqueeEnum.DottedCellBorder
|
|
Me.C1TrueDBGrid1.Name = "C1TrueDBGrid1"
|
|
Me.C1TrueDBGrid1.PreviewInfo.Location = New System.Drawing.Point(0, 0)
|
|
Me.C1TrueDBGrid1.PreviewInfo.Size = New System.Drawing.Size(0, 0)
|
|
Me.C1TrueDBGrid1.PreviewInfo.ZoomFactor = 75
|
|
Me.C1TrueDBGrid1.PrintInfo.ShowOptionsDialog = False
|
|
Me.C1TrueDBGrid1.RecordSelectorWidth = 16
|
|
GridLines1.Color = System.Drawing.Color.DarkGray
|
|
GridLines1.Style = C1.Win.C1TrueDBGrid.LineStyleEnum.Single
|
|
Me.C1TrueDBGrid1.RowDivider = GridLines1
|
|
Me.C1TrueDBGrid1.RowHeight = 15
|
|
Me.C1TrueDBGrid1.RowSubDividerColor = System.Drawing.Color.DarkGray
|
|
Me.C1TrueDBGrid1.ScrollTips = False
|
|
Me.C1TrueDBGrid1.Size = New System.Drawing.Size(75, 23)
|
|
Me.C1TrueDBGrid1.TabIndex = 8
|
|
Me.C1TrueDBGrid1.Text = "C1TrueDBGrid1"
|
|
Me.C1TrueDBGrid1.Visible = False
|
|
Me.C1TrueDBGrid1.PropBag = "<?xml version=""1.0""?><Blob><Styles type=""C1.Win.C1TrueDBGrid.Design.ContextWrappe" & _
|
|
"r""><Data>Group{BackColor:ControlDark;Border:None,,0, 0, 0, 0;AlignVert:Center;}E" & _
|
|
"ditor{}Style2{}Style5{}Style4{}Style7{}Style6{}EvenRow{BackColor:Aqua;}Selected{" & _
|
|
"ForeColor:HighlightText;BackColor:Highlight;}Style3{}Inactive{ForeColor:Inactive" & _
|
|
"CaptionText;BackColor:InactiveCaption;}FilterBar{}Footer{}Caption{AlignHorz:Cent" & _
|
|
"er;}Normal{}HighlightRow{ForeColor:HighlightText;BackColor:Highlight;}Style9{}Od" & _
|
|
"dRow{}RecordSelector{AlignImage:Center;}Heading{Wrap:True;AlignVert:Center;Borde" & _
|
|
"r:Raised,,1, 1, 1, 1;ForeColor:ControlText;BackColor:Control;}Style8{}Style10{Al" & _
|
|
"ignHorz:Near;}Style11{}Style12{}Style13{}Style1{}</Data></Styles><Splits><C1.Win" & _
|
|
".C1TrueDBGrid.MergeView Name="""" AlternatingRowStyle=""True"" CaptionHeight=""17"" Co" & _
|
|
"lumnCaptionHeight=""17"" ColumnFooterHeight=""17"" FetchRowStyles=""True"" MarqueeStyl" & _
|
|
"e=""DottedCellBorder"" RecordSelectorWidth=""16"" DefRecSelWidth=""16"" VerticalScroll" & _
|
|
"Group=""1"" HorizontalScrollGroup=""1""><ClientRect>0, 0, 71, 19</ClientRect><Border" & _
|
|
"Side>0</BorderSide><CaptionStyle parent=""Style2"" me=""Style10"" /><EditorStyle par" & _
|
|
"ent=""Editor"" me=""Style5"" /><EvenRowStyle parent=""EvenRow"" me=""Style8"" /><FilterB" & _
|
|
"arStyle parent=""FilterBar"" me=""Style13"" /><FooterStyle parent=""Footer"" me=""Style" & _
|
|
"3"" /><GroupStyle parent=""Group"" me=""Style12"" /><HeadingStyle parent=""Heading"" me" & _
|
|
"=""Style2"" /><HighLightRowStyle parent=""HighlightRow"" me=""Style7"" /><InactiveStyl" & _
|
|
"e parent=""Inactive"" me=""Style4"" /><OddRowStyle parent=""OddRow"" me=""Style9"" /><Re" & _
|
|
"cordSelectorStyle parent=""RecordSelector"" me=""Style11"" /><SelectedStyle parent=""" & _
|
|
"Selected"" me=""Style6"" /><Style parent=""Normal"" me=""Style1"" /></C1.Win.C1TrueDBGr" & _
|
|
"id.MergeView></Splits><NamedStyles><Style parent="""" me=""Normal"" /><Style parent=" & _
|
|
"""Normal"" me=""Heading"" /><Style parent=""Heading"" me=""Footer"" /><Style parent=""Hea" & _
|
|
"ding"" me=""Caption"" /><Style parent=""Heading"" me=""Inactive"" /><Style parent=""Norm" & _
|
|
"al"" me=""Selected"" /><Style parent=""Normal"" me=""Editor"" /><Style parent=""Normal"" " & _
|
|
"me=""HighlightRow"" /><Style parent=""Normal"" me=""EvenRow"" /><Style parent=""Normal""" & _
|
|
" me=""OddRow"" /><Style parent=""Heading"" me=""RecordSelector"" /><Style parent=""Norm" & _
|
|
"al"" me=""FilterBar"" /><Style parent=""Caption"" me=""Group"" /></NamedStyles><vertSpl" & _
|
|
"its>1</vertSplits><horzSplits>1</horzSplits><Layout>None</Layout><DefaultRecSelW" & _
|
|
"idth>16</DefaultRecSelWidth><ClientArea>0, 0, 71, 19</ClientArea></Blob>"
|
|
'
|
|
'FrmDomainOfficeVorlageDatei
|
|
'
|
|
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
|
|
Me.ClientSize = New System.Drawing.Size(952, 465)
|
|
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.C1TrueDBGrid1})
|
|
Me.Name = "FrmDomainOfficeVorlageDatei"
|
|
Me.Text = "FrmDomainOfficeVorlageDatei"
|
|
'Rel. 4.1 - Maximized auf Normal
|
|
Me.WindowState = System.Windows.Forms.FormWindowState.Normal
|
|
CType(Me.DataSet3, System.ComponentModel.ISupportInitialize).EndInit()
|
|
CType(Me.C1TrueDBGrid1, System.ComponentModel.ISupportInitialize).EndInit()
|
|
Me.ResumeLayout(False)
|
|
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
Dim m_sysadmin As Boolean = False
|
|
Property Sysadmin() As Boolean
|
|
Get
|
|
Return m_sysadmin
|
|
End Get
|
|
Set(ByVal Value As Boolean)
|
|
m_sysadmin = Value
|
|
End Set
|
|
End Property
|
|
Dim Bookmark As Long
|
|
Dim M_NR As Integer = 0
|
|
Property vorlagenr() As Integer
|
|
Get
|
|
Return M_NR
|
|
End Get
|
|
Set(ByVal Value As Integer)
|
|
M_NR = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Sub FrmDomainOfficeVorlageDatei_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
|
Dim I As Integer
|
|
Me.DomainList.FetchRowStyles = True
|
|
Me.ToolBar1.Buttons(1).Visible = False
|
|
Me.DomainList.AllowAddNew = False
|
|
Me.DomainList.AllowDelete = False
|
|
Me.DomainList.AllowUpdate = False
|
|
Me.Text = "Office-Vorlage-Dateien"
|
|
Me.DomainList.ContextMenu = Me.ContextMenu1
|
|
Me.DomainList.CellTips = C1.Win.C1TrueDBGrid.CellTipEnum.NoCellTips
|
|
Me.MenuItem3.Visible = False
|
|
Me.MenuItem3.Enabled = False
|
|
If Not DivFnkt.MA_Is_Sysadmin(Globals.MitarbeiterNr) And Not Sysadmin Then
|
|
Me.MenuItem4.Visible = False
|
|
Me.MenuItem10.Visible = False
|
|
Me.MenuItem5.Enabled = False
|
|
Me.MenuItem6.Enabled = False
|
|
Me.MenuItem12.Visible = False
|
|
Me.MenuItem13.Visible = False
|
|
Me.MenuItem14.Visible = False
|
|
Else
|
|
Sysadmin = True
|
|
Me.MenuItem4.Visible = True
|
|
Me.MenuItem10.Visible = True
|
|
If Globals.Applikationsdaten.Rows(0).Item("showlogin") = False Then
|
|
Me.MenuItem6.Enabled = True
|
|
Me.MenuItem5.Enabled = False
|
|
End If
|
|
End If
|
|
Refresh_Data()
|
|
Try
|
|
If DivFnkt.Get_Office_2010_Param(37) = "False" Then
|
|
Me.MenuItem12.Text = "Office 2016-Vorlage importieren"
|
|
Me.MenuItem13.Text = "Office 2016-Vorlage exportieren"
|
|
Me.MenuItem14.Text = "Office 2016-Vorlage löschen"
|
|
Else
|
|
Me.MenuItem12.Visible = False
|
|
Me.MenuItem13.Visible = False
|
|
Me.MenuItem14.Visible = False
|
|
End If
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
If Me.vorlagenr <> 0 Then
|
|
For I = 0 To Me.DomainList.Splits(0).Rows.Count - 1
|
|
If Me.DomainList.Columns("Dateinr").CellValue(I) = Me.vorlagenr Then
|
|
Me.DomainList.Bookmark = I
|
|
Exit Sub
|
|
End If
|
|
Next
|
|
End If
|
|
Try
|
|
Me.DomainList.Splits(0).DisplayColumns("ownernr").Width = 0
|
|
Catch
|
|
End Try
|
|
|
|
End Sub
|
|
|
|
Public Function Mitarbeiter_lesen() As DataTable
|
|
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
|
Dim dtToReturn As DataTable = New DataTable()
|
|
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
|
scmCmdToExecute.CommandText = "dbo.sp_mitarbeiter_select"
|
|
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
|
scmCmdToExecute.Connection = conn.scoDBConnection
|
|
Try
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@mandantnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Globals.MandantNr))
|
|
sdaAdapter.Fill(dtToReturn)
|
|
Return dtToReturn
|
|
Catch ex As Exception
|
|
' // some error occured. Bubble it to caller and encapsulate Exception object
|
|
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
|
Finally
|
|
scmCmdToExecute.Dispose()
|
|
sdaAdapter.Dispose()
|
|
End Try
|
|
End Function
|
|
|
|
|
|
|
|
Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
|
|
Select Case ToolBar1.Buttons.IndexOf(e.Button)
|
|
Case 0 'close button
|
|
Me.Close()
|
|
End Select
|
|
End Sub
|
|
|
|
|
|
Private Sub Refresh_Data()
|
|
Dim i As Integer
|
|
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
|
Dim dtToReturn As DataTable = New DataTable()
|
|
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
|
Try
|
|
scmCmdToExecute.CommandText = "dbo.SP_Office_Vorlage_Datei"
|
|
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
|
scmCmdToExecute.Connection = conn.scoDBConnection
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@Fnkt", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 1))
|
|
sdaAdapter.Fill(dtToReturn)
|
|
Me.C1TrueDBGrid1.DataSource = dtToReturn
|
|
Me.C1TrueDBGrid1.DataMember = dtToReturn.TableName
|
|
Try
|
|
For i = 0 To Me.DomainList.Columns.Count - 1
|
|
Me.C1TrueDBGrid1.Columns(i).FilterText = Me.DomainList.Columns(i).FilterText
|
|
Next
|
|
Catch
|
|
End Try
|
|
Me.DomainList.DataSource = dtToReturn
|
|
Me.DomainList.DataMember = dtToReturn.TableName
|
|
Catch ex As Exception
|
|
' // some error occured. Bubble it to caller and encapsulate Exception object
|
|
Throw New Exception("Dokumenterstellung::Generic_Select::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
|
Finally
|
|
' DivFnkt.SpaltenTitel_Aktualisieren(Me.DomainList, dtToReturn, "OfficeVorlageDatei")
|
|
scmCmdToExecute.Dispose()
|
|
sdaAdapter.Dispose()
|
|
Me.DomainList.Columns("freigegeben").ValueItems.Presentation = C1.Win.C1TrueDBGrid.PresentationEnum.CheckBox
|
|
Me.DomainList.Columns("Uebernehmen").ValueItems.Presentation = C1.Win.C1TrueDBGrid.PresentationEnum.CheckBox
|
|
Me.DomainList.Columns("Aktiv").ValueItems.Presentation = C1.Win.C1TrueDBGrid.PresentationEnum.CheckBox
|
|
For i = 0 To Me.DomainList.Splits(0).DisplayColumns.Count - 1
|
|
Me.DomainList.Splits(0).DisplayColumns(i).AutoSize()
|
|
Next i
|
|
Try
|
|
For i = 0 To Me.DomainList.Columns.Count - 1
|
|
Me.DomainList.Columns(i).FilterText = Me.C1TrueDBGrid1.Columns(i).FilterText
|
|
Next
|
|
Catch
|
|
End Try
|
|
|
|
End Try
|
|
|
|
End Sub
|
|
|
|
Private Sub ContextMenu1_Popup(ByVal sender As Object, ByVal e As System.EventArgs) Handles ContextMenu1.Popup
|
|
Dim i1 As Integer
|
|
If Not DivFnkt.Check_Sysadmin_Stellvertreter(Me.DomainList.Columns("ownernr").Value) Then
|
|
For i1 = 0 To Me.ContextMenu1.MenuItems.Count - 1
|
|
Me.ContextMenu1.MenuItems(i1).Enabled = False
|
|
Next
|
|
Exit Sub
|
|
Else
|
|
For i1 = 0 To Me.ContextMenu1.MenuItems.Count - 1
|
|
Me.ContextMenu1.MenuItems(i1).Enabled = True
|
|
Next
|
|
End If
|
|
Dim colRows As C1.Win.C1TrueDBGrid.SelectedRowCollection
|
|
colRows = Me.DomainList.SelectedRows
|
|
Dim sel1 As Boolean = False
|
|
Dim sel2 As Boolean = False
|
|
Dim i As Integer
|
|
Try
|
|
For i = 0 To colRows.Count - 1
|
|
If Me.DomainList.Columns("freigegeben").CellValue(colRows(i)) = True Then sel1 = True
|
|
If Me.DomainList.Columns("freigegeben").CellValue(colRows(i)) = False Then sel2 = True
|
|
Next
|
|
Catch
|
|
End Try
|
|
If Me.DomainList.SelectedRows.Count = 0 Then
|
|
If Me.DomainList.Columns("ownernr").Value = Globals.MitarbeiterNr Or Sysadmin Or DivFnkt.Check_Sysadmin_Stellvertreter(Me.DomainList.Columns("ownernr").Value) = True Then
|
|
Else
|
|
Me.mnuGenerate.Enabled = False
|
|
Me.MnuImport.Enabled = False
|
|
Me.MenuItem7.Enabled = False
|
|
Me.MenuItem8.Enabled = False
|
|
End If
|
|
End If
|
|
|
|
If Globals.Applikationsdaten.Rows(0).Item("showlogin") = False Then
|
|
Me.mnuGenerate.Enabled = False
|
|
Me.MnuImport.Enabled = False
|
|
Me.MenuItem7.Enabled = False
|
|
Me.MenuItem8.Enabled = False
|
|
If Sysadmin Then Me.MnuImport.Enabled = True
|
|
Exit Sub
|
|
End If
|
|
If Me.DomainList.Columns("dateiname").Text = "" Then
|
|
Me.MenuItem7.Enabled = False
|
|
Me.MenuItem8.Enabled = False
|
|
Else
|
|
If Me.DomainList.Columns("freigegeben").Value = True Then
|
|
Me.MenuItem7.Enabled = False
|
|
Me.MenuItem8.Enabled = True
|
|
Else
|
|
Me.MenuItem7.Enabled = True
|
|
Me.MenuItem8.Enabled = False
|
|
End If
|
|
End If
|
|
If sel1 = True And sel2 = True Then
|
|
Me.MenuItem7.Enabled = False
|
|
Me.MenuItem8.Enabled = False
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub MnuImport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuImport.Click
|
|
Me.Cursor = Cursors.WaitCursor
|
|
Me.OpenFileDialog1.ShowDialog()
|
|
If Me.OpenFileDialog1.FileName <> "" Then
|
|
Me.Cursor = Cursors.WaitCursor
|
|
Me.Bookmark = Me.DomainList.Bookmark
|
|
Import_Vorlage(Me.OpenFileDialog1.FileName)
|
|
Me.Refresh_Data()
|
|
Me.DomainList.Bookmark = Me.Bookmark
|
|
Me.Cursor = Cursors.Default
|
|
End If
|
|
Me.Refresh()
|
|
Me.Cursor = Cursors.Default
|
|
End Sub
|
|
|
|
Private Sub Menuitem12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem12.Click
|
|
Dim f As New frmImportOffice2010(Me.DomainList.Columns("Dateinr").Value)
|
|
f.ShowDialog()
|
|
|
|
|
|
''Me.Cursor = Cursors.WaitCursor
|
|
''Me.OpenFileDialog1.ShowDialog()
|
|
''If Me.OpenFileDialog1.FileName <> "" Then
|
|
'' Me.Cursor = Cursors.WaitCursor
|
|
'' Me.Bookmark = Me.DomainList.Bookmark
|
|
'' Import_Vorlage(Me.OpenFileDialog1.FileName, True)
|
|
'' Me.Refresh_Data()
|
|
'' Me.DomainList.Bookmark = Me.Bookmark
|
|
'' Me.Cursor = Cursors.Default
|
|
''End If
|
|
''Me.Refresh()
|
|
''Me.Cursor = Cursors.Default
|
|
End Sub
|
|
|
|
|
|
Private Sub Import_Vorlage(ByVal Dokumentname As String, Optional ByVal office2010 As Boolean = False)
|
|
If Save_Vorlage_To_Db(Dokumentname, office2010) Then
|
|
Dim ov As New edokadb.clsOffice_vorlage()
|
|
ov.cpMainConnectionProvider = Globals.conn
|
|
ov.iOffice_vorlagenr = New SqlInt32(CType(Me.DomainList.Columns("Dateinr").Text, Int32))
|
|
ov.SelectOne()
|
|
ov.bIdv_vorlage = New SqlBoolean(CType(False, Boolean))
|
|
ov.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
|
|
ov.iMutierer = New SqlInt32(CType(Globals.MitarbeiterNr, Int32))
|
|
ov.iAnwendungnr = New SqlInt32(CType(get_anwendungnr(Dokumentname), Int32))
|
|
Globals.conn.OpenConnection()
|
|
ov.Update()
|
|
Globals.conn.CloseConnection(True)
|
|
End If
|
|
End Sub
|
|
|
|
Private Function get_anwendungnr(ByVal dokumentname As String) As Integer
|
|
Dim extension As String = System.IO.Path.GetExtension(dokumentname)
|
|
Select Case UCase(extension)
|
|
Case ".DOC"
|
|
Return 1
|
|
Case ".XLS"
|
|
Return 2
|
|
Case ".PDF"
|
|
Return 3
|
|
Case ".DOCX"
|
|
Return 4
|
|
Case ".DOCM"
|
|
Return 5
|
|
Case ".DOTX"
|
|
Return 6
|
|
Case ".DOTM"
|
|
Return 7
|
|
Case ".XLSX"
|
|
Return 8
|
|
Case ".XLSM"
|
|
Return 9
|
|
Case ".XLTX"
|
|
Return 10
|
|
Case ".XLTM"
|
|
Return 11
|
|
Case Else
|
|
Return 4
|
|
End Select
|
|
End Function
|
|
|
|
Private Sub mnuGenerate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuGenerate.Click
|
|
Dim i As Integer
|
|
Dim x As Integer
|
|
Dim a As Integer
|
|
Dim da As New DataTable()
|
|
Dim colRows As C1.Win.C1TrueDBGrid.SelectedRowCollection
|
|
Dim ovd As New edokadb.clsOffice_Vorlage_Datei()
|
|
Dim s As String
|
|
Dim counter As Integer
|
|
ovd.cpMainConnectionProvider = Globals.conn
|
|
colRows = Me.DomainList.SelectedRows
|
|
counter = 0
|
|
Dim pg As New frmProgress()
|
|
Dim aa As Integer
|
|
Try
|
|
If colRows.Count > 1 Then
|
|
aa = 100 / colRows.Count
|
|
pg.Bar1a.Maximum = colRows.Count
|
|
Else
|
|
aa = 1
|
|
pg.Bar1a.Maximum = 1
|
|
End If
|
|
Catch
|
|
End Try
|
|
pg.Info.Text = "Vorlagen exportieren"
|
|
pg.TopMost = True
|
|
pg.Bar1a.Minimum = 0
|
|
pg.Bar1a.Value = 0
|
|
pg.Show()
|
|
|
|
For i = 0 To colRows.Count - 1
|
|
For x = 0 To Me.DomainList.Splits(0).Rows.Count - 1
|
|
If Me.DomainList.Columns("Dateinr").CellValue(x) = Me.DomainList.Columns("Dateinr").CellValue(colRows(i)) Then
|
|
Me.DomainList.Bookmark = x
|
|
If Me.DomainList.Columns("ownernr").Value = Globals.MitarbeiterNr Or Sysadmin Or DivFnkt.Check_Sysadmin_Stellvertreter(Me.DomainList.Columns("ownernr").Value) = True Then
|
|
If dogenerate() Then counter = counter + 1
|
|
Exit For
|
|
End If
|
|
End If
|
|
Next
|
|
pg.Bar1a.Value = pg.Bar1a.Value + 1
|
|
System.Windows.Forms.Application.DoEvents()
|
|
|
|
Next
|
|
pg.Close()
|
|
pg.Dispose()
|
|
Me.Refresh_Data()
|
|
MsgBox("Anzahl generierte Vorlagen: " + Trim(Str(counter)), MsgBoxStyle.Information)
|
|
End Sub
|
|
|
|
Public Function dogenerate() As Boolean
|
|
Dim i As Integer
|
|
Dim w As New WordLib()
|
|
Dim ov As New edokadb.clsOffice_vorlage()
|
|
ov.cpMainConnectionProvider = Globals.conn
|
|
ov.iOffice_vorlagenr = New SqlInt32(CType(Me.DomainList.Columns("Dateinr").Text, Int32))
|
|
ov.SelectOne()
|
|
Dim filename As String
|
|
If ov.iOwner.Value <> Globals.MitarbeiterNr And Not Me.Sysadmin Then
|
|
ov.Dispose()
|
|
Return False
|
|
Exit Function
|
|
End If
|
|
Try
|
|
i = ov.iAnwendungnr.Value
|
|
'Rel. Office 2010
|
|
Select Case ov.iAnwendungnr.Value
|
|
Case 1
|
|
filename = Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_temporaer_dokumente") + "" + Me.DomainList.Columns("dateinr").Text + ".doc"
|
|
Case 2
|
|
filename = Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_temporaer_dokumente") + "" + Me.DomainList.Columns("dateinr").Text + ".xls"
|
|
Case 3
|
|
filename = Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_temporaer_dokumente") + "" + Me.DomainList.Columns("dateinr").Text + ".pdf"
|
|
Case 4
|
|
filename = Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_temporaer_dokumente") + "" + Me.DomainList.Columns("dateinr").Text + ".docx"
|
|
Case 5
|
|
filename = Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_temporaer_dokumente") + "" + Me.DomainList.Columns("dateinr").Text + ".docm"
|
|
Case 6
|
|
filename = Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_temporaer_dokumente") + "" + Me.DomainList.Columns("dateinr").Text + ".dotx"
|
|
Case 7
|
|
filename = Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_temporaer_dokumente") + "" + Me.DomainList.Columns("dateinr").Text + ".dotm"
|
|
Case 8
|
|
filename = Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_temporaer_dokumente") + "" + Me.DomainList.Columns("dateinr").Text + ".xlsx"
|
|
Case 9
|
|
filename = Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_temporaer_dokumente") + "" + Me.DomainList.Columns("dateinr").Text + ".xlsm"
|
|
Case 10
|
|
filename = Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_temporaer_dokumente") + "" + Me.DomainList.Columns("dateinr").Text + ".xltx"
|
|
Case 11
|
|
filename = Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_temporaer_dokumente") + "" + Me.DomainList.Columns("dateinr").Text + ".xltm"
|
|
End Select
|
|
'If i = 2 Then
|
|
' filename = Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_temporaer_dokumente") + "" + Me.DomainList.Columns("dateinr").Text + ".xls"
|
|
'Else
|
|
' filename = Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_temporaer_dokumente") + "" + Me.DomainList.Columns("dateinr").Text + ".doc"
|
|
'End If
|
|
'Ende Rel. Office 2010
|
|
If Not ov.sIdv_id.Value Is System.DBNull.Value And Not ov.sIdv_id.Value = "" Then
|
|
|
|
i = Val(ov.sIdv_id.Value)
|
|
If i > 0 Then
|
|
i = Val(Me.DomainList.Columns("dateinr").Text)
|
|
If w.Create_Empty_Doc_and_Save(i, filename) = True Then
|
|
Import_Vorlage(filename)
|
|
Else
|
|
'BUD - 07.11.2006 - Korrekture mit Return False im else Fall
|
|
Return False
|
|
End If
|
|
End If
|
|
End If
|
|
Return True
|
|
Catch ex As Exception
|
|
TKBLib.Errorhandling.TraceHelper.Msg("FrmDomainOfficeVorlageDatei.dogenerate.", ex.Message + " " + ex.StackTrace, TraceLevel.Warning)
|
|
Finally
|
|
ov = Nothing
|
|
w = Nothing
|
|
End Try
|
|
End Function
|
|
|
|
Private Function check_passwort() As Boolean
|
|
Dim pw As New frmPasswort()
|
|
pw.ShowDialog()
|
|
If pw.DialogResult = DialogResult.Abort Then
|
|
pw.Dispose()
|
|
Return False
|
|
Exit Function
|
|
End If
|
|
If UCase(pw.PasswortText.Text) <> UCase(Globals.Applikationsdaten.Rows(0).Item("passwort_vorlagenverwaltung")) Then
|
|
pw.Dispose()
|
|
Return False
|
|
Exit Function
|
|
End If
|
|
Return True
|
|
End Function
|
|
|
|
Private Sub MenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem5.Click
|
|
If check_passwort() = False Then Exit Sub
|
|
If Check_Vorlagen() = False Then Exit Sub
|
|
Dim f As New FolderSelect()
|
|
f.InitialDirectory = "C:\"
|
|
f.InitialDirectoryExpanded = True
|
|
Me.Cursor = Cursors.WaitCursor
|
|
f.ShowDialog()
|
|
If f.DialogResult = DialogResult.OK Then
|
|
Me.Cursor = Cursors.WaitCursor
|
|
Export_Vorlagen(f.fullPath)
|
|
End If
|
|
f.Dispose()
|
|
Me.Refresh_Data()
|
|
Me.Cursor = Cursors.Default
|
|
End Sub
|
|
|
|
Private Function Check_Vorlagen() As Boolean
|
|
Dim s As String
|
|
s = ""
|
|
Dim colRows As C1.Win.C1TrueDBGrid.SelectedRowCollection
|
|
colRows = Me.DomainList.SelectedRows
|
|
Dim i As Integer
|
|
For i = 0 To colRows.Count - 1
|
|
If Me.DomainList.Columns("Nr").CellValue(colRows(i)) = 0 Then
|
|
If Len(s) > 0 Then s = s + ", "
|
|
s = s + Me.DomainList.Columns("Dateinr").CellText(colRows(i).ToString)
|
|
End If
|
|
Next
|
|
If s <> "" Then
|
|
MsgBox("Folgende Einträge habe keine Office_VorlageNr: " + s, MsgBoxStyle.Critical, "Export")
|
|
Return False
|
|
Else
|
|
Return True
|
|
End If
|
|
End Function
|
|
|
|
Private Sub Export_Vorlagen(ByVal vorlagenverzeichnis As String)
|
|
Dim i As Integer
|
|
Dim x As Integer
|
|
Dim da As New DataTable()
|
|
Dim colRows As C1.Win.C1TrueDBGrid.SelectedRowCollection
|
|
Dim ovd As New edokadb.clsOffice_Vorlage_Datei()
|
|
Dim s As String
|
|
Dim counter As Integer
|
|
ovd.cpMainConnectionProvider = Globals.conn
|
|
colRows = Me.DomainList.SelectedRows
|
|
|
|
Dim pg As New frmProgress()
|
|
Dim aa As Integer
|
|
Try
|
|
If colRows.Count > 1 Then
|
|
aa = 100 / colRows.Count
|
|
pg.Bar1a.Maximum = colRows.Count
|
|
Else
|
|
aa = 1
|
|
pg.Bar1a.Maximum = 1
|
|
End If
|
|
Catch
|
|
End Try
|
|
pg.Info.Text = "Vorlagen exportieren"
|
|
pg.TopMost = True
|
|
pg.Bar1a.Minimum = 0
|
|
pg.Bar1a.Value = 0
|
|
pg.Show()
|
|
|
|
FileOpen(1, vorlagenverzeichnis + "\uebernahme.txt", OpenMode.Output)
|
|
PrintLine(1, "Vorlagenübernahme Produktion: " + Now)
|
|
counter = 0
|
|
For i = 0 To colRows.Count - 1
|
|
ovd.iOffice_vorlage_dateinr = New SqlInt32(CType(Me.DomainList.Columns("dateinr").CellValue(colRows(i)), Int32))
|
|
da = ovd.SelectOne()
|
|
If da.Rows.Count > 0 Then
|
|
If ovd.bFreigegeben.Value = True Then
|
|
Dim xx
|
|
s = Get_From_DB(Me.DomainList.Columns("dateinr").CellValue(colRows(i)), vorlagenverzeichnis + "\")
|
|
Dim anr As String = get_anwendungnr(Me.DomainList.Columns("dateinr").CellValue(colRows(i)))
|
|
x = s.LastIndexOf("\")
|
|
s = Microsoft.VisualBasic.Right(s, Len(s) - (x + 1))
|
|
ovd.daUebernahme_produktion = New SqlDateTime(CType(Now, DateTime))
|
|
Globals.conn.OpenConnection()
|
|
ovd.Update()
|
|
Globals.conn.CloseConnection(True)
|
|
s = ovd.daFragabe_am.ToString + "|" + ovd.iFreigabe_durch.ToString + "|" + ovd.iMutierer.ToString + "|" + ovd.daMutiert_am.ToString + "|" + s + "|" + anr
|
|
PrintLine(1, Trim(Str(Me.DomainList.Columns("nr").CellValue(colRows(i))) + "|" + s))
|
|
End If
|
|
End If
|
|
counter = counter + 1
|
|
pg.Bar1a.Value = pg.Bar1a.Value + 1
|
|
System.Windows.Forms.Application.DoEvents()
|
|
Next
|
|
pg.Close()
|
|
pg.Dispose()
|
|
FileClose(1)
|
|
ovd.Dispose()
|
|
Refresh_Data()
|
|
MsgBox("Anzahl exportierte Vorlagen: " + Trim(Str(counter)), MsgBoxStyle.Information)
|
|
End Sub
|
|
|
|
Private Sub MenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem7.Click
|
|
Dim i As Integer
|
|
Dim x As Integer
|
|
Dim a As Integer
|
|
Dim bm As Integer = Me.DomainList.Bookmark
|
|
Dim da As New DataTable()
|
|
Dim colRows As C1.Win.C1TrueDBGrid.SelectedRowCollection
|
|
Dim ovd As New edokadb.clsOffice_Vorlage_Datei()
|
|
Dim s As String
|
|
Dim counter As Integer
|
|
ovd.cpMainConnectionProvider = Globals.conn
|
|
colRows = Me.DomainList.SelectedRows
|
|
counter = 0
|
|
Me.Cursor = Cursors.WaitCursor
|
|
Dim pg As New frmProgress()
|
|
Dim aa As Integer
|
|
Try
|
|
If colRows.Count > 1 Then
|
|
aa = 100 / colRows.Count
|
|
pg.Bar1a.Maximum = colRows.Count
|
|
Else
|
|
aa = 1
|
|
pg.Bar1a.Maximum = 1
|
|
End If
|
|
Catch
|
|
End Try
|
|
pg.Info.Text = "Vorlagen exportieren"
|
|
pg.TopMost = True
|
|
pg.Bar1a.Minimum = 0
|
|
pg.Bar1a.Value = 0
|
|
pg.Show()
|
|
Dim stv As Boolean = DivFnkt.Check_Sysadmin_Stellvertreter(Me.DomainList.Columns("ownernr").Value)
|
|
|
|
For i = 0 To colRows.Count - 1
|
|
For x = 0 To Me.DomainList.Splits(0).Rows.Count - 1
|
|
If Me.DomainList.Columns("Dateinr").CellValue(x) = Me.DomainList.Columns("dateinr").CellValue(colRows(i)) Then
|
|
Me.DomainList.Bookmark = x
|
|
If Me.DomainList.Columns("ownernr").Value = Globals.MitarbeiterNr Or Sysadmin Or DivFnkt.Check_Sysadmin_Stellvertreter(Me.DomainList.Columns("ownernr").Value) = True Then
|
|
If freigabe() Then counter = counter + 1
|
|
Exit For
|
|
End If
|
|
End If
|
|
Next
|
|
pg.Bar1a.Value = pg.Bar1a.Value + 1
|
|
Windows.Forms.Application.DoEvents()
|
|
Next
|
|
Me.Refresh_Data()
|
|
Me.DomainList.Bookmark = bm
|
|
Me.Cursor = Cursors.Default
|
|
pg.Close()
|
|
pg.Dispose()
|
|
MsgBox("Anzahl freigegebene Vorlagen: " + Trim(Str(counter)), MsgBoxStyle.Information)
|
|
End Sub
|
|
|
|
Public Function freigabe() As Boolean
|
|
Dim ov As New edokadb.clsOffice_Vorlage_Datei()
|
|
Dim da As New DataTable()
|
|
Me.Bookmark = Me.DomainList.Bookmark
|
|
ov.cpMainConnectionProvider = Globals.conn
|
|
ov.iOffice_vorlage_dateinr = New SqlInt32(CType(Me.DomainList.Columns("dateinr").Text, Int32))
|
|
da = ov.SelectOne()
|
|
ov.bFreigegeben = New SqlBoolean(CType(True, Boolean))
|
|
ov.iFreigabe_durch = New SqlInt32(CType(Globals.MitarbeiterNr, Int32))
|
|
ov.daFragabe_am = New SqlDateTime(CType(Now, DateTime))
|
|
ov.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
|
|
ov.iMutierer = New SqlInt32(CType(Globals.MitarbeiterNr, Int32))
|
|
Globals.conn.OpenConnection()
|
|
ov.Update()
|
|
Globals.conn.CloseConnection(True)
|
|
Return True
|
|
End Function
|
|
|
|
Private Sub MenuItem8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem8.Click
|
|
Dim i As Integer
|
|
Dim x As Integer
|
|
Dim a As Integer
|
|
Dim bm As Integer = Me.DomainList.Bookmark
|
|
Dim da As New DataTable()
|
|
Dim colRows As C1.Win.C1TrueDBGrid.SelectedRowCollection
|
|
Dim ovd As New edokadb.clsOffice_Vorlage_Datei()
|
|
Dim s As String
|
|
Dim counter As Integer
|
|
ovd.cpMainConnectionProvider = Globals.conn
|
|
colRows = Me.DomainList.SelectedRows
|
|
counter = 0
|
|
Dim pg As New frmProgress()
|
|
Dim aa As Integer
|
|
Try
|
|
If colRows.Count > 1 Then
|
|
aa = 100 / colRows.Count
|
|
pg.Bar1a.Maximum = colRows.Count
|
|
Else
|
|
aa = 1
|
|
pg.Bar1a.Maximum = 1
|
|
End If
|
|
Catch
|
|
End Try
|
|
pg.Info.Text = "Vorlagen exportieren"
|
|
pg.TopMost = True
|
|
pg.Bar1a.Minimum = 0
|
|
pg.Bar1a.Value = 0
|
|
pg.Show()
|
|
|
|
Me.Cursor = Cursors.WaitCursor
|
|
For i = 0 To colRows.Count - 1
|
|
For x = 0 To Me.DomainList.Splits(0).Rows.Count - 1
|
|
If Me.DomainList.Columns("dateinr").CellValue(x) = Me.DomainList.Columns("dateinr").CellValue(colRows(i)) Then
|
|
Me.DomainList.Bookmark = x
|
|
If Me.DomainList.Columns("ownernr").Value = Globals.MitarbeiterNr Or Sysadmin Or DivFnkt.Check_Sysadmin_Stellvertreter(Me.DomainList.Columns("ownernr").Value) = True Then
|
|
aufhebung()
|
|
counter = counter + 1
|
|
Exit For
|
|
End If
|
|
End If
|
|
Next
|
|
pg.Bar1a.Value = pg.Bar1a.Value + 1
|
|
System.Windows.Forms.Application.DoEvents()
|
|
Next
|
|
Me.Refresh_Data()
|
|
Me.DomainList.Bookmark = bm
|
|
Me.Cursor = Cursors.Default
|
|
pg.Close()
|
|
pg.Dispose()
|
|
MsgBox("Anzahl aufgehobene Vorlagen: " + Trim(Str(counter)), MsgBoxStyle.Information)
|
|
End Sub
|
|
|
|
Private Sub aufhebung()
|
|
Me.Bookmark = Me.DomainList.Bookmark
|
|
Try
|
|
Dim ov As New edokadb.clsOffice_Vorlage_Datei()
|
|
Dim da As New DataTable()
|
|
ov.cpMainConnectionProvider = Globals.conn
|
|
ov.iOffice_vorlage_dateinr = New SqlInt32(CType(Me.DomainList.Columns("dateinr").Text, Int32))
|
|
da = ov.SelectOne()
|
|
ov.bFreigegeben = New SqlBoolean(CType(False, Boolean))
|
|
ov.iFreigabe_durch = New SqlInt32(CType(0, Int32))
|
|
ov.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
|
|
ov.iMutierer = New SqlInt32(CType(Globals.MitarbeiterNr, Int32))
|
|
Globals.conn.OpenConnection()
|
|
ov.Update()
|
|
Globals.conn.CloseConnection(True)
|
|
Dim Connection As New SqlConnection()
|
|
Dim DAA As New SqlDataAdapter("select * from office_vorlage_datei where office_vorlage_dateinr = " + Trim(Me.DomainList.Columns("DateiNr").Text), Connection)
|
|
Dim cb As SqlCommandBuilder = New SqlCommandBuilder(DAA)
|
|
Dim ds As New DataSet()
|
|
Dim myRow As DataRow
|
|
Connection.ConnectionString = Globals.sConnectionString
|
|
Connection.Open()
|
|
DAA.Fill(ds, "Docs")
|
|
myRow = ds.Tables(0).Rows(0)
|
|
myRow.Item(7) = System.DBNull.Value
|
|
DAA.Update(ds, "docs")
|
|
cb = Nothing
|
|
ds = Nothing
|
|
DAA = Nothing
|
|
Connection.Close()
|
|
Connection = Nothing
|
|
Catch
|
|
End Try
|
|
End Sub
|
|
|
|
Private Function Save_Vorlage_To_Db(ByVal dokumentname As String, ByVal office2010 As Boolean) As Boolean
|
|
Try
|
|
Dim IntFilename As String
|
|
Dim Connection As New SqlConnection()
|
|
Dim DA As New SqlDataAdapter("select * from office_vorlage_datei where office_vorlage_dateinr = " + Trim(Me.DomainList.Columns("DateiNr").Text), Connection)
|
|
Dim cb As SqlCommandBuilder = New SqlCommandBuilder(DA)
|
|
Dim ds As New DataSet()
|
|
Dim fs As New FileStream(dokumentname, FileMode.OpenOrCreate, FileAccess.Read)
|
|
Dim mydata(fs.Length) As Byte
|
|
Dim fi As New IO.FileInfo(dokumentname)
|
|
IntFilename = (fi.Name)
|
|
Try
|
|
fs.Read(mydata, 0, fs.Length)
|
|
If fs.Length = 0 Then
|
|
MsgBox("Fehler bei der Datei Nr: " + Trim(Me.DomainList.Columns("DateiNr").Text) + ", " + dokumentname)
|
|
fs.Close()
|
|
Return False
|
|
End If
|
|
fs.Close()
|
|
|
|
Connection.ConnectionString = Globals.sConnectionString
|
|
Connection.Open()
|
|
DA.Fill(ds, "docs")
|
|
Dim myRow As DataRow
|
|
If ds.Tables(0).Rows.Count = 0 Then
|
|
' Neues Dokument speichern
|
|
myRow = ds.Tables(0).NewRow
|
|
myRow.Item(0) = Me.DomainList.Columns("Dateinr").Text
|
|
myRow.Item(1) = 0
|
|
myRow.Item(2) = mydata
|
|
myRow.Item(3) = 1
|
|
myRow.Item(4) = Now
|
|
myRow.Item(5) = Globals.MitarbeiterNr
|
|
myRow.Item(6) = 0
|
|
myRow.Item(7) = System.DBNull.Value
|
|
myRow.Item(8) = 0
|
|
myRow.Item(10) = IntFilename
|
|
ds.Tables(0).Rows.Add(myRow)
|
|
DA.Update(ds, "docs")
|
|
Else
|
|
'Bestehendes Dokument sichenr
|
|
myRow = ds.Tables(0).Rows(0)
|
|
myRow.Item(2) = mydata
|
|
myRow.Item(3) = 1
|
|
myRow.Item(4) = Now
|
|
myRow.Item(5) = Globals.MitarbeiterNr
|
|
myRow.Item(6) = 0
|
|
myRow.Item(7) = System.DBNull.Value
|
|
myRow.Item(8) = 0
|
|
myRow.Item(10) = IntFilename
|
|
DA.Update(ds, "docs")
|
|
End If
|
|
Catch ex As Exception
|
|
MyMsg.show_standardmessage(86, MsgBoxStyle.Critical)
|
|
MsgBox(ex.Message)
|
|
End Try
|
|
fs = Nothing
|
|
cb = Nothing
|
|
ds = Nothing
|
|
DA = Nothing
|
|
|
|
Connection.Close()
|
|
Connection = Nothing
|
|
Return True
|
|
Catch
|
|
MyMsg.show_standardmessage(86, MsgBoxStyle.Critical)
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Function Get_From_DB(ByVal office_vorlagenr As Integer, ByVal pfad As String, Optional ByVal Office2010_Vorlage As Boolean = False) As String
|
|
|
|
Dim connection As New SqlConnection()
|
|
Dim s As String = "Select * From office_vorlage_datei where office_vorlage_Dateinr=" + Trim(Str(office_vorlagenr))
|
|
If Office2010_Vorlage = True Then
|
|
s = "Select * from Office2010_Vorlage_datei where office_vorlage_dateinr=" + Trim(Str(office_vorlagenr))
|
|
End If
|
|
Dim da As New SqlDataAdapter(s, connection)
|
|
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(da)
|
|
Dim ds As New DataSet()
|
|
Try
|
|
Dim filename As String
|
|
connection.ConnectionString = Globals.sConnectionString
|
|
connection.Open()
|
|
da.Fill(ds, "docs")
|
|
Dim myRow As DataRow
|
|
myRow = ds.Tables(0).Rows(0)
|
|
Dim MyData() As Byte
|
|
MyData = myRow.Item(2)
|
|
Dim K As Long
|
|
K = UBound(MyData)
|
|
filename = pfad + "" + myRow.Item(10)
|
|
Dim fs As New FileStream(filename, FileMode.OpenOrCreate, FileAccess.Write)
|
|
fs.Write(MyData, 0, K)
|
|
fs.Close()
|
|
fs = Nothing
|
|
Return filename
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message)
|
|
End Try
|
|
CB = Nothing
|
|
ds = Nothing
|
|
da = Nothing
|
|
connection.Close()
|
|
connection = Nothing
|
|
End Function
|
|
|
|
'--20180107 Rel. 5.4
|
|
Public Function Get_AppNr(ByVal Office_vorlagenr As Integer) As String
|
|
|
|
Dim connection As New SqlConnection()
|
|
Dim s As String = "Select * From office_vorlage where office_vorlage=" + Trim(Str(Office_vorlagenr))
|
|
Dim da As New SqlDataAdapter(s, connection)
|
|
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(da)
|
|
Dim ds As New DataSet()
|
|
Try
|
|
Dim filename As String
|
|
connection.ConnectionString = Globals.sConnectionString
|
|
connection.Open()
|
|
da.Fill(ds, "docs")
|
|
Return ds.Tables(0).Rows(0).Item("anwendungnr").ToString
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message)
|
|
End Try
|
|
CB = Nothing
|
|
ds = Nothing
|
|
da = Nothing
|
|
connection.Close()
|
|
connection = Nothing
|
|
End Function
|
|
Public Function Get_Office_Dokumenttype(ByVal Office_Vorlagenr As Integer) As String
|
|
Dim ov As New edokadb.clsOffice_vorlage()
|
|
ov.cpMainConnectionProvider = Globals.conn
|
|
ov.iOffice_vorlagenr = New SqlInt32(CType(Office_Vorlagenr, Int32))
|
|
ov.SelectOne()
|
|
Dim i As Integer = 0
|
|
If DivFnkt.Get_Office_2010_Param(9) = "True" Then
|
|
Dim f As New frmImportOffice2010(0)
|
|
i = f.Get_Applikationnr(Office_Vorlagenr)
|
|
If i <> 0 Then
|
|
ov.iAnwendungnr = New SqlInt32(CType(i, Int32))
|
|
End If
|
|
f.Dispose()
|
|
End If
|
|
Try
|
|
i = ov.iAnwendungnr.Value
|
|
'Rel. Office 2010
|
|
Select Case ov.iAnwendungnr.Value
|
|
Case 1
|
|
Return ".doc"
|
|
Case 2
|
|
Return ".xls"
|
|
Case 3
|
|
Return ".pdf"
|
|
Case 4
|
|
Return ".docx"
|
|
Case 5
|
|
Return ".docm"
|
|
Case 6
|
|
Return ".dotx"
|
|
Case 7
|
|
Return ".dotm"
|
|
Case 8
|
|
Return ".xlsx"
|
|
Case 9
|
|
Return ".xlsm"
|
|
Case 10
|
|
Return ".xltx"
|
|
Case 11
|
|
Return ".xltm"
|
|
End Select
|
|
Catch ex As Exception
|
|
Finally
|
|
ov.Dispose()
|
|
End Try
|
|
|
|
End Function
|
|
|
|
|
|
|
|
Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem6.Click
|
|
If check_passwort() = False Then Exit Sub
|
|
Dim f As New FolderSelect()
|
|
f.InitialDirectory = "C:\"
|
|
f.InitialDirectoryExpanded = True
|
|
f.ShowDialog()
|
|
If f.DialogResult = DialogResult.OK Then
|
|
Me.Cursor = Cursors.WaitCursor
|
|
If Check_Import_Vorlagen(f.fullPath) Then Import_Vorlagen(f.fullPath)
|
|
End If
|
|
Me.Refresh_Data()
|
|
Me.Cursor = Cursors.Default
|
|
f.Dispose()
|
|
End Sub
|
|
|
|
Private Function Check_Import_Vorlagen(ByVal vorlagenverzeichnis As String)
|
|
Dim s As String
|
|
Dim Fehler As String = ""
|
|
Dim Splitter
|
|
Dim da As DataTable
|
|
Dim ov As New edokadb.clsOffice_vorlage()
|
|
ov.cpMainConnectionProvider = conn
|
|
FileOpen(1, vorlagenverzeichnis + "\uebernahme.txt", OpenMode.Input)
|
|
Input(1, s)
|
|
While Not EOF(1)
|
|
Input(1, s)
|
|
Splitter = Microsoft.VisualBasic.Split(s, "|")
|
|
ov.iOffice_vorlagenr = New SqlInt32(CType(Splitter(0), Int32))
|
|
da = ov.SelectOne()
|
|
If da.Rows.Count = 0 Then
|
|
If Fehler <> "" Then Fehler = Fehler + ", "
|
|
Fehler = Fehler + Trim(Splitter(0))
|
|
End If
|
|
End While
|
|
ov.Dispose()
|
|
FileClose(1)
|
|
If Len(Fehler) > 0 Then
|
|
MsgBox("Folgende Office-Vorlagen sind nicht vorhanden: " + Fehler)
|
|
Return False
|
|
Else
|
|
Return True
|
|
End If
|
|
End Function
|
|
|
|
Private Sub Import_Vorlagen(ByVal vorlagenverzeichnis As String)
|
|
Dim ovd As New edokaDB.clsOffice_Vorlage_Datei()
|
|
Dim anr As Integer
|
|
Dim da As New DataTable()
|
|
Dim s As String
|
|
Dim splitter
|
|
Dim counter As Integer
|
|
ovd.cpMainConnectionProvider = Globals.conn
|
|
counter = 0
|
|
FileOpen(1, vorlagenverzeichnis + "\uebernahme.txt", OpenMode.Input)
|
|
Input(1, s)
|
|
While Not EOF(1)
|
|
Input(1, s)
|
|
splitter = Microsoft.VisualBasic.Split(s, "|")
|
|
ovd.iOffice_vorlage_dateinr = New SqlInt32(CType(splitter(0), Int32))
|
|
da = ovd.SelectOne
|
|
|
|
If da.Rows.Count = 0 Then
|
|
ovd.iOffice_vorlage_dateinr = New SqlInt32(CType(splitter(0), Int32))
|
|
ovd.bAktiv = New SqlBoolean(CType(True, Boolean))
|
|
ovd.bFreigegeben = New SqlBoolean(CType(True, Boolean))
|
|
ovd.daFragabe_am = New SqlDateTime(CType(splitter(1), DateTime))
|
|
ovd.daMutiert_am = New SqlDateTime(CType(splitter(4), DateTime))
|
|
ovd.daUebernahme_produktion = New SqlDateTime(CType(Now, DateTime))
|
|
ovd.iFreigabe_durch = New SqlInt32(CType(splitter(2), Int32))
|
|
ovd.iMutierer = New SqlInt32(CType(Globals.MitarbeiterNr, Int32))
|
|
ovd.iOffice_vorlagenr = ovd.iOffice_vorlage_dateinr
|
|
ovd.sDateiname = New SqlString(CType(splitter(5), String))
|
|
Try
|
|
anr = splitter(6)
|
|
Catch ex As Exception
|
|
anr = -1
|
|
End Try
|
|
Globals.conn.OpenConnection()
|
|
ovd.Insert()
|
|
Globals.conn.CloseConnection(True)
|
|
Else
|
|
ovd.bAktiv = New SqlBoolean(CType(True, Boolean))
|
|
ovd.bFreigegeben = New SqlBoolean(CType(True, Boolean))
|
|
ovd.daFragabe_am = New SqlDateTime(CType(splitter(1), DateTime))
|
|
ovd.daMutiert_am = New SqlDateTime(CType(splitter(4), DateTime))
|
|
ovd.daUebernahme_produktion = New SqlDateTime(CType(Now, DateTime))
|
|
ovd.iFreigabe_durch = New SqlInt32(CType(splitter(2), Int32))
|
|
ovd.iMutierer = New SqlInt32(CType(Globals.MitarbeiterNr, Int32))
|
|
ovd.iOffice_vorlagenr = ovd.iOffice_vorlage_dateinr
|
|
ovd.sDateiname = New SqlString(CType(splitter(3), String))
|
|
Try
|
|
anr = splitter(6)
|
|
Catch ex As Exception
|
|
anr = -1
|
|
End Try
|
|
Globals.conn.OpenConnection()
|
|
ovd.Update()
|
|
Globals.conn.CloseConnection(True)
|
|
End If
|
|
If Save_Vorlage_To_Db_Import(vorlagenverzeichnis + "\" + splitter(5), ovd.iOffice_vorlage_dateinr.Value) Then counter = counter + 1
|
|
If anr <> -1 Then update_applikation(splitter(0), anr)
|
|
End While
|
|
da.Dispose()
|
|
ovd.Dispose()
|
|
FileClose(1)
|
|
Me.Refresh_Data()
|
|
MsgBox("Anzahl importierte Vorlagen:" + Str(counter))
|
|
End Sub
|
|
|
|
Sub update_applikation(ByVal officevorlagenr As Integer, ByVal anwendungnr As Integer)
|
|
Try
|
|
Dim Connection As New SqlConnection()
|
|
Dim c As New SqlCommand("Update office_vorlage set anwendungnr=" + anwendungnr.ToString + " where office_vorlagenr=" + officevorlagenr.ToString, Connection)
|
|
Connection.ConnectionString = Globals.sConnectionString
|
|
Connection.Open()
|
|
c.ExecuteNonQuery()
|
|
Connection.Close()
|
|
Catch
|
|
End Try
|
|
|
|
|
|
End Sub
|
|
|
|
Private Function Save_Vorlage_To_Db_Import(ByVal dokumentname As String, ByVal nr As Integer) As Boolean
|
|
Try
|
|
Dim IntFilename As String
|
|
Dim Connection As New SqlConnection()
|
|
Dim DA As New SqlDataAdapter("select * from office_vorlage_datei where office_vorlagenr = " + Trim(Str(nr)), Connection)
|
|
Dim cb As SqlCommandBuilder = New SqlCommandBuilder(DA)
|
|
Dim ds As New DataSet()
|
|
Dim fs As New FileStream(dokumentname, FileMode.OpenOrCreate, FileAccess.Read)
|
|
Dim mydata(fs.Length) As Byte
|
|
Dim fi As New IO.FileInfo(dokumentname)
|
|
IntFilename = (fi.Name)
|
|
Try
|
|
fs.Read(mydata, 0, fs.Length)
|
|
If fs.Length = 0 Then
|
|
MsgBox("Fehler bei der Datei Nr: " + Trim(nr) + ", " + dokumentname)
|
|
fs.Close()
|
|
Return False
|
|
End If
|
|
fs.Close()
|
|
Connection.ConnectionString = Globals.sConnectionString
|
|
Connection.Open()
|
|
DA.Fill(ds, "docs")
|
|
Dim myRow As DataRow
|
|
|
|
myRow = ds.Tables(0).Rows(0)
|
|
myRow.Item(2) = mydata
|
|
myRow.Item(10) = IntFilename
|
|
DA.Update(ds, "docs")
|
|
Return True
|
|
Catch ex As Exception
|
|
MyMsg.show_standardmessage(86, MsgBoxStyle.Critical)
|
|
Return False
|
|
End Try
|
|
fs = Nothing
|
|
cb = Nothing
|
|
ds = Nothing
|
|
DA = Nothing
|
|
|
|
Connection.Close()
|
|
Connection = Nothing
|
|
Catch
|
|
MyMsg.show_standardmessage(86, MsgBoxStyle.Critical)
|
|
End Try
|
|
End Function
|
|
|
|
|
|
|
|
Private Sub C1TrueDBGrid1_FetchRowStyle(ByVal sender As Object, ByVal e As C1.Win.C1TrueDBGrid.FetchRowStyleEventArgs) Handles C1TrueDBGrid1.FetchRowStyle, DomainList.FetchRowStyle
|
|
If Me.C1TrueDBGrid1.Columns("Uebernehmen").CellValue(e.Row) = 1 Then
|
|
e.CellStyle.ForeColor = System.Drawing.Color.Red
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemVorlage.Click
|
|
Dim s As String
|
|
s = InputBox("Office-Vorlagenr Produktion", "Office-Vorlagenr Produktion erfassen")
|
|
If Len(s) > 0 Then
|
|
Dim ovd As New edokadb.clsOffice_Vorlage_Datei()
|
|
ovd.cpMainConnectionProvider = conn
|
|
ovd.iOffice_vorlage_dateinr = New SqlInt32(CType(Me.DomainList.Columns("dateinr").Value, Integer))
|
|
ovd.SelectOne()
|
|
Dim Splitter = Microsoft.VisualBasic.Split(ovd.sDateiname.Value.ToString, ".")
|
|
|
|
ovd.iOffice_vorlagenr = New SqlInt32(CType(s, Integer))
|
|
ovd.sDateiname = New SqlString(CType(Trim(s) + "." + Splitter(1), String))
|
|
conn.OpenConnection()
|
|
ovd.Update()
|
|
conn.CloseConnection(True)
|
|
ovd.Dispose()
|
|
Refresh_Data()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub MenuItem11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem11.Click
|
|
Try
|
|
Me.SaveFileDialog1.FileName = Me.DomainList.Columns("dateiname").Value
|
|
Catch
|
|
Me.SaveFileDialog1.FileName = ""
|
|
End Try
|
|
|
|
Me.SaveFileDialog1.Filter = ""
|
|
If Me.SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK And Me.SaveFileDialog1.FileName <> "" Then
|
|
Me.Get_From_DB_1(Me.DomainList.Columns("Dateinr").Value, Me.SaveFileDialog1.FileName)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub MenuItem13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem13.Click
|
|
Me.SaveFileDialog1.FileName = ""
|
|
Me.SaveFileDialog1.Filter = ""
|
|
If Me.SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK And Me.SaveFileDialog1.FileName <> "" Then
|
|
Me.Get_From_DB_Office_2010(Me.DomainList.Columns("Dateinr").Value, Me.SaveFileDialog1.FileName)
|
|
End If
|
|
End Sub
|
|
Private Sub MenuItem14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem14.Click
|
|
If MsgBox("Office-2010-Vorlage löschen?", MsgBoxStyle.YesNo + MsgBoxStyle.Question) = MsgBoxResult.Yes Then
|
|
Delete_Office2010_vorlage(Me.DomainList.Columns("Dateinr").Value)
|
|
End If
|
|
End Sub
|
|
|
|
Public Function Delete_Office2010_vorlage(ByVal vorlagenr As Integer)
|
|
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
|
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
|
scmCmdToExecute.CommandText = "delete from Office2010_Vorlage_datei where office_vorlage_Dateinr=" + Trim(Str(vorlagenr))
|
|
scmCmdToExecute.CommandType = CommandType.Text
|
|
scmCmdToExecute.Connection = conn.scoDBConnection
|
|
Try
|
|
scmCmdToExecute.Connection.Open()
|
|
scmCmdToExecute.ExecuteNonQuery()
|
|
Catch ex As Exception
|
|
MsgBox("Beim Löschen ist ein Fehler aufgetreten:" + ex.Message)
|
|
Finally
|
|
scmCmdToExecute.Connection.Close()
|
|
scmCmdToExecute.Dispose()
|
|
End Try
|
|
End Function
|
|
|
|
Public Function Get_From_DB_1(ByVal office_vorlagenr As Integer, ByVal Filename As String) As String
|
|
Dim connection As New SqlConnection()
|
|
Dim da As New SqlDataAdapter("Select * From office_vorlage_datei where office_vorlage_Dateinr=" + Trim(Str(office_vorlagenr)), connection)
|
|
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(da)
|
|
Dim ds As New DataSet()
|
|
Try
|
|
connection.ConnectionString = Globals.sConnectionString
|
|
connection.Open()
|
|
da.Fill(ds, "docs")
|
|
Dim myRow As DataRow
|
|
myRow = ds.Tables(0).Rows(0)
|
|
Dim MyData() As Byte
|
|
MyData = myRow.Item(2)
|
|
Dim K As Long
|
|
K = UBound(MyData)
|
|
Dim fs As New FileStream(Filename, FileMode.OpenOrCreate, FileAccess.Write)
|
|
fs.Write(MyData, 0, K)
|
|
fs.Close()
|
|
fs = Nothing
|
|
Return filename
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message)
|
|
End Try
|
|
CB = Nothing
|
|
ds = Nothing
|
|
da = Nothing
|
|
connection.Close()
|
|
connection = Nothing
|
|
End Function
|
|
|
|
|
|
Public Function Get_From_DB_Office_2010(ByVal office_vorlagenr As Integer, ByVal Filename As String) As String
|
|
Dim connection As New SqlConnection()
|
|
Dim da As New SqlDataAdapter("Select * From Office2010_Vorlage_datei where office_vorlage_Dateinr=" + Trim(Str(office_vorlagenr)), connection)
|
|
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(da)
|
|
Dim ds As New DataSet()
|
|
Try
|
|
connection.ConnectionString = Globals.sConnectionString
|
|
connection.Open()
|
|
da.Fill(ds, "docs")
|
|
Dim myRow As DataRow
|
|
myRow = ds.Tables(0).Rows(0)
|
|
Dim MyData() As Byte
|
|
MyData = myRow.Item(2)
|
|
Dim K As Long
|
|
K = UBound(MyData)
|
|
Dim fs As New FileStream(Filename, FileMode.OpenOrCreate, FileAccess.Write)
|
|
fs.Write(MyData, 0, K)
|
|
fs.Close()
|
|
fs = Nothing
|
|
Return Filename
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message)
|
|
End Try
|
|
CB = Nothing
|
|
ds = Nothing
|
|
da = Nothing
|
|
connection.Close()
|
|
connection = Nothing
|
|
End Function
|
|
|
|
|
|
|
|
End Class
|