diff --git a/app/DpmaXmlParser/Config.vb b/app/DpmaXmlParser/Config.vb index 54f581e..b14deb7 100644 --- a/app/DpmaXmlParser/Config.vb +++ b/app/DpmaXmlParser/Config.vb @@ -1,5 +1,4 @@ Imports System.Configuration -Imports System Public Class AppConfig @@ -10,21 +9,21 @@ Public Class AppConfig Dim appsettings As AppSettingsSection = appconfig.AppSettings Dim settings As KeyValueConfigurationCollection = appsettings.Settings - Dim values As New ConfigValues() - - values.username = settings.Item("dpma_username").Value - values.password = settings.Item("dpma_password").Value - values.query = settings.Item("dpma_query").Value - values.queryIgnore = settings.Item("dpma_query_ignore").Value - values.connstring = settings.Item("sql_connstring").Value - values.database = settings.Item("sql_database").Value - values.searchType = settings.Item("search_type").Value + Dim values As New ConfigValues() With { + .username = settings.Item("dpma_username").Value, + .password = settings.Item("dpma_password").Value, + .query = settings.Item("dpma_query").Value, + .queryIgnore = settings.Item("dpma_query_ignore").Value, + .connstring = settings.Item("sql_connstring").Value, + .database = settings.Item("sql_database").Value, + .searchType = settings.Item("search_type").Value + } Return values End Function Public Shared Function GetVersion() - Dim assembly As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly() + Dim assembly As Reflection.Assembly = Reflection.Assembly.GetExecutingAssembly() Dim fvi As FileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location) Dim version As String = fvi.FileVersion Return version @@ -40,7 +39,4 @@ Public Class ConfigValues Public connstring As String Public database As String Public searchType As String - - Public Sub New() - End Sub End Class \ No newline at end of file diff --git a/app/DpmaXmlParser/DB.vb b/app/DpmaXmlParser/DB.vb index aea897c..bcc01c8 100644 --- a/app/DpmaXmlParser/DB.vb +++ b/app/DpmaXmlParser/DB.vb @@ -19,17 +19,17 @@ Public Class DB End Sub #Region "=== HELPERS ===" - Public Function formatTable(table As String) As String + Public Function FormatTable(table As String) As String Return String.Format("[{0}].[dbo].[{1}]", _db, table) End Function Public Function GetFormIdFor(entityName As String) As Integer - Dim sql = String.Format("SELECT GUID FROM {0} WHERE NAME = '{1}'", Me.formatTable("TBPMO_FORM"), entityName) + Dim sql = String.Format("SELECT GUID FROM {0} WHERE NAME = '{1}'", Me.FormatTable("TBPMO_FORM"), entityName) Return Me.Scalar(sql) End Function Public Function GetControlId(formId As Integer, Optional name As String = "ApplicationNumber") As Integer - Dim sql = String.Format("SELECT GUID FROM {0} WHERE NAME = '{1}' AND FORM_ID = {2}", Me.formatTable("TBPMO_CONTROL"), name, formId) + Dim sql = String.Format("SELECT GUID FROM {0} WHERE NAME = '{1}' AND FORM_ID = {2}", Me.FormatTable("TBPMO_CONTROL"), name, formId) Return Me.Scalar(sql) End Function @@ -54,7 +54,7 @@ Public Class DB End Function Public Function IsEqual(controlId As Integer, recordId As Integer, valueToCompare As Object) - Dim table = Me.formatTable("TBPMO_CONTROL_VALUE") + Dim table = Me.FormatTable("TBPMO_CONTROL_VALUE") Dim sql = String.Format("SELECT VALUE FROM {0} WHERE CONTROL_ID = {1} AND RECORD_ID = {2}", table, controlId, recordId) Dim value = Me.Scalar(sql) @@ -65,15 +65,15 @@ Public Class DB Return value = valueToCompare End Function #End Region - + #Region "=== RECORD ID ===" Public Function GetRecordId(controlId As Integer, applicationNumber As String) As Integer - Dim sql = String.Format("SELECT RECORD_ID FROM {0} WHERE CONTROL_ID = {1} AND VALUE = '{2}'", Me.formatTable("TBPMO_CONTROL_VALUE"), controlId, applicationNumber) + Dim sql = String.Format("SELECT RECORD_ID FROM {0} WHERE CONTROL_ID = {1} AND VALUE = '{2}'", Me.FormatTable("TBPMO_CONTROL_VALUE"), controlId, applicationNumber) Return Me.Scalar(sql) End Function Public Function InsertRecord(formId As Integer) - Dim sql = String.Format("INSERT INTO {0} (FORM_ID, ADDED_WHO, RECORD_ENTITY_ID, PARENT_RECORD) VALUES ({1}, '{2}', {1}, 0)", Me.formatTable("TBPMO_RECORD"), formId, Username) + Dim sql = String.Format("INSERT INTO {0} (FORM_ID, ADDED_WHO, RECORD_ENTITY_ID, PARENT_RECORD) VALUES ({1}, '{2}', {1}, 0)", Me.FormatTable("TBPMO_RECORD"), formId, Username) Me.NonQuery(sql) Return Me.Scalar("SELECT MAX(GUID) FROM TBPMO_RECORD") End Function @@ -81,19 +81,19 @@ Public Class DB #Region "=== VALUES ===" Public Function InsertValue(controlId As Integer, recordId As Integer, value As Object) - Dim table = Me.formatTable("TBPMO_CONTROL_VALUE") + Dim table = Me.FormatTable("TBPMO_CONTROL_VALUE") Dim sql = String.Format("INSERT INTO {0} (CONTROL_ID, RECORD_ID, VALUE, ADDED_WHO) VALUES ({1}, {2}, '{3}', '{4}')", table, controlId, recordId, value, Username) Me.NonQuery(sql) Return Me.Scalar(String.Format("SELECT MAX(GUID) FROM {0} WHERE CONTROL_ID = {1}", table, controlId)) End Function Public Sub UpdateValue(controlId As Integer, recordId As Integer, value As Object) - Dim table = Me.formatTable("TBPMO_CONTROL_VALUE") + Dim table = Me.FormatTable("TBPMO_CONTROL_VALUE") Dim sql = String.Format("UPDATE {0} SET VALUE = '{1}', CHANGED_WHO = '{4}' WHERE CONTROL_ID = {2} AND RECORD_ID = {3} ", table, value, controlId, recordId, Username) Me.NonQuery(sql) End Sub #End Region - + #Region "=== DATABASE ===" Public Function Scalar(queryString As String) Dim conn As New SqlConnection(_connstring) @@ -152,7 +152,7 @@ Public Class DB #Region "=== IMAGES ===" Public Sub InsertImage(bimage As Byte(), ControlId As Integer, RecordId As Integer) - Dim table = Me.formatTable("TBPMO_CONTROL_IMAGE") + Dim table = Me.FormatTable("TBPMO_CONTROL_IMAGE") Dim sql = String.Format("INSERT INTO {0} (CONTROL_ID, RECORD_ID, IMG) VALUES (@CONTROL_ID, @RECORD_ID, @IMG)", table) Dim conn As New SqlClient.SqlConnection(_connstring) Dim cmd As New SqlClient.SqlCommand(sql, conn) @@ -167,7 +167,7 @@ Public Class DB End Sub Public Sub UpdateImage(bimage As Byte(), ControlId As Integer, RecordId As Integer) - Dim table = Me.formatTable("TBPMO_CONTROL_IMAGE") + Dim table = Me.FormatTable("TBPMO_CONTROL_IMAGE") Dim sql = String.Format("UPDATE {0} SET IMG = @IMG WHERE CONTROL_ID = @CONTROL_ID AND RECORD_ID = @RECORD_ID", table) Dim conn As New SqlClient.SqlConnection(_connstring) Dim cmd As New SqlClient.SqlCommand(sql, conn) diff --git a/app/DpmaXmlParser/DPMAConnectPatents.vb b/app/DpmaXmlParser/DPMAConnectPatents.vb index a15b32d..7261992 100644 --- a/app/DpmaXmlParser/DPMAConnectPatents.vb +++ b/app/DpmaXmlParser/DPMAConnectPatents.vb @@ -17,25 +17,6 @@ Public Class DPMAConnectPatents _service.Open() End Sub - Public Function SearchPatents(query As String) As XmlDocument - Dim doc As New XmlDocument() - Dim xmlstring As String - - Try - xmlstring = _service.search(_user, _pass, query) - doc.LoadXml(xmlstring) - - Dim ErrorMessage = doc.SelectSingleNode("Hitlist/ErrorMessage") - If Not IsNothing(ErrorMessage) Then - Throw New Exception(ErrorMessage.InnerText) - End If - Catch ex As Exception - Throw ex - End Try - - Return doc - End Function - Public Function Search(query As String) As XmlDocument Dim doc As New XmlDocument() Dim xmlstring As String diff --git a/app/DpmaXmlParser/My Project/AssemblyInfo.vb b/app/DpmaXmlParser/My Project/AssemblyInfo.vb index 51410a8..0068d0d 100644 --- a/app/DpmaXmlParser/My Project/AssemblyInfo.vb +++ b/app/DpmaXmlParser/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - +