dont crash on missing controls

This commit is contained in:
JenneJ 2015-12-08 10:54:31 +01:00
parent 6a6d544b48
commit 579ea3cb8c
4 changed files with 21 additions and 6 deletions

View File

@ -17,8 +17,8 @@
</system.serviceModel>
<appSettings>
<!-- Die Zugangangsdaten, die für den Zugriff auf die DPMA Datenbank benötigt werden -->
<add key="dpma_username" value="TestBrainpool"/>
<add key="dpma_password" value="09Test2015"/>
<add key="dpma_username" value="BRAINPOOL"/>
<add key="dpma_password" value="brainPOOL1"/>
<!-- query erwartet entweder eine mit Kommagetrennte List oder einen SQL Befehl, der ein einspaltiges Ergebnis liefert -->
<!--<add key="dpma_query" value="SELECT [Unternehmen] FROM [DD_ECM].[dbo].[VWTEMP_PMO_FORM19] WHERE ProdUnternehmen = 1 ORDER BY Unternehmen"/>-->
<add key="dpma_query" value="BRAINPOOL Artist und Content Services GmbH,BRAINPOOL TV GmbH,BRAINPOOL TV GmbH / Stein TV,Elton TV Produktions GmbH,Köln Comedy Festival GmbH,Kuttner TV GmbH,Ladykracher TV GmbH,MARIO BARTH TV Produktionsgesellschaft mbH ,mea culpa TV Production GmbH,Millionärswahl Formatentwicklungs- und -verwertungsgesellschaft mbH,Minestrone TV Produktions GbR ,Pocher TV GmbH,Princess TV GmbH ,Punani Enterprises GmbH,Raab TV-Produktion GmbH,Stein TV-Produktion GmbH,Ulmen Television GmbH"/>

View File

@ -19,6 +19,13 @@ Public Class AppConfig
Return New ConfigValues(username, password, query, connstring, database)
End Function
Public Shared Function GetVersion()
Dim assembly As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly()
Dim fvi As FileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location)
Dim version As String = fvi.FileVersion
Return version
End Function
End Class
Public Class ConfigValues

View File

@ -21,6 +21,7 @@ Module Main
Private query As String
Private config As ConfigValues
Private version As String
Private marks As New List(Of Mark)
Private props = New List(Of String) From {
"RegistrationOfficeCode",
@ -46,8 +47,9 @@ Module Main
logger = LogManager.GetLogger("Main")
config = AppConfig.GetConfiguration()
db = New DB(config.connstring, "DD_ECM")
version = AppConfig.GetVersion()
logger.Info("{0} started", My.Application.Info.Title)
logger.Info("{0} (Version {1}) started", My.Application.Info.Title, version)
If Not Directory.Exists(DataDir) Then
Directory.CreateDirectory(DataDir)
@ -118,6 +120,12 @@ Module Main
Dim controlId = db.GetControlId(formId, prop)
' Wert für die aktuelle property holen
Dim value = db.GetProperty(m, prop)
If controlId = 0 Then
logger.Warn("Value NOT inserted - ControlId for Property {0} could not be found.")
Continue For
End If
' Wert einfügen
db.InsertValue(controlId, recordId, value)

View File

@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
<Assembly: AssemblyVersion("1.0.1.0")>
<Assembly: AssemblyFileVersion("1.0.1.0")>