认真工作,天天向上

不断的学习,不断的总结

导航

Class ConfigInfo

Imports CommonLib.Xml
Imports CommonLib.Utility
 
Namespace Config
    
    
Public Class ConfigInfo

        
'クラスレベルの変数
        Private sDBServiceName As String                                 'DBサービス名
        Private sDBUserName As String                                    'DBユーザ名
        Private sDBPassword As String                                    'DBパスワード
        Private sDBType As Integer                                       'DB type
        Private sDataProviderType As String
        
Private sImageFilePath As String
        
Private sPOSCREDITImageFilePath As String
        
Private sNetComputerName As String = "\\tt"
        
Private sNetUserName As String = ""
        
Private sNetPassWord As String = ""
        
Private sMessageFilePath As String
        
Private sValuePatternOne As String = "E01"
        
Private sValuePatternTwo As String = "A02"
        
Private sValuePatternThree As String = "E04"


        
Private Shared iAppSettingConfigger As IConfig                             'アプリケーション設定情報を読み書きするためのオブジェクト

        
'********************************************************
        '* コンストラクタ
        '********************************************************
        '既定のコンストラクタ
        Public Sub New()
            iAppSettingConfigger 
= New XmlSerializeConfig(System.IO.Path.Combine(Application.StartupPath, "application-setting.config"))

            
' LoadConfig()

        
End Sub


        
'********************************************************
        '* コンストラクタ
        '********************************************************
        Public Sub New(ByVal isLoad As Boolean)
            
'Donot do anything
            If isLoad Then
                iAppSettingConfigger 
= New XmlSerializeConfig(System.IO.Path.Combine(Application.StartupPath, "application-setting.config"))
                LoadConfig()
            
End If
        
End Sub


        
'' 引数          :service  DBサービス名
        ''                                      :username DBユーザ名
        ''                                      :pass DBパスワード
        Public Sub New(ByVal service As StringByVal username As StringByVal pass As StringByVal dpType As String)
            sDBServiceName 
= service
            sDBUserName 
= username
            sDBPassword 
= pass
            sDataProviderType 
= dpType
            sDBType 
= dpType
            sImageFilePath 
= dpType
        
End Sub



        
'' 機能          : LoadConfig
        '' 戻り値        : 
        Public Function LoadConfig() As Boolean
            
'アプリケーション設定読み込み
            Dim mConfigInfo As ConfigInfo = iAppSettingConfigger.LoadXML()

            
If Not mConfigInfo Is Nothing Then
                sDBServiceName 
= mConfigInfo.DBServiceName
                sDBUserName 
= mConfigInfo.DBUserName
                sDBPassword 
= mConfigInfo.DBPassword
                sDataProviderType 
= mConfigInfo.DataProviderType
                sDBType 
= mConfigInfo.DBType
                sImageFilePath 
= mConfigInfo.ImagePath
                sPOSCREDITImageFilePath 
= mConfigInfo.POSCREDITImageFilePath
                sValuePatternOne 
= mConfigInfo.ValuePatternOne
                sValuePatternTwo 
= mConfigInfo.ValuePatternTwo
                sValuePatternThree 
= mConfigInfo.ValuePatternThree

                sMessageFilePath 
= System.IO.Path.GetFullPath("messagebox.xml")
                
Return True

            
Else
                
Return False
            
End If

        
End Function


        
'' 機能          : SaveConfig
        '' 戻り値        : 
        Public Sub SaveConfig()
            iAppSettingConfigger.SaveXML(
Me)

        
End Sub

        
'********************************************************
        '* プロパティ
        '********************************************************
        '' 機能          :データベース接続サービス名を取得します
        '' 戻り値        :データベース接続サービス名
        Public Property DBServiceName() As String
            
Get
                
Return sDBServiceName
            
End Get
            
Set(ByVal Value As String)
                sDBServiceName 
= Value
            
End Set
        
End Property

        
'' 機能          : 
        '' 戻り値        : 
        Public Property DBType() As Integer
            
Get
                
