'**************************************************************************
' Name       :MyUtility
'--------------------------------------------------------------------------
' Comment    :汎用ユーティリティクラス
'--------------------------------------------------------------------------
' Design On  :2013/01/31
'        By  :NCS)T.Kikuchi
'--------------------------------------------------------------------------
' Update On  :
'        By  :
' Comment    :
'**************************************************************************
Public Class MyUtility

    Public Shared Function Get頭文字(ByVal val As String) As String
        If val.Length > 0 Then
            Dim Hiragana As String = val.Substring(0, 1)
            ' 濁点の対応（濁点アリの場合は、半角カナにして1文字のみにする）
            Dim katakana As String = Microsoft.VisualBasic.StrConv(val.Substring(0, 1), VbStrConv.Katakana)
            Dim hankaku As String = Microsoft.VisualBasic.StrConv(katakana, VbStrConv.Narrow)
            If hankaku.Length > 1 Then
                Dim zenkaku As String = Microsoft.VisualBasic.StrConv(hankaku.Substring(0, 1), VbStrConv.Wide)
                Hiragana = Microsoft.VisualBasic.StrConv(zenkaku, VbStrConv.Hiragana)
            End If
            Return Hiragana
        End If
        Return String.Empty
    End Function

    Public Shared Function Is投票済み(ByVal senkyoId As String, ByVal userId As String) As Boolean
        ' 投票Tにデータがあるか確認する
        Dim ds As DataSet1 = New DataSet1
        Using myDataBase As MyDataBase = New MyDataBase
            myDataBase.Fill投票TBy選挙ID投票券番号(ds, senkyoId, userId)
        End Using

        If (ds.投票T.Rows.Count > 0) Then
            Return True
        Else
            Return False
        End If
    End Function

    ''' <summary>
    ''' DBから取得した値をString型で返す
    ''' </summary>
    ''' <param name="row"></param>
    ''' <param name="columnName"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function GetStringValue(row As DataRow, columnName As String) As String

        If row.IsNull(columnName) Then
            Return String.Empty
        End If
        Return row(columnName).ToString()

    End Function

End Class
