Initial commit

This commit is contained in:
2020-10-21 10:43:18 +02:00
commit 56bd02798f
5848 changed files with 2659025 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("BMS Logging DLL")>
<Assembly: AssemblyDescription("Writes journal entries to BMS database journal")>
<Assembly: AssemblyCompany("Zubler & Partner")>
<Assembly: AssemblyProduct("BMS Logging DLL")>
<Assembly: AssemblyCopyright("")>
<Assembly: AssemblyTrademark("")>
<Assembly: CLSCompliant(True)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("2BBEB51D-23B1-4418-A844-9471B78A910B")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
<Assembly: AssemblyVersion("2.0.*")>

61
BMS/BMSDll/BMSDll.sln Normal file
View File

@@ -0,0 +1,61 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "BMSDll", "BMSDll.vbproj", "{A3645B42-5328-4197-92A6-3124FE38AD0C}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Common", "..\Common\Common.vbproj", "{A1E2756A-4E32-40BB-B449-9BDA1C15DE84}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DataAccess", "..\DataAccess\DataAccess.vbproj", "{21B54F51-D2B2-459E-895C-540AD4A8704F}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ZpCryptography", "..\ZpCryptography\ZpCryptography.vbproj", "{290C31E0-49C7-4E85-A39F-CA496BE678B6}"
EndProject
Global
GlobalSection(SourceCodeControl) = preSolution
SccNumberOfProjects = 4
SccProjectUniqueName0 = BMSDll.vbproj
SccProjectName0 = \u0022$/BMS/BMSDll\u0022,\u0020DSCAAAAA
SccLocalPath0 = .
SccProvider0 = MSSCCI:Microsoft\u0020Visual\u0020SourceSafe
CanCheckoutShared = false
SccProjectUniqueName1 = ..\\Common\\Common.vbproj
SccProjectName1 = \u0022$/BMS/Common\u0022,\u0020LTCAAAAA
SccLocalPath1 = ..\\Common
SccProvider1 = MSSCCI:Microsoft\u0020Visual\u0020SourceSafe
CanCheckoutShared = false
SccProjectUniqueName2 = ..\\DataAccess\\DataAccess.vbproj
SccProjectName2 = \u0022$/BMS/DataAccess\u0022,\u0020STCAAAAA
SccLocalPath2 = ..\\DataAccess
SccProvider2 = MSSCCI:Microsoft\u0020Visual\u0020SourceSafe
CanCheckoutShared = false
SccProjectUniqueName3 = ..\\ZpCryptography\\ZpCryptography.vbproj
SccProjectName3 = \u0022$/BMS/ZpCryptography\u0022,\u0020PUCAAAAA
SccLocalPath3 = ..\\ZpCryptography
SccProvider3 = MSSCCI:Microsoft\u0020Visual\u0020SourceSafe
CanCheckoutShared = false
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A3645B42-5328-4197-92A6-3124FE38AD0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A3645B42-5328-4197-92A6-3124FE38AD0C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A3645B42-5328-4197-92A6-3124FE38AD0C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A3645B42-5328-4197-92A6-3124FE38AD0C}.Release|Any CPU.Build.0 = Release|Any CPU
{A1E2756A-4E32-40BB-B449-9BDA1C15DE84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1E2756A-4E32-40BB-B449-9BDA1C15DE84}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1E2756A-4E32-40BB-B449-9BDA1C15DE84}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A1E2756A-4E32-40BB-B449-9BDA1C15DE84}.Release|Any CPU.Build.0 = Release|Any CPU
{21B54F51-D2B2-459E-895C-540AD4A8704F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{21B54F51-D2B2-459E-895C-540AD4A8704F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21B54F51-D2B2-459E-895C-540AD4A8704F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{21B54F51-D2B2-459E-895C-540AD4A8704F}.Release|Any CPU.Build.0 = Release|Any CPU
{290C31E0-49C7-4E85-A39F-CA496BE678B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{290C31E0-49C7-4E85-A39F-CA496BE678B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{290C31E0-49C7-4E85-A39F-CA496BE678B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{290C31E0-49C7-4E85-A39F-CA496BE678B6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

BIN
BMS/BMSDll/BMSDll.suo Normal file

Binary file not shown.

7
BMS/BMSDll/BMSDll.vbdoc Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!-- VBdocman .NET config file for current project.-->
<!-- Example: <add key="settingName" value="settingValue"/> -->
</appSettings>
</configuration>

122
BMS/BMSDll/BMSDll.vbproj Normal file
View File

@@ -0,0 +1,122 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A3645B42-5328-4197-92A6-3124FE38AD0C}</ProjectGuid>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>BMS</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyMode>None</AssemblyOriginatorKeyMode>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<OptionCompare>Binary</OptionCompare>
<OptionExplicit>On</OptionExplicit>
<OptionStrict>Off</OptionStrict>
<RootNamespace>bms</RootNamespace>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<MyType>Windows</MyType>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\</OutputPath>
<DocumentationFile>BMS.xml</DocumentationFile>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>
</DefineConstants>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>1</WarningLevel>
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
<DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\</OutputPath>
<DocumentationFile>BMS.xml</DocumentationFile>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>
</DefineConstants>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>1</WarningLevel>
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
<DebugType>none</DebugType>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="Logging.vb">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.vbproj">
<Project>{A1E2756A-4E32-40BB-B449-9BDA1C15DE84}</Project>
<Name>Common</Name>
</ProjectReference>
<ProjectReference Include="..\DataAccess\DataAccess.vbproj">
<Project>{21B54F51-D2B2-459E-895C-540AD4A8704F}</Project>
<Name>DataAccess</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="My Project\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,58 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastOpenVersion>7.10.3077</LastOpenVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ReferencePath>
</ReferencePath>
<CopyProjectDestinationFolder>
</CopyProjectDestinationFolder>
<CopyProjectUncPath>
</CopyProjectUncPath>
<CopyProjectOption>0</CopyProjectOption>
<ProjectView>ProjectFiles</ProjectView>
<ProjectTrust>0</ProjectTrust>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<EnableASPDebugging>false</EnableASPDebugging>
<EnableASPXDebugging>false</EnableASPXDebugging>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
<RemoteDebugEnabled>false</RemoteDebugEnabled>
<RemoteDebugMachine>
</RemoteDebugMachine>
<StartAction>Project</StartAction>
<StartArguments>
</StartArguments>
<StartPage>
</StartPage>
<StartProgram>
</StartProgram>
<StartURL>
</StartURL>
<StartWorkingDirectory>
</StartWorkingDirectory>
<StartWithIE>false</StartWithIE>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<EnableASPDebugging>false</EnableASPDebugging>
<EnableASPXDebugging>false</EnableASPXDebugging>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
<RemoteDebugEnabled>false</RemoteDebugEnabled>
<RemoteDebugMachine>
</RemoteDebugMachine>
<StartAction>Project</StartAction>
<StartArguments>
</StartArguments>
<StartPage>
</StartPage>
<StartProgram>
</StartProgram>
<StartURL>
</StartURL>
<StartWorkingDirectory>
</StartWorkingDirectory>
<StartWithIE>false</StartWithIE>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = "relative:bms"
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View File

@@ -0,0 +1,32 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("BMS Service")>
<Assembly: AssemblyDescription("Handles start and watch jobs over the BMS programs")>
<Assembly: AssemblyCompany("Zubler & Partner")>
<Assembly: AssemblyProduct("BMS Service")>
<Assembly: AssemblyCopyright("")>
<Assembly: AssemblyTrademark("")>
<Assembly: CLSCompliant(True)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("45063487-0CB3-470D-B394-444EA2CEF66D")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
<Assembly: AssemblyVersion("1.0.*")>

View File

@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used forserialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Assembly</value>
</data>
<data name="$this.Name">
<value>BMSService</value>
</data>
</root>

View File

@@ -0,0 +1,28 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "BMSService", "BMSService.vbproj", "{36BEB3BE-ABB4-4843-B6BB-588F5A9DF6C6}"
EndProject
Global
GlobalSection(SourceCodeControl) = preSolution
SccNumberOfProjects = 1
SccProjectUniqueName0 = BMSService.vbproj
SccProjectName0 = \u0022$/BMS/BMSDll/BMSService\u0022,\u0020NSCAAAAA
SccLocalPath0 = .
SccProvider0 = MSSCCI:Microsoft\u0020Visual\u0020SourceSafe
CanCheckoutShared = false
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{36BEB3BE-ABB4-4843-B6BB-588F5A9DF6C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{36BEB3BE-ABB4-4843-B6BB-588F5A9DF6C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{36BEB3BE-ABB4-4843-B6BB-588F5A9DF6C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{36BEB3BE-ABB4-4843-B6BB-588F5A9DF6C6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Binary file not shown.

View File

@@ -0,0 +1,365 @@
#Region "Includes"
Imports System.ServiceProcess
Imports System.Data.SqlClient
Imports System.Xml
Imports Common.Common
#End Region
Public Class BMSService
Inherits System.ServiceProcess.ServiceBase
#Region "Members"
Private m_TimerStarter As System.Threading.Timer
Private m_TimerWatcher As System.Threading.Timer
Private m_EventLog As EventLog
Private m_StartJobs As DataSet
Private m_WatchJobs As DataSet
Private m_Common As Common.Common
#End Region
#Region " Component Designer generated code "
Public Sub New()
MyBase.New()
' This call is required by the Component Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call
End Sub
'UserService overrides dispose to clean up the component list.
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
' The main entry point for the process
<MTAThread()> _
Shared Sub Main()
' Dim ServicesToRun() As System.ServiceProcess.ServiceBase
' More than one NT Service may run within the same process. To add
' another service to this process, change the following line to
' create a second service object. For example,
'
' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
'
' ServicesToRun = New System.ServiceProcess.ServiceBase() {New BMSService}
' System.ServiceProcess.ServiceBase.Run(ServicesToRun)
'-----------------
'DEBUG check don't work in windows service manager...
#If DEBUG Then
Dim service As New BMSService
service.StartService()
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite)
#Else
Dim ServicesToRun() As System.ServiceProcess.ServiceBase
ServicesToRun = New System.ServiceProcess.ServiceBase() {New BMSService}
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
#End If
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
' NOTE: The following procedure is required by the Component Designer
' It can be modified using the Component Designer.
' Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
'
'BMSService
'
Me.ServiceName = "BMS Serivce"
End Sub
#End Region
#Region "Service Start / Stopp"
Protected Overrides Sub OnStart(ByVal args() As String)
StartService()
End Sub
Protected Overrides Sub OnStop()
End Sub
#End Region
#Region "Private Methods"
'Occures ever time the timer elapses
Sub TimeElapsedStarter(ByVal stateInfo As Object)
Try
'Load and execute starter Jobs
m_StartJobs.Clear()
DataAccess.Job.LoadJobs(m_Common, JobType.StartJob, m_StartJobs)
ExecuteStartJobs()
Catch ex As Exception
WriteEventLog("Fehler TimeElapsedStarter: " & ex.Message & Environment.NewLine & Environment.NewLine & ex.StackTrace, EventLogEntryType.Error)
End Try
End Sub
'Occures ever time the timer elapses
Sub TimeElapsedWatcher(ByVal stateInfo As Object)
Try
'Load and execute starter Jobs
m_WatchJobs.Clear()
DataAccess.Job.LoadJobs(m_Common, JobType.WatchJob, m_WatchJobs)
ExecuteWatchJobs()
Catch ex As Exception
WriteEventLog("Fehler TimeElapsedWatcher: " & ex.Message & Environment.NewLine & Environment.NewLine & ex.StackTrace, EventLogEntryType.Error)
End Try
End Sub
'Initializes all the service start stuff...
Private Sub StartService()
Try
m_EventLog = New EventLog
m_Common = New Common.Common
'Cannot use System.Timers.Timer due a Bug (http://support.microsoft.com/default.aspx?scid=kb;en-us;842793)
Dim autoEvent As New System.Threading.AutoResetEvent(False)
Dim timerStarterDelegate As System.Threading.TimerCallback = AddressOf TimeElapsedStarter
Dim timerWatcherDelegate As System.Threading.TimerCallback = AddressOf TimeElapsedWatcher
m_TimerStarter = New System.Threading.Timer(timerStarterDelegate, autoEvent, 1000, m_Common.StartJobInterval)
m_TimerWatcher = New System.Threading.Timer(timerWatcherDelegate, autoEvent, m_Common.WatchJobInterval, m_Common.WatchJobInterval)
m_StartJobs = New DataSet
m_WatchJobs = New DataSet
Catch ex As Exception
WriteEventLog("Fehler: " & ex.Message & Environment.NewLine & Environment.NewLine & ex.StackTrace, EventLogEntryType.Error)
End Try
End Sub
'Executes all watch jobs
Private Sub ExecuteWatchJobs()
Try
'Check if there are any jobs
If m_WatchJobs.Tables.Count > 0 And m_WatchJobs.Tables.Item(0).Rows.Count > 0 Then
Dim dt As DataTable
Dim dsFailedJobs As New DataSet
Dim startTime As New DateTime, endTime As New DateTime
Dim houres As Integer, minutes As Integer
dt = m_WatchJobs.Tables.Item(0)
Dim dr As DataRow
For Each dr In dt.Rows
'Check if job is in valid date range
If dr.Item("DatumStart") <= DateTime.Now And CType(dr.Item("DatumEnde"), Date).AddDays(1) >= DateTime.Now Then
ConvertToDateTime(dr.Item("ZeitVon"), dr.Item("ZeitBis"), startTime, endTime)
If startTime <= DateTime.Now And endTime >= DateTime.Now Then
'job seems to be in his valid datetime range...
Dim lastRunStart As DateTime
If dr("LastRunStart") Is DBNull.Value Then
'use dummy date if the job never run before
lastRunStart = New DateTime(1)
Else
lastRunStart = CDate(dr("LastRunStart"))
End If
'get all failed starter jobs
dsFailedJobs.Clear()
DataAccess.Job.GetFailedStartJobs(m_Common, dr("ProgrammId"), dsFailedJobs)
SendNotifications(dsFailedJobs, "Das Programm ##PROG_NAME## hat nicht innerhalb der Zeitspanne von " & m_Common.MaximalStartDuration.ToString() & " Minuten die Start() Methode der BMS-Dll aufgerufen. Möglicherweise konnte das Programm nicht gestartet werden.", JobType.StartJob)
'check for failed execution jobs
dsFailedJobs.Clear()
DataAccess.Job.GetFailedExecJobs(m_Common, dr("ProgrammId"), dsFailedJobs)
If dsFailedJobs.Tables.Count > 0 And dsFailedJobs.Tables(0).Rows.Count > 0 Then
SendNotifications(dsFailedJobs, "Das Programm ##PROG_NAME## konnte nicht innerhalb der vordefinierten Laufzeit von " & dsFailedJobs.Tables(0).Rows(0)("MaxLaufzeit").ToString() & " Minuten ausgeführt werden.", JobType.WatchJob)
End If
End If
End If
Next
End If
Catch ex As Exception
Throw ex
End Try
End Sub
'Executes all starter jobs
Private Sub ExecuteStartJobs()
Try
'Check if there are any jobs
If m_StartJobs.Tables.Count > 0 And m_StartJobs.Tables.Item(0).Rows.Count > 0 Then
Dim dt As DataTable
Dim startTime As New DateTime, endTime As New DateTime
dt = m_StartJobs.Tables.Item(0)
Dim dr As DataRow
For Each dr In dt.Rows
If dr("RunJob") Then
'RunJob has to run as fast as possible
If Not dr("IsRunning") Then
'job isn't already running
Dim job As New Job(m_Common, dr("JobId"), dr("Beschreibung"), dr("ProgrammId"), CType(dr("JobTypId"), JobType), CType(dr("JobStartTypId"), JobStartType))
If Not dr("ParentProgrammId") Is DBNull.Value Then
Dim parentProgrammId As Integer = dr("ParentProgrammId")
'job has a relation to another job, validate if parent job is currently executing...
If Not DataAccess.Job.CheckIsRunning(m_Common.DSN, parentProgrammId) Then
'parent job is not running, -> run job
'NachLetzterAusfuerung False, cause no one cares about next start time on RunJobs
job.Launch(True, False)
End If
Else
'run job
job.Launch(True, False)
End If
End If
Else
'Check if job is in valid date range
If dr.Item("DatumStart") <= DateTime.Now And CType(dr.Item("DatumEnde"), Date).AddDays(1) >= DateTime.Now Then
ConvertToDateTime(dr.Item("ZeitVon"), dr.Item("ZeitBis"), startTime, endTime)
If startTime <= DateTime.Now And endTime >= DateTime.Now Then
If dr("NextStartDate") < DateTime.Now Then
'interval has elapsed (should already be checked in GetJobs SP...)
If Not dr("IsRunning") Then
'job isn't already running
Dim job As New Job(m_Common, dr("JobId"), dr("Beschreibung"), dr("ProgrammId"), CType(dr("JobTypId"), JobType), CType(dr("JobStartTypId"), JobStartType))
If Not dr("ParentProgrammId") Is DBNull.Value Then
Dim parentProgrammId As Integer = dr("ParentProgrammId")
'job has a relation to another job, validate if parent job is currently executing...
If Not DataAccess.Job.CheckIsRunning(m_Common.DSN, parentProgrammId) Then
'parent job is not running, -> run job
job.Launch(False, dr("NachLetzterAusfuerung"))
End If
Else
'run job
job.Launch(False, dr("NachLetzterAusfuerung"))
End If
End If
End If
End If
End If
End If
Next
End If
Catch ex As Exception
Throw ex
End Try
End Sub
'Sends notifications to the pre-definied receivers (file or mail)
Private Sub SendNotifications(ByVal ds As DataSet, ByVal message As String, ByVal jobType As JobType)
Try
Dim drFailed As DataRow, drNotifications As DataRow
Dim dsNotifications As New DataSet
Dim hasNotiLimitReached As Boolean
hasNotiLimitReached = False
If ds.Tables.Count > 0 Then
If ds.Tables(0).Rows.Count > 0 Then
For Each drFailed In ds.Tables(0).Rows
'check if we already reached the limits for sending start/satch notifications
If jobType = jobType.WatchJob Then
If drFailed("NotiCounter") >= m_Common.MaxWatcherNotifications Then
hasNotiLimitReached = True
Else
hasNotiLimitReached = False
End If
Else
If drFailed("NotiCounter") >= m_Common.MaxStarterNotifications Then
hasNotiLimitReached = True
Else
hasNotiLimitReached = False
End If
End If
If Not hasNotiLimitReached Then
'get all notifications to a programm
dsNotifications.Clear()
DataAccess.Job.GetNotifications(m_Common, CInt(drFailed("ProgrammId")), dsNotifications)
If dsNotifications.Tables.Count > 0 Then
'seems to have rows in a table...
DataAccess.Job.SendNotification(m_Common, CInt(drFailed("ProgrammId")), dsNotifications, message, drFailed("JobId"), jobType)
End If
End If
If drFailed("NachLetzterAusfuerung") Then
DataAccess.Job.SetJobLastRun(m_Common.DSN, drFailed("JobId"), LastRun.End)
If Not drFailed("RunJob") Then
'calc next start exec time if its not a run job
DataAccess.Job.SetNextExecDateTime(m_Common.DSN, drFailed("JobId"))
End If
End If
Next
End If
End If
Catch ex As Exception
Throw ex
End Try
End Sub
#End Region
#Region "Helper Methods"
'Converts the times from database to a datetime datatyp for better handling
Private Sub ConvertToDateTime(ByVal startTime As String, ByVal endTime As String, ByRef startDateTime As DateTime, ByRef endDateTime As DateTime)
Try
Dim houres As Integer, minutes As Integer
'let's parse some time stuff to get start and end time in a better datatype...
houres = Left(startTime, 2)
minutes = Right(startTime, 2)
startDateTime = DateTime.Today.AddHours(houres)
startDateTime = startDateTime.AddMinutes(minutes)
houres = Left(endTime, 2)
minutes = Right(endTime, 2)
endDateTime = DateTime.Today.AddHours(houres)
endDateTime = endDateTime.AddMinutes(minutes)
'if endtime is less, endtime is on next day
'Ex: Start 23:15; End 02:45
If endDateTime < startDateTime Then
endTime = endDateTime.AddDays(1)
End If
Catch ex As Exception
Throw ex
End Try
End Sub
'Writes an message to windows event log
Private Sub WriteEventLog(ByVal errorMessage As String, ByVal eventLogType As EventLogEntryType)
Try
m_Common.Log(m_Common.SERVICE_DISPLAY_NAME, "Quelle: " & SERVICE_DISPLAY_NAME & Environment.NewLine & "Meldung: " & errorMessage, eventLogType)
Catch ex As Exception
System.Diagnostics.EventLog.WriteEntry(SERVICE_DISPLAY_NAME, errorMessage, eventLogType)
System.Diagnostics.EventLog.WriteEntry(SERVICE_DISPLAY_NAME, ex.Message + Environment.NewLine + ex.StackTrace, eventLogType.Error)
End Try
End Sub
#End Region
End Class

View File

@@ -0,0 +1,149 @@
<VisualStudioProject>
<VisualBasic
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{36BEB3BE-ABB4-4843-B6BB-588F5A9DF6C6}"
SccProjectName = "SAK"
SccLocalPath = "SAK"
SccAuxPath = "SAK"
SccProvider = "SAK"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "EDKB10"
AssemblyOriginatorKeyFile = ""
AssemblyOriginatorKeyMode = "None"
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "WinExe"
OptionCompare = "Binary"
OptionExplicit = "On"
OptionStrict = "Off"
RootNamespace = "BMSService"
StartupObject = "BMSService.BMSService"
>
<Config
Name = "Debug"
BaseAddress = "285212672"
ConfigurationOverrideFile = ""
DefineConstants = ""
DefineDebug = "true"
DefineTrace = "true"
DebugSymbols = "true"
IncrementalBuild = "true"
Optimize = "false"
OutputPath = "bin\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "1"
/>
<Config
Name = "Release"
BaseAddress = "285212672"
ConfigurationOverrideFile = ""
DefineConstants = ""
DefineDebug = "false"
DefineTrace = "true"
DebugSymbols = "false"
IncrementalBuild = "false"
Optimize = "true"
OutputPath = "bin\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "1"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
/>
<Reference
Name = "System.ServiceProcess"
AssemblyName = "System.ServiceProcess"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.Xml"
/>
<Reference
Name = "System.Configuration.Install"
AssemblyName = "System.Configuration.Install"
HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Configuration.Install.dll"
/>
<Reference
Name = "Common"
Project = "{A1E2756A-4E32-40BB-B449-9BDA1C15DE84}"
Package = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}"
/>
<Reference
Name = "DataAccess"
Project = "{21B54F51-D2B2-459E-895C-540AD4A8704F}"
Package = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}"
/>
</References>
<Imports>
<Import Namespace = "Microsoft.VisualBasic" />
<Import Namespace = "System" />
<Import Namespace = "System.Collections" />
<Import Namespace = "System.Data" />
<Import Namespace = "System.Diagnostics" />
</Imports>
</Build>
<Files>
<Include>
<File
RelPath = "AssemblyInfo.vb"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "bms_settings.xml"
BuildAction = "Content"
/>
<File
RelPath = "BMSService.vb"
SubType = "Component"
BuildAction = "Compile"
/>
<File
RelPath = "BMSService.resx"
DependentUpon = "BMSService.vb"
BuildAction = "EmbeddedResource"
/>
<File
RelPath = "Job.vb"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Job.resx"
DependentUpon = "Job.vb"
BuildAction = "EmbeddedResource"
/>
<File
RelPath = "ProjectInstaller.vb"
SubType = "Component"
BuildAction = "Compile"
/>
<File
RelPath = "ProjectInstaller.resx"
DependentUpon = "ProjectInstaller.vb"
BuildAction = "EmbeddedResource"
/>
</Include>
</Files>
</VisualBasic>
</VisualStudioProject>

View File

@@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = "relative:BMSService"
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View File

@@ -0,0 +1,32 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("BMS Service")>
<Assembly: AssemblyDescription("Handles start and watch jobs over the BMS programs")>
<Assembly: AssemblyCompany("Zubler & Partner")>
<Assembly: AssemblyProduct("BMS Service")>
<Assembly: AssemblyCopyright("")>
<Assembly: AssemblyTrademark("")>
<Assembly: CLSCompliant(True)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("45063487-0CB3-470D-B394-444EA2CEF66D")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
<Assembly: AssemblyVersion("1.0.*")>

View File

@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used forserialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Assembly</value>
</data>
<data name="$this.Name">
<value>BMSService</value>
</data>
</root>

View File

@@ -0,0 +1,365 @@
#Region "Includes"
Imports System.ServiceProcess
Imports System.Data.SqlClient
Imports System.Xml
Imports Common.Common
#End Region
Public Class BMSService
Inherits System.ServiceProcess.ServiceBase
#Region "Members"
Private m_TimerStarter As System.Threading.Timer
Private m_TimerWatcher As System.Threading.Timer
Private m_EventLog As EventLog
Private m_StartJobs As DataSet
Private m_WatchJobs As DataSet
Private m_Common As Common.Common
#End Region
#Region " Component Designer generated code "
Public Sub New()
MyBase.New()
' This call is required by the Component Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call
End Sub
'UserService overrides dispose to clean up the component list.
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
' The main entry point for the process
<MTAThread()> _
Shared Sub Main()
' Dim ServicesToRun() As System.ServiceProcess.ServiceBase
' More than one NT Service may run within the same process. To add
' another service to this process, change the following line to
' create a second service object. For example,
'
' ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
'
' ServicesToRun = New System.ServiceProcess.ServiceBase() {New BMSService}
' System.ServiceProcess.ServiceBase.Run(ServicesToRun)
'-----------------
'DEBUG check don't work in windows service manager...
#If DEBUG Then
Dim service As New BMSService
service.StartService()
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite)
#Else
Dim ServicesToRun() As System.ServiceProcess.ServiceBase
ServicesToRun = New System.ServiceProcess.ServiceBase() {New BMSService}
System.ServiceProcess.ServiceBase.Run(ServicesToRun)
#End If
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
' NOTE: The following procedure is required by the Component Designer
' It can be modified using the Component Designer.
' Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
'
'BMSService
'
Me.ServiceName = "BMS Serivce"
End Sub
#End Region
#Region "Service Start / Stopp"
Protected Overrides Sub OnStart(ByVal args() As String)
StartService()
End Sub
Protected Overrides Sub OnStop()
End Sub
#End Region
#Region "Private Methods"
'Occures ever time the timer elapses
Sub TimeElapsedStarter(ByVal stateInfo As Object)
Try
'Load and execute starter Jobs
m_StartJobs.Clear()
DataAccess.Job.LoadJobs(m_Common, JobType.StartJob, m_StartJobs)
ExecuteStartJobs()
Catch ex As Exception
WriteEventLog("Fehler TimeElapsedStarter: " & ex.Message & Environment.NewLine & Environment.NewLine & ex.StackTrace, EventLogEntryType.Error)
End Try
End Sub
'Occures ever time the timer elapses
Sub TimeElapsedWatcher(ByVal stateInfo As Object)
Try
'Load and execute starter Jobs
m_WatchJobs.Clear()
DataAccess.Job.LoadJobs(m_Common, JobType.WatchJob, m_WatchJobs)
ExecuteWatchJobs()
Catch ex As Exception
WriteEventLog("Fehler TimeElapsedWatcher: " & ex.Message & Environment.NewLine & Environment.NewLine & ex.StackTrace, EventLogEntryType.Error)
End Try
End Sub
'Initializes all the service start stuff...
Private Sub StartService()
Try
m_EventLog = New EventLog
m_Common = New Common.Common
'Cannot use System.Timers.Timer due a Bug (http://support.microsoft.com/default.aspx?scid=kb;en-us;842793)
Dim autoEvent As New System.Threading.AutoResetEvent(False)
Dim timerStarterDelegate As System.Threading.TimerCallback = AddressOf TimeElapsedStarter
Dim timerWatcherDelegate As System.Threading.TimerCallback = AddressOf TimeElapsedWatcher
m_TimerStarter = New System.Threading.Timer(timerStarterDelegate, autoEvent, 1000, m_Common.StartJobInterval)
m_TimerWatcher = New System.Threading.Timer(timerWatcherDelegate, autoEvent, m_Common.WatchJobInterval, m_Common.WatchJobInterval)
m_StartJobs = New DataSet
m_WatchJobs = New DataSet
Catch ex As Exception
WriteEventLog("Fehler: " & ex.Message & Environment.NewLine & Environment.NewLine & ex.StackTrace, EventLogEntryType.Error)
End Try
End Sub
'Executes all watch jobs
Private Sub ExecuteWatchJobs()
Try
'Check if there are any jobs
If m_WatchJobs.Tables.Count > 0 And m_WatchJobs.Tables.Item(0).Rows.Count > 0 Then
Dim dt As DataTable
Dim dsFailedJobs As New DataSet
Dim startTime As New DateTime, endTime As New DateTime
Dim houres As Integer, minutes As Integer
dt = m_WatchJobs.Tables.Item(0)
Dim dr As DataRow
For Each dr In dt.Rows
'Check if job is in valid date range
If dr.Item("DatumStart") <= DateTime.Now And CType(dr.Item("DatumEnde"), Date).AddDays(1) >= DateTime.Now Then
ConvertToDateTime(dr.Item("ZeitVon"), dr.Item("ZeitBis"), startTime, endTime)
If startTime <= DateTime.Now And endTime >= DateTime.Now Then
'job seems to be in his valid datetime range...
Dim lastRunStart As DateTime
If dr("LastRunStart") Is DBNull.Value Then
'use dummy date if the job never run before
lastRunStart = New DateTime(1)
Else
lastRunStart = CDate(dr("LastRunStart"))
End If
'get all failed starter jobs
dsFailedJobs.Clear()
DataAccess.Job.GetFailedStartJobs(m_Common, dr("ProgrammId"), dsFailedJobs)
SendNotifications(dsFailedJobs, "Das Programm ##PROG_NAME## hat nicht innerhalb der Zeitspanne von " & m_Common.MaximalStartDuration.ToString() & " Minuten die Start() Methode der BMS-Dll aufgerufen. Möglicherweise konnte das Programm nicht gestartet werden.", JobType.StartJob)
'check for failed execution jobs
dsFailedJobs.Clear()
DataAccess.Job.GetFailedExecJobs(m_Common, dr("ProgrammId"), dsFailedJobs)
If dsFailedJobs.Tables.Count > 0 And dsFailedJobs.Tables(0).Rows.Count > 0 Then
SendNotifications(dsFailedJobs, "Das Programm ##PROG_NAME## konnte nicht innerhalb der vordefinierten Laufzeit von " & dsFailedJobs.Tables(0).Rows(0)("MaxLaufzeit").ToString() & " Minuten ausgeführt werden.", JobType.WatchJob)
End If
End If
End If
Next
End If
Catch ex As Exception
Throw ex
End Try
End Sub
'Executes all starter jobs
Private Sub ExecuteStartJobs()
Try
'Check if there are any jobs
If m_StartJobs.Tables.Count > 0 And m_StartJobs.Tables.Item(0).Rows.Count > 0 Then
Dim dt As DataTable
Dim startTime As New DateTime, endTime As New DateTime
dt = m_StartJobs.Tables.Item(0)
Dim dr As DataRow
For Each dr In dt.Rows
If dr("RunJob") Then
'RunJob has to run as fast as possible
If Not dr("IsRunning") Then
'job isn't already running
Dim job As New Job(m_Common, dr("JobId"), dr("Beschreibung"), dr("ProgrammId"), CType(dr("JobTypId"), JobType), CType(dr("JobStartTypId"), JobStartType))
If Not dr("ParentProgrammId") Is DBNull.Value Then
Dim parentProgrammId As Integer = dr("ParentProgrammId")
'job has a relation to another job, validate if parent job is currently executing...
If Not DataAccess.Job.CheckIsRunning(m_Common.DSN, parentProgrammId) Then
'parent job is not running, -> run job
'NachLetzterAusfuerung False, cause no one cares about next start time on RunJobs
job.Launch(True, False)
End If
Else
'run job
job.Launch(True, False)
End If
End If
Else
'Check if job is in valid date range
If dr.Item("DatumStart") <= DateTime.Now And CType(dr.Item("DatumEnde"), Date).AddDays(1) >= DateTime.Now Then
ConvertToDateTime(dr.Item("ZeitVon"), dr.Item("ZeitBis"), startTime, endTime)
If startTime <= DateTime.Now And endTime >= DateTime.Now Then
If dr("NextStartDate") < DateTime.Now Then
'interval has elapsed (should already be checked in GetJobs SP...)
If Not dr("IsRunning") Then
'job isn't already running
Dim job As New Job(m_Common, dr("JobId"), dr("Beschreibung"), dr("ProgrammId"), CType(dr("JobTypId"), JobType), CType(dr("JobStartTypId"), JobStartType))
If Not dr("ParentProgrammId") Is DBNull.Value Then
Dim parentProgrammId As Integer = dr("ParentProgrammId")
'job has a relation to another job, validate if parent job is currently executing...
If Not DataAccess.Job.CheckIsRunning(m_Common.DSN, parentProgrammId) Then
'parent job is not running, -> run job
job.Launch(False, dr("NachLetzterAusfuerung"))
End If
Else
'run job
job.Launch(False, dr("NachLetzterAusfuerung"))
End If
End If
End If
End If
End If
End If
Next
End If
Catch ex As Exception
Throw ex
End Try
End Sub
'Sends notifications to the pre-definied receivers (file or mail)
Private Sub SendNotifications(ByVal ds As DataSet, ByVal message As String, ByVal jobType As JobType)
Try
Dim drFailed As DataRow, drNotifications As DataRow
Dim dsNotifications As New DataSet
Dim hasNotiLimitReached As Boolean
hasNotiLimitReached = False
If ds.Tables.Count > 0 Then
If ds.Tables(0).Rows.Count > 0 Then
For Each drFailed In ds.Tables(0).Rows
'check if we already reached the limits for sending start/satch notifications
If jobType = jobType.WatchJob Then
If drFailed("NotiCounter") >= m_Common.MaxWatcherNotifications Then
hasNotiLimitReached = True
Else
hasNotiLimitReached = False
End If
Else
If drFailed("NotiCounter") >= m_Common.MaxStarterNotifications Then
hasNotiLimitReached = True
Else
hasNotiLimitReached = False
End If
End If
If Not hasNotiLimitReached Then
'get all notifications to a programm
dsNotifications.Clear()
DataAccess.Job.GetNotifications(m_Common, CInt(drFailed("ProgrammId")), dsNotifications)
If dsNotifications.Tables.Count > 0 Then
'seems to have rows in a table...
DataAccess.Job.SendNotification(m_Common, CInt(drFailed("ProgrammId")), dsNotifications, message, drFailed("JobId"), jobType)
End If
End If
If drFailed("NachLetzterAusfuerung") Then
DataAccess.Job.SetJobLastRun(m_Common.DSN, drFailed("JobId"), LastRun.End)
If Not drFailed("RunJob") Then
'calc next start exec time if its not a run job
DataAccess.Job.SetNextExecDateTime(m_Common.DSN, drFailed("JobId"))
End If
End If
Next
End If
End If
Catch ex As Exception
Throw ex
End Try
End Sub
#End Region
#Region "Helper Methods"
'Converts the times from database to a datetime datatyp for better handling
Private Sub ConvertToDateTime(ByVal startTime As String, ByVal endTime As String, ByRef startDateTime As DateTime, ByRef endDateTime As DateTime)
Try
Dim houres As Integer, minutes As Integer
'let's parse some time stuff to get start and end time in a better datatype...
houres = Left(startTime, 2)
minutes = Right(startTime, 2)
startDateTime = DateTime.Today.AddHours(houres)
startDateTime = startDateTime.AddMinutes(minutes)
houres = Left(endTime, 2)
minutes = Right(endTime, 2)
endDateTime = DateTime.Today.AddHours(houres)
endDateTime = endDateTime.AddMinutes(minutes)
'if endtime is less, endtime is on next day
'Ex: Start 23:15; End 02:45
If endDateTime < startDateTime Then
endTime = endDateTime.AddDays(1)
End If
Catch ex As Exception
Throw ex
End Try
End Sub
'Writes an message to windows event log
Private Sub WriteEventLog(ByVal errorMessage As String, ByVal eventLogType As EventLogEntryType)
Try
m_Common.Log(m_Common.SERVICE_DISPLAY_NAME, "Quelle: " & SERVICE_DISPLAY_NAME & Environment.NewLine & "Meldung: " & errorMessage, eventLogType)
Catch ex As Exception
System.Diagnostics.EventLog.WriteEntry(SERVICE_DISPLAY_NAME, errorMessage, eventLogType)
System.Diagnostics.EventLog.WriteEntry(SERVICE_DISPLAY_NAME, ex.Message + Environment.NewLine + ex.StackTrace, eventLogType.Error)
End Try
End Sub
#End Region
End Class

View File

@@ -0,0 +1,149 @@
<VisualStudioProject>
<VisualBasic
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{36BEB3BE-ABB4-4843-B6BB-588F5A9DF6C6}"
SccProjectName = "SAK"
SccLocalPath = "SAK"
SccAuxPath = "SAK"
SccProvider = "SAK"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "EDKB10"
AssemblyOriginatorKeyFile = ""
AssemblyOriginatorKeyMode = "None"
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "WinExe"
OptionCompare = "Binary"
OptionExplicit = "On"
OptionStrict = "Off"
RootNamespace = "BMSService"
StartupObject = "BMSService.BMSService"
>
<Config
Name = "Debug"
BaseAddress = "285212672"
ConfigurationOverrideFile = ""
DefineConstants = ""
DefineDebug = "true"
DefineTrace = "true"
DebugSymbols = "true"
IncrementalBuild = "true"
Optimize = "false"
OutputPath = "bin\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "1"
/>
<Config
Name = "Release"
BaseAddress = "285212672"
ConfigurationOverrideFile = ""
DefineConstants = ""
DefineDebug = "false"
DefineTrace = "true"
DebugSymbols = "false"
IncrementalBuild = "false"
Optimize = "true"
OutputPath = "bin\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "1"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
/>
<Reference
Name = "System.ServiceProcess"
AssemblyName = "System.ServiceProcess"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.Xml"
/>
<Reference
Name = "System.Configuration.Install"
AssemblyName = "System.Configuration.Install"
HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Configuration.Install.dll"
/>
<Reference
Name = "Common"
Project = "{A1E2756A-4E32-40BB-B449-9BDA1C15DE84}"
Package = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}"
/>
<Reference
Name = "DataAccess"
Project = "{21B54F51-D2B2-459E-895C-540AD4A8704F}"
Package = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}"
/>
</References>
<Imports>
<Import Namespace = "Microsoft.VisualBasic" />
<Import Namespace = "System" />
<Import Namespace = "System.Collections" />
<Import Namespace = "System.Data" />
<Import Namespace = "System.Diagnostics" />
</Imports>
</Build>
<Files>
<Include>
<File
RelPath = "AssemblyInfo.vb"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "bms_settings.xml"
BuildAction = "Content"
/>
<File
RelPath = "BMSService.vb"
SubType = "Component"
BuildAction = "Compile"
/>
<File
RelPath = "BMSService.resx"
DependentUpon = "BMSService.vb"
BuildAction = "EmbeddedResource"
/>
<File
RelPath = "Job.vb"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Job.resx"
DependentUpon = "Job.vb"
BuildAction = "EmbeddedResource"
/>
<File
RelPath = "ProjectInstaller.vb"
SubType = "Component"
BuildAction = "Compile"
/>
<File
RelPath = "ProjectInstaller.resx"
DependentUpon = "ProjectInstaller.vb"
BuildAction = "EmbeddedResource"
/>
</Include>
</Files>
</VisualBasic>
</VisualStudioProject>

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8" ?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="ResMimeType">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="Version">
<value>1.0.0.0</value>
</resheader>
<resheader name="Reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="Writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,180 @@
#Region "Includes"
Imports System.Data.SqlClient
Imports Common.Common
#End Region
Public Class Job
#Region "Members"
Private m_JobId As Integer
Private m_Description As String
Private m_ProgrammId As Integer
Private m_JobType As JobType
Private m_JobStartType As JobStartType
Private m_Common As Common.Common
#End Region
#Region "Constructor"
Public Sub New(ByVal common As Common.Common, ByVal jobId As Integer, ByVal description As String, ByVal programmId As Integer, ByVal jobType As JobType, ByVal jobStartType As JobStartType)
m_Common = common
m_JobId = jobId
m_Description = description
m_ProgrammId = programmId
m_JobType = jobType
m_JobStartType = jobStartType
End Sub
#End Region
#Region "Properties"
Public ReadOnly Property JobId() As Integer
Get
Return m_JobId
End Get
End Property
Public ReadOnly Property Description() As String
Get
Return m_Description
End Get
End Property
Public ReadOnly Property ProgrammId() As Integer
Get
Return m_ProgrammId
End Get
End Property
Public ReadOnly Property JobType() As JobType
Get
Return m_JobType
End Get
End Property
Public ReadOnly Property JobStartType() As JobStartType
Get
Return m_JobStartType
End Get
End Property
#End Region
#Region "Public Methods"
'Launches a start or a watch job
Public Sub Launch(ByVal isRunJob As Boolean, ByVal isNachLetzterAusfuerung As Boolean)
Try
'insert start datetime into db, used to check, if the job really started
'batch has to call bmsDll.Start() method...
DataAccess.Job.SetJobLastRun(m_Common.DSN, m_JobId, LastRun.Start)
'log some infos into eventlog
m_Common.Log(SERVICE_DISPLAY_NAME, "Starter launched Job " + m_JobId.ToString() + " (" + m_Description + ")")
'reset calculated bit
DataAccess.Job.SetNextStartDateCalculated(m_Common.DSN, m_JobId, True)
If Not isRunJob And Not isNachLetzterAusfuerung Then
'just calculate next start time if its not a runjob (job that has to execute as fast as possible)
DataAccess.Job.SetNextExecDateTime(m_Common.DSN, m_JobId)
End If
Select Case m_JobType
Case JobType.StartJob
Select Case m_JobStartType
Case JobStartType.Executable
StartExe()
Case JobStartType.SqlQuery
StartSqlQuery()
Case JobStartType.WindowsService
StartService()
Case Else
Throw New Exception("Unbekannter Job Start Typ """ & m_JobStartType.ToString() & """ ist unbekannt")
End Select
Case Else
Throw New Exception("Unbekannter Job Typ """ & m_JobType.ToString() & """")
End Select
Catch ex As Exception
Dim exModified As New Exception("Der Job JobId: " + m_JobId.ToString() + " (" + m_Description + ") konnte nicht gestartet werden." + Environment.NewLine + ex.Message, ex)
Throw exModified
End Try
End Sub
#End Region
#Region "private Methods"
'Starts an executable. But before, it gets all start parameters from db it needs
Private Sub StartExe()
Try
Dim programmPath As String
Dim process As New Process
DataAccess.Job.GetStartParameter(m_Common.DSN, m_JobId, StartParameterType.FilePath, programmPath)
process.Start(programmPath)
Catch ex As Exception
Throw ex
End Try
End Sub
'Starts a service. But before, it gets all start parameters from db it needs
Private Sub StartService()
Try
Dim serviceName As String, machineName As String
DataAccess.Job.GetStartParameter(m_Common.DSN, m_JobId, StartParameterType.ServiceName, serviceName)
DataAccess.Job.GetStartParameter(m_Common.DSN, m_JobId, StartParameterType.ServerName, machineName)
Dim serviceController As New System.ServiceProcess.ServiceController(serviceName, machineName)
If Not serviceController.Status = ServiceProcess.ServiceControllerStatus.Running Then
serviceController.Start()
End If
Catch ex As Exception
Throw ex
End Try
End Sub
'Starts a sql query. But before, it gets all start parameters from db it needs
Private Sub StartSqlQuery()
Dim sqlConn As New SqlConnection
Try
Dim connectionString As String, sqlQuery As String
DataAccess.Job.GetStartParameter(m_Common.DSN, m_JobId, StartParameterType.ConnectionString, connectionString)
DataAccess.Job.GetStartParameter(m_Common.DSN, m_JobId, StartParameterType.SQLQuery, sqlQuery)
Dim sqlCom As New SqlCommand
sqlConn.ConnectionString = connectionString
sqlConn.Open()
sqlCom.CommandType = CommandType.Text
sqlCom.Connection = sqlConn
sqlCom.CommandText = sqlQuery
sqlCom.ExecuteNonQuery()
sqlConn.Close()
Catch ex As Exception
If sqlConn.State = ConnectionState.Open Then
sqlConn.Close()
End If
Throw ex
End Try
End Sub
#End Region
End Class

View File

@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used forserialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ServiceProcessInstaller.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Assembly</value>
</data>
<data name="ServiceProcessInstaller.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Assembly</value>
</data>
<data name="ServiceProcessInstaller.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</data>
<data name="ServiceInstaller.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Assembly</value>
</data>
<data name="ServiceInstaller.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Assembly</value>
</data>
<data name="ServiceInstaller.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>188, 17</value>
</data>
<data name="$this.Name">
<value>ProjectInstaller</value>
</data>
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Assembly</value>
</data>
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
</root>

View File

@@ -0,0 +1,60 @@
Imports System.ComponentModel
Imports System.Configuration.Install
<RunInstaller(True)> Public Class ProjectInstaller
Inherits System.Configuration.Install.Installer
#Region " Component Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Installer overrides dispose to clean up the component list.
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
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
Friend WithEvents ServiceProcessInstaller As System.ServiceProcess.ServiceProcessInstaller
Friend WithEvents ServiceInstaller As System.ServiceProcess.ServiceInstaller
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.ServiceProcessInstaller = New System.ServiceProcess.ServiceProcessInstaller
Me.ServiceInstaller = New System.ServiceProcess.ServiceInstaller
'
'ServiceProcessInstaller
'
Me.ServiceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem
Me.ServiceProcessInstaller.Password = Nothing
Me.ServiceProcessInstaller.Username = Nothing
'
'ServiceInstaller
'
Me.ServiceInstaller.DisplayName = "EDKB10"
Me.ServiceInstaller.ServiceName = "BMSService"
'
'ProjectInstaller
'
Me.Installers.AddRange(New System.Configuration.Install.Installer() {Me.ServiceProcessInstaller, Me.ServiceInstaller})
End Sub
#End Region
End Class

View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8" ?>
<root>
<config>
<!-- The maximum duration a start job can take before a starter error occures -->
<MaximumStartDuration>1</MaximumStartDuration>
<!-- Check interval in minutes for starter -->
<StartJobInterval>2</StartJobInterval>
<!-- Check interval in minutes for watcher -->
<WatchJobInterval>2</WatchJobInterval>
<!-- The number of Starter-Errors notifications should be activated until the job runs successful next time -->
<MaxStarterNotifications>2</MaxStarterNotifications>
<!-- The number of Watch-Errors notifications should be activated until the job runs successful next time -->
<MaxWatcherNotifications>3</MaxWatcherNotifications>
<!-- Name of the system event log where service should write his entries -->
<EventLogName>BMS</EventLogName>
<!-- The target where messages should be written to.
Valid log targets are:
- 1: System EventLog
- 2: Database EventLog table
-->
<LogTarget>1</LogTarget>
<!-- Mail Server to send eMails from BMS -->
<MailServer>tkbdev01</MailServer>
<!-- Mail sender name -->
<MailFrom>bms@tkb.ch</MailFrom>
<!-- Mail Server authentication method.
Valid methods are:
- 0: Anonymous
- 1: Basic Authentication (clear text authentication!)
-->
<MailServerAuth>
<Method>0</Method>
<UserName>mailUser</UserName>
<Password>mailPassword</Password>
</MailServerAuth>
</config>
</root>

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8" ?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="ResMimeType">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="Version">
<value>1.0.0.0</value>
</resheader>
<resheader name="Reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="Writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,180 @@
#Region "Includes"
Imports System.Data.SqlClient
Imports Common.Common
#End Region
Public Class Job
#Region "Members"
Private m_JobId As Integer
Private m_Description As String
Private m_ProgrammId As Integer
Private m_JobType As JobType
Private m_JobStartType As JobStartType
Private m_Common As Common.Common
#End Region
#Region "Constructor"
Public Sub New(ByVal common As Common.Common, ByVal jobId As Integer, ByVal description As String, ByVal programmId As Integer, ByVal jobType As JobType, ByVal jobStartType As JobStartType)
m_Common = common
m_JobId = jobId
m_Description = description
m_ProgrammId = programmId
m_JobType = jobType
m_JobStartType = jobStartType
End Sub
#End Region
#Region "Properties"
Public ReadOnly Property JobId() As Integer
Get
Return m_JobId
End Get
End Property
Public ReadOnly Property Description() As String
Get
Return m_Description
End Get
End Property
Public ReadOnly Property ProgrammId() As Integer
Get
Return m_ProgrammId
End Get
End Property
Public ReadOnly Property JobType() As JobType
Get
Return m_JobType
End Get
End Property
Public ReadOnly Property JobStartType() As JobStartType
Get
Return m_JobStartType
End Get
End Property
#End Region
#Region "Public Methods"
'Launches a start or a watch job
Public Sub Launch(ByVal isRunJob As Boolean, ByVal isNachLetzterAusfuerung As Boolean)
Try
'insert start datetime into db, used to check, if the job really started
'batch has to call bmsDll.Start() method...
DataAccess.Job.SetJobLastRun(m_Common.DSN, m_JobId, LastRun.Start)
'log some infos into eventlog
m_Common.Log(SERVICE_DISPLAY_NAME, "Starter launched Job " + m_JobId.ToString() + " (" + m_Description + ")")
'reset calculated bit
DataAccess.Job.SetNextStartDateCalculated(m_Common.DSN, m_JobId, True)
If Not isRunJob And Not isNachLetzterAusfuerung Then
'just calculate next start time if its not a runjob (job that has to execute as fast as possible)
DataAccess.Job.SetNextExecDateTime(m_Common.DSN, m_JobId)
End If
Select Case m_JobType
Case JobType.StartJob
Select Case m_JobStartType
Case JobStartType.Executable
StartExe()
Case JobStartType.SqlQuery
StartSqlQuery()
Case JobStartType.WindowsService
StartService()
Case Else
Throw New Exception("Unbekannter Job Start Typ """ & m_JobStartType.ToString() & """ ist unbekannt")
End Select
Case Else
Throw New Exception("Unbekannter Job Typ """ & m_JobType.ToString() & """")
End Select
Catch ex As Exception
Dim exModified As New Exception("Der Job JobId: " + m_JobId.ToString() + " (" + m_Description + ") konnte nicht gestartet werden." + Environment.NewLine + ex.Message, ex)
Throw exModified
End Try
End Sub
#End Region
#Region "private Methods"
'Starts an executable. But before, it gets all start parameters from db it needs
Private Sub StartExe()
Try
Dim programmPath As String
Dim process As New Process
DataAccess.Job.GetStartParameter(m_Common.DSN, m_JobId, StartParameterType.FilePath, programmPath)
process.Start(programmPath)
Catch ex As Exception
Throw ex
End Try
End Sub
'Starts a service. But before, it gets all start parameters from db it needs
Private Sub StartService()
Try
Dim serviceName As String, machineName As String
DataAccess.Job.GetStartParameter(m_Common.DSN, m_JobId, StartParameterType.ServiceName, serviceName)
DataAccess.Job.GetStartParameter(m_Common.DSN, m_JobId, StartParameterType.ServerName, machineName)
Dim serviceController As New System.ServiceProcess.ServiceController(serviceName, machineName)
If Not serviceController.Status = ServiceProcess.ServiceControllerStatus.Running Then
serviceController.Start()
End If
Catch ex As Exception
Throw ex
End Try
End Sub
'Starts a sql query. But before, it gets all start parameters from db it needs
Private Sub StartSqlQuery()
Dim sqlConn As New SqlConnection
Try
Dim connectionString As String, sqlQuery As String
DataAccess.Job.GetStartParameter(m_Common.DSN, m_JobId, StartParameterType.ConnectionString, connectionString)
DataAccess.Job.GetStartParameter(m_Common.DSN, m_JobId, StartParameterType.SQLQuery, sqlQuery)
Dim sqlCom As New SqlCommand
sqlConn.ConnectionString = connectionString
sqlConn.Open()
sqlCom.CommandType = CommandType.Text
sqlCom.Connection = sqlConn
sqlCom.CommandText = sqlQuery
sqlCom.ExecuteNonQuery()
sqlConn.Close()
Catch ex As Exception
If sqlConn.State = ConnectionState.Open Then
sqlConn.Close()
End If
Throw ex
End Try
End Sub
#End Region
End Class

View File

@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used forserialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ServiceProcessInstaller.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Assembly</value>
</data>
<data name="ServiceProcessInstaller.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Assembly</value>
</data>
<data name="ServiceProcessInstaller.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</data>
<data name="ServiceInstaller.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Assembly</value>
</data>
<data name="ServiceInstaller.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Assembly</value>
</data>
<data name="ServiceInstaller.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>188, 17</value>
</data>
<data name="$this.Name">
<value>ProjectInstaller</value>
</data>
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Assembly</value>
</data>
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</data>
</root>

View File

@@ -0,0 +1,60 @@
Imports System.ComponentModel
Imports System.Configuration.Install
<RunInstaller(True)> Public Class ProjectInstaller
Inherits System.Configuration.Install.Installer
#Region " Component Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Installer overrides dispose to clean up the component list.
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
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
Friend WithEvents ServiceProcessInstaller As System.ServiceProcess.ServiceProcessInstaller
Friend WithEvents ServiceInstaller As System.ServiceProcess.ServiceInstaller
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.ServiceProcessInstaller = New System.ServiceProcess.ServiceProcessInstaller
Me.ServiceInstaller = New System.ServiceProcess.ServiceInstaller
'
'ServiceProcessInstaller
'
Me.ServiceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem
Me.ServiceProcessInstaller.Password = Nothing
Me.ServiceProcessInstaller.Username = Nothing
'
'ServiceInstaller
'
Me.ServiceInstaller.DisplayName = "EDKB10"
Me.ServiceInstaller.ServiceName = "BMSService"
'
'ProjectInstaller
'
Me.Installers.AddRange(New System.Configuration.Install.Installer() {Me.ServiceProcessInstaller, Me.ServiceInstaller})
End Sub
#End Region
End Class

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type='text/xsl' href='_UpgradeReport_Files/UpgradeReport.xslt'?><UpgradeLog>
<Properties><Property Name="Solution" Value="BMSService">
</Property><Property Name="Projektmappendatei" Value="C:\Data\Edoka_FW3\BMS\BMSDll\BMSService\BMSService.sln">
</Property><Property Name="Date" Value="Mittwoch, 28. November 2007">
</Property><Property Name="Time" Value="07:57:24">
</Property></Properties><Event ErrorLevel="1" Project="C:\Data\Edoka_FW3\BMS\BMSDll\BMSService\BMSService.vbproj" Source="BMSService.vbproj" Description="MSB2013: Der projektübergreifende Verweis mit der GUID {A1E2756A-4E32-40BB-B449-9BDA1C15DE84} konnte nicht konvertiert werden, weil keine gültige SLN-Datei gefunden wurde, die alle Projekte enthält.">
</Event><Event ErrorLevel="1" Project="C:\Data\Edoka_FW3\BMS\BMSDll\BMSService\BMSService.vbproj" Source="BMSService.vbproj" Description="MSB2013: Der projektübergreifende Verweis mit der GUID {21B54F51-D2B2-459E-895C-540AD4A8704F} konnte nicht konvertiert werden, weil keine gültige SLN-Datei gefunden wurde, die alle Projekte enthält.">
</Event><Event ErrorLevel="0" Project="BMSService" Source="BMSService.vbproj" Description="Projektdatei erfolgreich gesichert als C:\Data\Edoka_FW3\BMS\BMSDll\BMSService\Backup\BMSService.vbproj">
</Event><Event ErrorLevel="0" Project="BMSService" Source="AssemblyInfo.vb" Description="Datei erfolgreich gesichert als C:\Data\Edoka_FW3\BMS\BMSDll\BMSService\Backup\AssemblyInfo.vb">
</Event><Event ErrorLevel="0" Project="BMSService" Source="BMSService.vb" Description="Datei erfolgreich gesichert als C:\Data\Edoka_FW3\BMS\BMSDll\BMSService\Backup\BMSService.vb">
</Event><Event ErrorLevel="0" Project="BMSService" Source="Job.vb" Description="Datei erfolgreich gesichert als C:\Data\Edoka_FW3\BMS\BMSDll\BMSService\Backup\Job.vb">
</Event><Event ErrorLevel="0" Project="BMSService" Source="ProjectInstaller.vb" Description="Datei erfolgreich gesichert als C:\Data\Edoka_FW3\BMS\BMSDll\BMSService\Backup\ProjectInstaller.vb">
</Event><Event ErrorLevel="0" Project="BMSService" Source="bms_settings.xml" Description="Datei erfolgreich gesichert als C:\Data\Edoka_FW3\BMS\BMSDll\BMSService\Backup\bms_settings.xml">
</Event><Event ErrorLevel="0" Project="BMSService" Source="BMSService.resx" Description="Datei erfolgreich gesichert als C:\Data\Edoka_FW3\BMS\BMSDll\BMSService\Backup\BMSService.resx">
</Event><Event ErrorLevel="0" Project="BMSService" Source="Job.resx" Description="Datei erfolgreich gesichert als C:\Data\Edoka_FW3\BMS\BMSDll\BMSService\Backup\Job.resx">
</Event><Event ErrorLevel="0" Project="BMSService" Source="ProjectInstaller.resx" Description="Datei erfolgreich gesichert als C:\Data\Edoka_FW3\BMS\BMSDll\BMSService\Backup\ProjectInstaller.resx">
</Event><Event ErrorLevel="0" Project="BMSService" Source="BMSService.vbproj" Description="Projekt erfolgreich konvertiert">
</Event><Event ErrorLevel="3" Project="BMSService" Source="BMSService.vbproj" Description="Converted">
</Event><Event ErrorLevel="0" Project="BMSService" Source="BMSService.vbproj" Description="Überprüfung abgeschlossen: Aktualisierung von Projektdateien nicht erforderlich.">
</Event></UpgradeLog>

View File

@@ -0,0 +1,207 @@
BODY
{
BACKGROUND-COLOR: white;
FONT-FAMILY: "Verdana", sans-serif;
FONT-SIZE: 100%;
MARGIN-LEFT: 0px;
MARGIN-TOP: 0px
}
P
{
FONT-FAMILY: "Verdana", sans-serif;
FONT-SIZE: 70%;
LINE-HEIGHT: 12pt;
MARGIN-BOTTOM: 0px;
MARGIN-LEFT: 10px;
MARGIN-TOP: 10px
}
.note
{
BACKGROUND-COLOR: #ffffff;
COLOR: #336699;
FONT-FAMILY: "Verdana", sans-serif;
FONT-SIZE: 100%;
MARGIN-BOTTOM: 0px;
MARGIN-LEFT: 0px;
MARGIN-TOP: 0px;
PADDING-RIGHT: 10px
}
.infotable
{
BACKGROUND-COLOR: #f0f0e0;
BORDER-BOTTOM: #ffffff 0px solid;
BORDER-COLLAPSE: collapse;
BORDER-LEFT: #ffffff 0px solid;
BORDER-RIGHT: #ffffff 0px solid;
BORDER-TOP: #ffffff 0px solid;
FONT-SIZE: 70%;
MARGIN-LEFT: 10px
}
.issuetable
{
BACKGROUND-COLOR: #ffffe8;
BORDER-COLLAPSE: collapse;
COLOR: #000000;
FONT-SIZE: 100%;
MARGIN-BOTTOM: 10px;
MARGIN-LEFT: 13px;
MARGIN-TOP: 0px
}
.issuetitle
{
BACKGROUND-COLOR: #ffffff;
BORDER-BOTTOM: #dcdcdc 1px solid;
BORDER-TOP: #dcdcdc 1px;
COLOR: #003366;
FONT-WEIGHT: normal
}
.header
{
BACKGROUND-COLOR: #cecf9c;
BORDER-BOTTOM: #ffffff 1px solid;
BORDER-LEFT: #ffffff 1px solid;
BORDER-RIGHT: #ffffff 1px solid;
BORDER-TOP: #ffffff 1px solid;
COLOR: #000000;
FONT-WEIGHT: bold
}
.issuehdr
{
BACKGROUND-COLOR: #E0EBF5;
BORDER-BOTTOM: #dcdcdc 1px solid;
BORDER-TOP: #dcdcdc 1px solid;
COLOR: #000000;
FONT-WEIGHT: normal
}
.issuenone
{
BACKGROUND-COLOR: #ffffff;
BORDER-BOTTOM: 0px;
BORDER-LEFT: 0px;
BORDER-RIGHT: 0px;
BORDER-TOP: 0px;
COLOR: #000000;
FONT-WEIGHT: normal
}
.content
{
BACKGROUND-COLOR: #e7e7ce;
BORDER-BOTTOM: #ffffff 1px solid;
BORDER-LEFT: #ffffff 1px solid;
BORDER-RIGHT: #ffffff 1px solid;
BORDER-TOP: #ffffff 1px solid;
PADDING-LEFT: 3px
}
.issuecontent
{
BACKGROUND-COLOR: #ffffff;
BORDER-BOTTOM: #dcdcdc 1px solid;
BORDER-TOP: #dcdcdc 1px solid;
PADDING-LEFT: 3px
}
A:link
{
COLOR: #cc6633;
TEXT-DECORATION: underline
}
A:visited
{
COLOR: #cc6633;
}
A:active
{
COLOR: #cc6633;
}
A:hover
{
COLOR: #cc3300;
TEXT-DECORATION: underline
}
H1
{
BACKGROUND-COLOR: #003366;
BORDER-BOTTOM: #336699 6px solid;
COLOR: #ffffff;
FONT-SIZE: 130%;
FONT-WEIGHT: normal;
MARGIN: 0em 0em 0em -20px;
PADDING-BOTTOM: 8px;
PADDING-LEFT: 30px;
PADDING-TOP: 16px
}
H2
{
COLOR: #000000;
FONT-SIZE: 80%;
FONT-WEIGHT: bold;
MARGIN-BOTTOM: 3px;
MARGIN-LEFT: 10px;
MARGIN-TOP: 20px;
PADDING-LEFT: 0px
}
H3
{
COLOR: #000000;
FONT-SIZE: 80%;
FONT-WEIGHT: bold;
MARGIN-BOTTOM: -5px;
MARGIN-LEFT: 10px;
MARGIN-TOP: 20px
}
H4
{
COLOR: #000000;
FONT-SIZE: 70%;
FONT-WEIGHT: bold;
MARGIN-BOTTOM: 0px;
MARGIN-TOP: 15px;
PADDING-BOTTOM: 0px
}
UL
{
COLOR: #000000;
FONT-SIZE: 70%;
LIST-STYLE: square;
MARGIN-BOTTOM: 0pt;
MARGIN-TOP: 0pt
}
OL
{
COLOR: #000000;
FONT-SIZE: 70%;
LIST-STYLE: square;
MARGIN-BOTTOM: 0pt;
MARGIN-TOP: 0pt
}
LI
{
LIST-STYLE: square;
MARGIN-LEFT: 0px
}
.expandable
{
CURSOR: hand
}
.expanded
{
color: black
}
.collapsed
{
DISPLAY: none
}
.foot
{
BACKGROUND-COLOR: #ffffff;
BORDER-BOTTOM: #cecf9c 1px solid;
BORDER-TOP: #cecf9c 2px solid
}
.settings
{
MARGIN-LEFT: 25PX;
}
.help
{
TEXT-ALIGN: right;
margin-right: 10px;
}

View File

@@ -0,0 +1,232 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:key name="ProjectKey" match="Event" use="@Project"/>
<xsl:template match="Events" mode="createProjects">
<projects>
<xsl:for-each select="Event">
<!--xsl:sort select="@Project" order="descending"/-->
<xsl:if test="(1=position()) or (preceding-sibling::*[1]/@Project != @Project)">
<xsl:variable name="ProjectName" select="@Project"/>
<project>
<xsl:attribute name="name">
<xsl:value-of select="@Project"/>
</xsl:attribute>
<xsl:if test="@Project=''">
<xsl:attribute name="solution">
<xsl:value-of select="@Solution"/>
</xsl:attribute>
</xsl:if>
<xsl:for-each select="key('ProjectKey', $ProjectName)">
<!--xsl:sort select="@Source" /-->
<xsl:if test="(1=position()) or (preceding-sibling::*[1]/@Source != @Source)">
<source>
<xsl:attribute name="name">
<xsl:value-of select="@Source"/>
</xsl:attribute>
<xsl:variable name="Source">
<xsl:value-of select="@Source"/>
</xsl:variable>
<xsl:for-each select="key('ProjectKey', $ProjectName)[ @Source = $Source ]">
<event>
<xsl:attribute name="error-level">
<xsl:value-of select="@ErrorLevel"/>
</xsl:attribute>
<xsl:attribute name="description">
<xsl:value-of select="@Description"/>
</xsl:attribute>
</event>
</xsl:for-each>
</source>
</xsl:if>
</xsl:for-each>
</project>
</xsl:if>
</xsl:for-each>
</projects>
</xsl:template>
<xsl:template match="projects">
<xsl:for-each select="project">
<xsl:sort select="@Name" order="ascending"/>
<h2>
<xsl:if test="@solution">Projektmappe: <xsl:value-of select="@solution"/></xsl:if>
<xsl:if test="not(@solution)">Projekt: <xsl:value-of select="@name"/>
<xsl:for-each select="source">
<xsl:variable name="Hyperlink" select="@name"/>
<xsl:for-each select="event[@error-level='4']">
<A class="note"><xsl:attribute name="HREF"><xsl:value-of select="$Hyperlink"/></xsl:attribute><xsl:value-of select="@description"/></A>
</xsl:for-each>
</xsl:for-each>
</xsl:if>
</h2>
<table cellpadding="2" cellspacing="0" width="98%" border="1" bordercolor="white" class="infotable">
<tr>
<td nowrap="1" class="header" _locID="Filename">Dateiname</td>
<td nowrap="1" class="header" _locID="Status">Status</td>
<td nowrap="1" class="header" _locID="Errors">Fehler</td>
<td nowrap="1" class="header" _locID="Warnings">Warnungen</td>
</tr>
<xsl:for-each select="source">
<xsl:sort select="@name" order="ascending"/>
<xsl:variable name="source-id" select="generate-id(.)"/>
<xsl:if test="count(event)!=count(event[@error-level='4'])">
<tr class="row">
<td class="content">
<A HREF="javascript:"><xsl:attribute name="onClick">javascript:document.images['<xsl:value-of select="$source-id"/>'].click()</xsl:attribute><IMG border="0" alt="expand/collapse section" class="expandable" height="11" onclick="changepic()" src="_UpgradeReport_Files/UpgradeReport_Plus.gif" width="9"><xsl:attribute name="name"><xsl:value-of select="$source-id"/></xsl:attribute><xsl:attribute name="child">src<xsl:value-of select="$source-id"/></xsl:attribute></IMG></A> <xsl:value-of select="@name"/>
</td>
<td class="content">
<xsl:if test="count(event[@error-level='3'])=1">
<xsl:for-each select="event[@error-level='3']">
<xsl:if test="@description='Converted'">Konvertiert</xsl:if>
<xsl:if test="@description!='Converted'"><xsl:value-of select="@description"/></xsl:if>
</xsl:for-each>
</xsl:if>
<xsl:if test="count(event[@error-level='3'])!=1 and count(event[@error-level='3' and @description='Converted'])!=0">Konvertiert
</xsl:if>
</td>
<td class="content"><xsl:value-of select="count(event[@error-level='2'])"/></td>
<td class="content"><xsl:value-of select="count(event[@error-level='1'])"/></td>
</tr>
<tr class="collapsed" bgcolor="#ffffff">
<xsl:attribute name="id">src<xsl:value-of select="$source-id"/></xsl:attribute>
<td colspan="7">
<table width="97%" border="1" bordercolor="#dcdcdc" rules="cols" class="issuetable">
<tr>
<td colspan="7" class="issuetitle" _locID="ConversionIssues">Konvertierungsprobleme - <xsl:value-of select="@name"/>:</td>
</tr>
<xsl:for-each select="event[@error-level!='3']">
<xsl:if test="@error-level!='4'">
<tr>
<td class="issuenone" style="border-bottom:solid 1 lightgray">
<xsl:value-of select="@description"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</td>
</tr>
</xsl:if>
</xsl:for-each>
<tr valign="top">
<td class="foot">
<xsl:if test="count(source)!=1">
<xsl:value-of select="count(source)"/> Dateien
</xsl:if>
<xsl:if test="count(source)=1">
1 Datei
</xsl:if>
</td>
<td class="foot">
Konvertiert: <xsl:value-of select="count(source/event[@error-level='3' and @description='Converted'])"/><BR/>
Nicht konvertiert <xsl:value-of select="count(source) - count(source/event[@error-level='3' and @description='Converted'])"/>
</td>
<td class="foot"><xsl:value-of select="count(source/event[@error-level='2'])"/></td>
<td class="foot"><xsl:value-of select="count(source/event[@error-level='1'])"/></td>
</tr>
</table>
</xsl:for-each>
</xsl:template>
<xsl:template match="Property">
<xsl:if test="@Name!='Date' and @Name!='Time' and @Name!='LogNumber' and @Name!='Solution'">
<tr><td nowrap="1"><b><xsl:value-of select="@Name"/>: </b><xsl:value-of select="@Value"/></td></tr>
</xsl:if>
</xsl:template>
<xsl:template match="UpgradeLog">
<html>
<head>
<META HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" href="_UpgradeReport_Files\UpgradeReport.css"/>
<title>Konvertierungsbericht
<xsl:if test="Properties/Property[@Name='LogNumber']">
<xsl:value-of select="Properties/Property[@Name='LogNumber']/@Value"/>
</xsl:if>
</title>
<script language="javascript">
function outliner () {
oMe = window.event.srcElement
//get child element
var child = document.all[event.srcElement.getAttribute("child",false)];
//if child element exists, expand or collapse it.
if (null != child)
child.className = child.className == "collapsed" ? "expanded" : "collapsed";
}
function changepic() {
uMe = window.event.srcElement;
var check = uMe.src.toLowerCase();
if (check.lastIndexOf("upgradereport_plus.gif") != -1)
{
uMe.src = "_UpgradeReport_Files/UpgradeReport_Minus.gif"
}
else
{
uMe.src = "_UpgradeReport_Files/UpgradeReport_Plus.gif"
}
}
</script>
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" onclick="outliner();">
<h1 _locID="ConversionReport">Konvertierungsbericht - <xsl:value-of select="Properties/Property[@Name='Solution']/@Value"/></h1>
<p><span class="note">
<b>Konvertierungsdauer:</b> <xsl:value-of select="Properties/Property[@Name='Date']/@Value"/> <xsl:value-of select="Properties/Property[@Name='Time']/@Value"/><br/>
</span></p>
<xsl:variable name="SortedEvents">
<Events>
<xsl:for-each select="Event">
<xsl:sort select="@Project" order="ascending"/>
<xsl:sort select="@Source" order="ascending"/>
<xsl:sort select="@ErrorLevel" order="ascending"/>
<Event>
<xsl:attribute name="Project"><xsl:value-of select="@Project"/> </xsl:attribute>
<xsl:attribute name="Solution"><xsl:value-of select="/UpgradeLog/Properties/Property[@Name='Solution']/@Value"/> </xsl:attribute>
<xsl:attribute name="Source"><xsl:value-of select="@Source"/> </xsl:attribute>
<xsl:attribute name="ErrorLevel"><xsl:value-of select="@ErrorLevel"/> </xsl:attribute>
<xsl:attribute name="Description"><xsl:value-of select="@Description"/> </xsl:attribute>
</Event>
</xsl:for-each>
</Events>
</xsl:variable>
<xsl:variable name="Projects">
<xsl:apply-templates select="msxsl:node-set($SortedEvents)/*" mode="createProjects"/>
</xsl:variable>
<xsl:apply-templates select="msxsl:node-set($Projects)/*"/>
<p></p><p>
<table class="note">
<tr>
<td nowrap="1">
<b>Konvertierungseinstellungen</b>
</td>
</tr>
<xsl:apply-templates select="Properties"/>
</table></p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 B

Binary file not shown.

View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8" ?>
<root>
<config>
<!-- The maximum duration a start job can take before a starter error occures -->
<MaximumStartDuration>1</MaximumStartDuration>
<!-- Check interval in minutes for starter -->
<StartJobInterval>2</StartJobInterval>
<!-- Check interval in minutes for watcher -->
<WatchJobInterval>2</WatchJobInterval>
<!-- The number of Starter-Errors notifications should be activated until the job runs successful next time -->
<MaxStarterNotifications>2</MaxStarterNotifications>
<!-- The number of Watch-Errors notifications should be activated until the job runs successful next time -->
<MaxWatcherNotifications>3</MaxWatcherNotifications>
<!-- Name of the system event log where service should write his entries -->
<EventLogName>BMS</EventLogName>
<!-- The target where messages should be written to.
Valid log targets are:
- 1: System EventLog
- 2: Database EventLog table
-->
<LogTarget>1</LogTarget>
<!-- Mail Server to send eMails from BMS -->
<MailServer>tkbdev01</MailServer>
<!-- Mail sender name -->
<MailFrom>bms@tkb.ch</MailFrom>
<!-- Mail Server authentication method.
Valid methods are:
- 0: Anonymous
- 1: Basic Authentication (clear text authentication!)
-->
<MailServerAuth>
<Method>0</Method>
<UserName>mailUser</UserName>
<Password>mailPassword</Password>
</MailServerAuth>
</config>
</root>

View File

@@ -0,0 +1,5 @@
SCC = This is a Source Code Control file
[BMSService.vbproj]
SCC_Aux_Path = "\\SERVER01\DATEN\SourceSave\EDOKA4.0"
SCC_Project_Name = "$/BMS/BMSDll/BMSService", NSCAAAAA

Binary file not shown.

183
BMS/BMSDll/Logging.vb Normal file
View File

@@ -0,0 +1,183 @@
#Region "Includes"
Imports System.Data.SqlClient
Imports Common.Common
Imports System.Runtime.InteropServices
#End Region
'Class used 4 common Logging
<ClassInterface(ClassInterfaceType.AutoDual)> _
Public Class Logging
#Region "Members"
Dim m_JournalId As Integer
Dim m_JobId As Integer
Dim m_ProgrammId As Integer
Dim m_DbConnection As SqlConnection
Dim m_Common As Common.Common
Dim m_JobTyp As JobType
Dim m_IsNachLetzterAusfuerung As Boolean
Dim m_RunJob As Boolean
#End Region
#Region "Constructor"
'Gets a new JournalId for a new logging instance
'TODO: jobtype muss nicht bekannt sein, wenn ein tool als start UND watch läuft...
'Wird aber benötigt, um LastRunEnde auf Job zu setzen. Dies wiederum wird in GetFailedStartJobs
'verwendet um zu überprüfen, ob der JOB(und ebe nicht das programm) gestartet wurde
Public Sub New(ByVal programId As Integer, ByVal jobType As JobType)
Try
Dim sqlCom As New SqlCommand
Dim da As New SqlDataAdapter
Dim ds As New DataSet
m_ProgrammId = programId
m_Common = New Common.Common
m_DbConnection = New SqlConnection(m_Common.DSN)
m_DbConnection.Open()
sqlCom.CommandType = CommandType.StoredProcedure
sqlCom.Connection = m_DbConnection
sqlCom.CommandText = "CreateJournal"
sqlCom.Parameters.Add(New SqlParameter("@ProgrammId", m_ProgrammId))
sqlCom.Parameters.Add(New SqlParameter("@JobTypId", jobType))
da.SelectCommand = sqlCom
da.Fill(ds)
'One table and one row are required
If ds.Tables.Count > 0 Then
If ds.Tables(0).Rows.Count > 0 Then
m_JournalId = ds.Tables(0).Rows(0).Item("JournalId")
m_JobId = ds.Tables(0).Rows(0).Item("JobId")
m_IsNachLetzterAusfuerung = ds.Tables(0).Rows(0).Item("NachLetzterAusfuerung")
m_RunJob = ds.Tables(0).Rows(0)("RunJob")
Else
Throw New Exception("Neues Journal konnte nicht erzeugt werden oder zugehöriger Job wurde nicht gefunden")
End If
Else
Throw New Exception("Neues Journal konnte nicht erzeugt werden oder zugehöriger Job wurde nicht gefunden")
End If
If jobType = jobType.WatchJob Then
'needed for validating correct start and maximal durations
DataAccess.Job.SetJobLastRun(m_Common.DSN, m_JobId, LastRun.Start)
m_Common.Log(Common.Common.DLL_DISPLAY_NAME, "DLL Library setted LastRunStart to " + DateTime.Now.ToString("G") + " for JobId " + m_JobId.ToString)
End If
m_DbConnection.Close()
Catch ex As Exception
If m_DbConnection.State = ConnectionState.Open Then
m_DbConnection.Close()
End If
WriteEventLog(ex.Source, ex.Message, EventLogEntryType.Error)
End Try
End Sub
#End Region
#Region "Public Methods"
'Note: This Sub is necessary, because VB cannot handle constructors with parameters
'so we have to do all the "constuctor" stuff in a method...
'Public Sub InitLogging(ByVal programId As Integer, ByVal jobTyp As Integer)
'End Sub
'Writes a message with a journalEntryType to the journal
Public Sub Log(ByVal message As String, ByVal journalEintragTyp As JournalEntryType)
Try
WriteJournalEntry(message, CType(journalEintragTyp, JournalEntryType))
'in an error case, service should do something
If journalEintragTyp = JournalEntryType.Error Then
Dim ds As New DataSet
DataAccess.Job.GetNotifications(m_Common, m_ProgrammId, ds)
DataAccess.Job.SendNotification(m_Common, m_ProgrammId, ds, message, m_JobId, JobType.WatchJob)
End If
Catch ex As Exception
WriteEventLog(ex.Source, ex.Message, EventLogEntryType.Error)
End Try
End Sub
'Writes a message to the journal
Public Sub Log(ByVal message As String)
Try
Log(message, JournalEntryType.Information)
Catch ex As Exception
WriteEventLog(ex.Source, ex.Message, EventLogEntryType.Error)
End Try
End Sub
'Writes to journal, that the program has started
Public Sub Start()
Try
DataAccess.Job.SetIsRunning(m_Common.DSN, m_ProgrammId, True)
WriteJournalEntry("Start", JournalEntryType.Information)
Catch ex As Exception
DataAccess.Job.SetIsRunning(m_Common.DSN, m_ProgrammId, False)
WriteEventLog(ex.Source, ex.Message, EventLogEntryType.Error)
End Try
End Sub
'Writes to journal, that the program has ended
Public Sub Ende()
Try
DataAccess.Job.SetIsRunning(m_Common.DSN, m_ProgrammId, False)
DataAccess.Job.SetJobLastRun(m_Common.DSN, m_JobId, LastRun.End)
'calc next start time JUST if its a "NachLetzterAusfuerung" Job
If m_IsNachLetzterAusfuerung Then
DataAccess.Job.SetNextExecDateTime(m_Common.DSN, m_JobId)
End If
WriteJournalEntry("Ende", JournalEntryType.Information)
Catch ex As Exception
WriteEventLog(ex.Source, ex.Message, EventLogEntryType.Error)
End Try
End Sub
#End Region
#Region "Private Methods"
'Writes an nice formatted error message to windows eventlog
Private Sub WriteEventLog(ByVal source As String, ByVal errorMessage As String, ByVal eventLogType As EventLogEntryType)
m_Common.Log(source, "Quelle: " & source & Environment.NewLine & "Meldung: " & errorMessage, eventLogType)
End Sub
'Writes an entry to the BMS journal
Private Sub WriteJournalEntry(ByVal message As String, ByVal journalEntryType As JournalEntryType)
Try
Dim sqlCom As New SqlCommand
m_DbConnection.Open()
sqlCom.CommandType = CommandType.StoredProcedure
sqlCom.Connection = m_DbConnection
sqlCom.CommandText = "CreateJournalEntry"
sqlCom.Parameters.Add(New SqlParameter("@JournalId", m_JournalId))
sqlCom.Parameters.Add(New SqlParameter("@EintragDesc", message))
sqlCom.Parameters.Add(New SqlParameter("@JournalEintragTypId", CInt(journalEntryType)))
sqlCom.ExecuteNonQuery()
m_DbConnection.Close()
Catch
If m_DbConnection.State = ConnectionState.Open Then
m_DbConnection.Close()
End If
Throw
End Try
End Sub
#End Region
End Class

BIN
BMS/BMSDll/bin/BMS.dll Normal file

Binary file not shown.

11
BMS/BMSDll/bin/BMS.xml Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>
BMS
</name>
</assembly>
<members>
</members>
</doc>

BIN
BMS/BMSDll/bin/Common.dll Normal file

Binary file not shown.

22
BMS/BMSDll/bin/Common.xml Normal file
View File

@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>
Common
</name>
</assembly>
<members>
<member name="M:Common.Settings.GetSettingValue(System.String)">
<summary>Gets the first matching value of a property</summary>
<param name="propertyName"></param>
<returns></returns>
</member><member name="M:Common.Settings.SetSettingsValue(System.String,System.String)">
<summary>Sets the first matching value of a property</summary>
<param name="xpath"></param>
<param name="value"></param>
</member><member name="M:Common.Settings.GetDecryptedDSN">
<summary>Return the descripted dsn string</summary>
<returns></returns>
</member>
</members>
</doc>

Binary file not shown.

View File

@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>
DataAccess
</name>
</assembly>
<members>
</members>
</doc>

Binary file not shown.

View File

@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>
ZpCryptography
</name>
</assembly>
<members>
</members>
</doc>

View File

@@ -0,0 +1 @@
¹µÈ¦rȽ¹¿¸ª‰ Œ•™£Ÿ†—~u{©Œ—¢v˜œ°“Ÿ…€p~‰x‡®À±É½µ±r¸¯¸®Á´³‰‡ŸÄ¹·Å¾Á¸mȪ¯Á·»¼Ît½³¸ÄŠ®Á¸±‡¼ÁºÀÇȦƾ½²m¾©‰‡µ³«À¹ÈeÅ¾È©Š‰u…€Ç»ºÆt®¶Â«²¹´·­€Â©ÈÇ˴ĹhÁ¼ª°»°³{ˆ·

View File

@@ -0,0 +1,32 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("BMS Logging DLL")>
<Assembly: AssemblyDescription("Writes journal entries to BMS database journal")>
<Assembly: AssemblyCompany("Zubler & Partner")>
<Assembly: AssemblyProduct("BMS Logging DLL")>
<Assembly: AssemblyCopyright("")>
<Assembly: AssemblyTrademark("")>
<Assembly: CLSCompliant(True)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("2BBEB51D-23B1-4418-A844-9471B78A910B")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
<Assembly: AssemblyVersion("1.0.*")>

View File

@@ -0,0 +1,111 @@
<VisualStudioProject>
<VisualBasic
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{A3645B42-5328-4197-92A6-3124FE38AD0C}"
SccProjectName = "SAK"
SccLocalPath = "SAK"
SccAuxPath = "SAK"
SccProvider = "SAK"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "BMS"
AssemblyOriginatorKeyFile = ""
AssemblyOriginatorKeyMode = "None"
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Library"
OptionCompare = "Binary"
OptionExplicit = "On"
OptionStrict = "Off"
RootNamespace = "bms"
StartupObject = ""
>
<Config
Name = "Debug"
BaseAddress = "285212672"
ConfigurationOverrideFile = ""
DefineConstants = ""
DefineDebug = "true"
DefineTrace = "true"
DebugSymbols = "true"
IncrementalBuild = "true"
Optimize = "false"
OutputPath = "bin\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "1"
/>
<Config
Name = "Release"
BaseAddress = "285212672"
ConfigurationOverrideFile = ""
DefineConstants = ""
DefineDebug = "false"
DefineTrace = "true"
DebugSymbols = "false"
IncrementalBuild = "false"
Optimize = "true"
OutputPath = "bin\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "1"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.Xml"
/>
<Reference
Name = "Common"
Project = "{A1E2756A-4E32-40BB-B449-9BDA1C15DE84}"
Package = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}"
/>
<Reference
Name = "DataAccess"
Project = "{21B54F51-D2B2-459E-895C-540AD4A8704F}"
Package = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}"
/>
</References>
<Imports>
<Import Namespace = "Microsoft.VisualBasic" />
<Import Namespace = "System" />
<Import Namespace = "System.Collections" />
<Import Namespace = "System.Data" />
<Import Namespace = "System.Diagnostics" />
</Imports>
</Build>
<Files>
<Include>
<File
RelPath = "AssemblyInfo.vb"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Logging.vb"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</VisualBasic>
</VisualStudioProject>

View File

@@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = "relative:bms"
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

185
BMS/BMSDll/bms/Logging.vb Normal file
View File

@@ -0,0 +1,185 @@
#Region "Includes"
Imports System.Data.SqlClient
Imports Common.Common
Imports System.Runtime.InteropServices
#End Region
'Class used 4 common Logging
<ClassInterface(ClassInterfaceType.AutoDual)> _
Public Class Logging
#Region "Members"
Dim m_JournalId As Integer
Dim m_JobId As Integer
Dim m_ProgrammId As Integer
Dim m_DbConnection As SqlConnection
Dim m_Common As Common.Common
Dim m_JobTyp As JobType
Dim m_IsNachLetzterAusfuerung As Boolean
Dim m_RunJob As Boolean
#End Region
#Region "Constructor"
'Gets a new JournalId for a new logging instance
'TODO: jobtype muss nicht bekannt sein, wenn ein tool als start UND watch läuft...
'Wird aber benötigt, um LastRunEnde auf Job zu setzen. Dies wiederum wird in GetFailedStartJobs
'verwendet um zu überprüfen, ob der JOB(und ebe nicht das programm) gestartet wurde
Public Sub New(ByVal programId As Integer, ByVal jobType As JobType)
Try
Dim sqlCom As New SqlCommand
Dim da As New SqlDataAdapter
Dim ds As New DataSet
m_ProgrammId = programId
m_Common = New Common.Common
m_DbConnection = New SqlConnection(m_Common.DSN)
m_DbConnection.Open()
sqlCom.CommandType = CommandType.StoredProcedure
sqlCom.Connection = m_DbConnection
sqlCom.CommandText = "CreateJournal"
sqlCom.Parameters.Add(New SqlParameter("@ProgrammId", m_ProgrammId))
sqlCom.Parameters.Add(New SqlParameter("@JobTypId", jobType))
da.SelectCommand = sqlCom
da.Fill(ds)
'One table and one row are required
If ds.Tables.Count > 0 Then
If ds.Tables(0).Rows.Count > 0 Then
m_JournalId = ds.Tables(0).Rows(0).Item("JournalId")
m_JobId = ds.Tables(0).Rows(0).Item("JobId")
m_IsNachLetzterAusfuerung = ds.Tables(0).Rows(0).Item("NachLetzterAusfuerung")
m_RunJob = ds.Tables(0).Rows(0)("RunJob")
Else
Throw New Exception("Neues Journal konnte nicht erzeugt werden oder zugehöriger Job wurde nicht gefunden")
End If
Else
Throw New Exception("Neues Journal konnte nicht erzeugt werden oder zugehöriger Job wurde nicht gefunden")
End If
If jobType = jobType.WatchJob Then
'needed for validating correct start and maximal durations
DataAccess.Job.SetJobLastRun(m_Common.DSN, m_JobId, LastRun.Start)
m_Common.Log(m_Common.DLL_DISPLAY_NAME, "DLL Library setted LastRunStart to " + DateTime.Now.ToString("G") + " for JobId " + m_JobId.ToString)
End If
m_DbConnection.Close()
Catch ex As Exception
If m_DbConnection.State = ConnectionState.Open Then
m_DbConnection.Close()
End If
WriteEventLog(ex.Source, ex.Message, EventLogEntryType.Error)
End Try
End Sub
#End Region
#Region "Public Methods"
'Note: This Sub is necessary, because VB cannot handle constructors with parameters
'so we have to do all the "constuctor" stuff in a method...
'Public Sub InitLogging(ByVal programId As Integer, ByVal jobTyp As Integer)
'End Sub
'Writes a message with a journalEntryType to the journal
Public Sub Log(ByVal message As String, ByVal journalEintragTyp As JournalEntryType)
Try
WriteJournalEntry(message, CType(journalEintragTyp, JournalEntryType))
'in an error case, service should do something
If journalEintragTyp = JournalEntryType.Error Then
Dim ds As New DataSet
DataAccess.Job.GetNotifications(m_Common, m_ProgrammId, ds)
DataAccess.Job.SendNotification(m_Common, m_ProgrammId, ds, message, m_JobId, JobType.WatchJob)
End If
Catch ex As Exception
WriteEventLog(ex.Source, ex.Message, EventLogEntryType.Error)
End Try
End Sub
'Writes a message to the journal
Public Sub Log(ByVal message As String)
Try
'MsgBox("adsf" / 10) force crash 4 debug
Log(message, JournalEntryType.Information)
Catch ex As Exception
WriteEventLog(ex.Source, ex.Message, EventLogEntryType.Error)
End Try
End Sub
'Writes to journal, that the program has started
Public Sub Start()
Try
DataAccess.Job.SetIsRunning(m_Common.DSN, m_ProgrammId, True)
WriteJournalEntry("Start", JournalEntryType.Information)
Catch ex As Exception
DataAccess.Job.SetIsRunning(m_Common.DSN, m_ProgrammId, False)
WriteEventLog(ex.Source, ex.Message, EventLogEntryType.Error)
End Try
End Sub
'Writes to journal, that the program has ended
Public Sub Ende()
Try
DataAccess.Job.SetIsRunning(m_Common.DSN, m_ProgrammId, False)
DataAccess.Job.SetJobLastRun(m_Common.DSN, m_JobId, LastRun.End)
'calc next start time JUST if its a "NachLetzterAusfuerung" Job
If m_IsNachLetzterAusfuerung Then
DataAccess.Job.SetNextExecDateTime(m_Common.DSN, m_JobId)
End If
WriteJournalEntry("Ende", JournalEntryType.Information)
Catch ex As Exception
WriteEventLog(ex.Source, ex.Message, EventLogEntryType.Error)
End Try
End Sub
#End Region
#Region "Private Methods"
'Writes an nice formatted error message to windows eventlog
Private Sub WriteEventLog(ByVal source As String, ByVal errorMessage As String, ByVal eventLogType As EventLogEntryType)
m_Common.Log(source, "Quelle: " & source & Environment.NewLine & "Meldung: " & errorMessage, eventLogType)
End Sub
'Writes an entry to the BMS journal
Private Sub WriteJournalEntry(ByVal message As String, ByVal journalEntryType As JournalEntryType)
Try
Dim dr As SqlDataReader
Dim sqlCom As New SqlCommand
m_DbConnection.Open()
sqlCom.CommandType = CommandType.StoredProcedure
sqlCom.Connection = m_DbConnection
sqlCom.CommandText = "CreateJournalEntry"
sqlCom.Parameters.Add(New SqlParameter("@JournalId", m_JournalId))
sqlCom.Parameters.Add(New SqlParameter("@EintragDesc", message))
sqlCom.Parameters.Add(New SqlParameter("@JournalEintragTypId", CInt(journalEntryType)))
sqlCom.ExecuteNonQuery()
m_DbConnection.Close()
Catch
If m_DbConnection.State = ConnectionState.Open Then
m_DbConnection.Close()
End If
Throw
End Try
End Sub
#End Region
End Class

View File

@@ -0,0 +1,5 @@
SCC = This is a Source Code Control file
[BMSDll.vbproj]
SCC_Aux_Path = "\\SERVER01\DATEN\SourceSave\EDOKA4.0"
SCC_Project_Name = "$/BMS/BMSDll/bms", FSCAAAAA

BIN
BMS/BMSDll/bms/vssver.scc Normal file

Binary file not shown.

5
BMS/BMSDll/mssccprj.scc Normal file
View File

@@ -0,0 +1,5 @@
SCC = This is a Source Code Control file
[BMSDll.vbproj]
SCC_Aux_Path = "\\SERVER01\DATEN\SourceSave\EDOKA4.0"
SCC_Project_Name = "$/BMS/BMSDll", DSCAAAAA

View File

@@ -0,0 +1,11 @@
bin\BMS.dll
bin\BMS.xml
bin\Common.dll
bin\DataAccess.dll
bin\ZpCryptography.dll
bin\DataAccess.xml
bin\ZpCryptography.xml
bin\Common.xml
obj\Release\ResolveAssemblyReference.cache
obj\Release\BMS.dll
obj\Release\BMS.xml

View File

@@ -0,0 +1,11 @@
C:\Data\Edoka_FW3\BMS\BMSDll\bin\BMS.dll
C:\Data\Edoka_FW3\BMS\BMSDll\bin\BMS.xml
C:\Data\Edoka_FW3\BMS\BMSDll\bin\Common.dll
C:\Data\Edoka_FW3\BMS\BMSDll\bin\DataAccess.dll
C:\Data\Edoka_FW3\BMS\BMSDll\bin\ZpCryptography.dll
C:\Data\Edoka_FW3\BMS\BMSDll\bin\DataAccess.xml
C:\Data\Edoka_FW3\BMS\BMSDll\bin\ZpCryptography.xml
C:\Data\Edoka_FW3\BMS\BMSDll\bin\Common.xml
C:\Data\Edoka_FW3\BMS\BMSDll\obj\Release\ResolveAssemblyReference.cache
C:\Data\Edoka_FW3\BMS\BMSDll\obj\Release\BMS.dll
C:\Data\Edoka_FW3\BMS\BMSDll\obj\Release\BMS.xml

Binary file not shown.

View File

@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>
BMS
</name>
</assembly>
<members>
</members>
</doc>

Binary file not shown.

BIN
BMS/BMSDll/vssver.scc Normal file

Binary file not shown.