Return sDBType
            
End Get
            
Set(ByVal Value As Integer)
                sDBType 
= Value
            
End Set
        
End Property

        
'' 機能          :データベース接続ユーザ名を取得します
        '' 戻り値        :データベース接続ユーザ名
        Public Property DBUserName() As String
            
Get
                
Return sDBUserName
            
End Get
            
Set(ByVal Value As String)
                sDBUserName 
= Value
            
End Set
        
End Property


        
'' 機能          :データベース接続パスワードを取得します
        '' 戻り値        :データベース接続パスワード
        Public Property DBPassword() As String
            
Get
                
Return sDBPassword
            
End Get
            
Set(ByVal Value As String)
                sDBPassword 
= Value
            
End Set
        
End Property


        
'' 機能          :データプロバイダーのタイプ取得します
        '' 戻り値        :データプロバイダーのタイプsMessageFilePath
        Public Property NetComputerName() As String
            
Get
                
Return sNetComputerName
            
End Get
            
Set(ByVal Value As String)
                sNetComputerName 
= Value
            
End Set
        
End Property


        
'' 機能          :データプロバイダーのタイプ取得します
        '' 戻り値        : 
        Public ReadOnly Property MessageFilePath() As String
            
Get
                
Return sMessageFilePath
            
End Get
        
End Property

        
'' 機能          :データプロバイダーのタイプ取得します
        '' 戻り値        :データプロバイダーのタイプ
        Public Property NetUserName() As String
            
Get
                
Return sNetUserName
            
End Get
            
Set(ByVal Value As String)
                sNetUserName 
= Value
            
End Set
        
End Property

        
'' 機能          :データプロバイダーのタイプ取得します
        '' 戻り値        :データプロバイダーのタイプ
        Public Property NetPassWord() As String
            
Get
                
Return sNetPassWord
            
End Get
            
Set(ByVal Value As String)
                sNetPassWord 
= Value
            
End Set
        
End Property


        
'' 機能          :データプロバイダーのタイプ取得します
        '' 戻り値        :データプロバイダーのタイプ
        Public Property DataProviderType() As String
            
Get
                
Return sDataProviderType
            
End Get
            
Set(ByVal Value As String)
                sDataProviderType 
= Value
            
End Set
        
End Property


        
'' 機能          :データプロバイダーのタイプ取得します
        '' 戻り値        :データプロバイダーのタイプ 
        Public Property ImagePath() As String
            
Get
                
Return sImageFilePath
            
End Get
            
Set(ByVal Value As String)
                sImageFilePath 
= Value
            
End Set
        
End Property



        
'' 機能          :データプロバイダーのタイプ取得します
        '' 戻り値        :データプロバイダーのタイプ 
        Public Property POSCREDITImageFilePath() As String
            
Get
                
Return sPOSCREDITImageFilePath
            
End Get
            
Set(ByVal Value As String)
                sPOSCREDITImageFilePath 
= Value
            
End Set
        
End Property


        
'' 機能          :評価パッタン1
        '' 戻り値        : 
        Public Property ValuePatternOne() As String
            
Get
                
Return sValuePatternOne
            
End Get
            
Set(ByVal Value As String)
                
If Value <> "" Then sValuePatternOne = Value
            
End Set
        
End Property

        
'' 機能          :評価パッタン2
        '' 戻り値        : 
        Public Property ValuePatternTwo() As String
            
Get
                
Return sValuePatternTwo
            
End Get
            
Set(ByVal Value As String)
                
If Value <> "" Then sValuePatternTwo = Value
            
End Set
        
End Property

        
'' 機能          :評価パッタン3
        '' 戻り値        : 
        Public Property ValuePatternThree() As String
            
Get
                
Return sValuePatternThree
            
End Get
            
Set(ByVal Value As String)
                
If Value <> "" Then sValuePatternThree = Value
            
End Set
        
End Property


    
End Class

End Namespace

posted on 2007-01-10 13:01  MYOOP  阅读(222)  评论(0编辑  收藏  举报