Imports AppVariable

Public Class AppInfo
    '--------------------------------------------------------------------------------------------------
    'メソッド名：Info_既読処理
    '機能説明:指定した掲示を既読状態にする
    '引数:
    '       No As Integer            掲示NO
    '       PortalID As String       PORTALID
    '
    '--------------------------------------------------------------------------------------------------
    Shared Sub Info_既読処理(ByVal No As Integer, ByVal PortalID As String)
        Using spm As New StoredProcedureManager("掲示_掲示既読_INSERT")
            spm.AddPrmIn("@掲示NO", Data.SqlDbType.Int, No)
            spm.AddPrmIn("@PORTALID", Data.SqlDbType.VarChar, 200, PortalID)
            spm.Exec()
        End Using
    End Sub
    '--------------------------------------------------------------------------------------------------
    'メソッド名：Info_未読処理
    '機能説明:指定した掲示を未読状態にする
    '引数:
    '       No As Integer            掲示NO
    '       PortalID As String       PORTALID
    '
    '--------------------------------------------------------------------------------------------------
    Shared Sub Info_未読処理(ByVal No As Integer, ByVal PortalID As String)
        Using spm As New StoredProcedureManager("掲示_掲示未読_UPDATE")
            spm.AddPrmIn("@掲示NO", Data.SqlDbType.Int, No)
            spm.AddPrmIn("@PORTALID", Data.SqlDbType.VarChar, 200, PortalID)
            spm.Exec()
        End Using
    End Sub

    Shared Sub 掲示登録(ByVal str掲示種別CD As String,
                        ByVal str掲示件名 As String,
                        ByVal str掲示詳細 As String,
                        ByVal str掲示者 As String,
                        ByVal str掲示開始日 As String,
                        ByVal str掲示終了日 As String,
                        ByVal str掲示レベル As String,
                        ByVal str登録者CD As String,
                        ByVal str掲示対象CD As String,
                        ByVal str掲示対象種別 As String,
                        ByVal strページ遷移_PATH As String,
                        ByVal strページ遷移_機能CD As String,
                        ByVal strページ遷移_KEYCD As String,
                        Optional ByVal bolMail通知 As Boolean = False,
                        Optional ByVal strMail通知対象CD As String = "",
                        Optional ByVal strMail通知対象区分 As String = ""
                        )
        Using spm As New StoredProcedureManager("掲示_掲示登録_INSERT")
            spm.AddPrmIn("@掲示種別CD", Data.SqlDbType.VarChar, 20, str掲示種別CD)
            spm.AddPrmIn("@掲示件名", Data.SqlDbType.NVarChar, 200, str掲示件名)
            spm.AddPrmIn("@掲示詳細", Data.SqlDbType.NVarChar, 4000, str掲示詳細)
            spm.AddPrmIn("@掲示者", Data.SqlDbType.NVarChar, 100, str掲示者)

            Dim sTime As DateTime
            Dim eTime As DateTime
            If DateTime.TryParse(str掲示開始日, sTime) Then
                spm.AddPrmIn("@掲示開始日", Data.SqlDbType.DateTime, sTime)
            Else
                spm.AddPrmIn("@掲示開始日", Data.SqlDbType.DateTime, DBNull.Value)
            End If

            If DateTime.TryParse(str掲示終了日, eTime) Then
                spm.AddPrmIn("@掲示終了日", Data.SqlDbType.DateTime, eTime)
            Else
                spm.AddPrmIn("@掲示終了日", Data.SqlDbType.DateTime, DBNull.Value)
            End If

            spm.AddPrmIn("@掲示レベル", Data.SqlDbType.VarChar, 20, str掲示レベル)
            spm.AddPrmIn("@登録者CD", Data.SqlDbType.VarChar, 20, str登録者CD)
            spm.AddPrmIn("@掲示対象CD", Data.SqlDbType.VarChar, 20, str掲示対象CD)
            spm.AddPrmIn("@掲示対象種別", Data.SqlDbType.VarChar, 50, str掲示対象種別)
            spm.AddPrmIn("@ページ遷移_PATH", Data.SqlDbType.VarChar, 500, strページ遷移_PATH)
            spm.AddPrmIn("@ページ遷移_機能CD", Data.SqlDbType.VarChar, 500, strページ遷移_機能CD)
            spm.AddPrmIn("@ページ遷移_KEYCD", Data.SqlDbType.VarChar, 500, strページ遷移_KEYCD)
            spm.AddPrmIn("@MAIL通知", Data.SqlDbType.Bit, bolMail通知)
            spm.AddPrmIn("@MAIL通知対象CD", Data.SqlDbType.VarChar, 20, IIf(strMail通知対象CD = "", DBNull.Value, strMail通知対象CD))
            spm.AddPrmIn("@MAIL通知対象区分", Data.SqlDbType.VarChar, 20, IIf(strMail通知対象区分 = "", DBNull.Value, strMail通知対象区分))
            spm.Exec()
        End Using
    End Sub


    Shared Function 掲示_遷移チェック(ByVal 掲示NO As Integer) As Boolean

        Dim ret As Boolean = False

        Using spm As New StoredProcedureManager("掲示_掲示一覧_遷移チェック_OUTPUT")
            spm.AddPrmIn("@掲示NO", Data.SqlDbType.Int, 掲示NO)
            spm.AddPrmIn("@PORTAL区分", Data.SqlDbType.VarChar, 20, HttpContext.Current.Session(S_COM_PortalKbn))
            spm.AddPrmOut("@OUT_遷移可能", Data.SqlDbType.Bit)
            spm.Exec()
            ret = Boolean.Parse(spm.GetValue("@OUT_遷移可能"))
        End Using

        Return ret

    End Function

    Shared Function GetInfoKindCd(kindName As String) As String

        Dim kindCd = ""
        Using spm As New StoredProcedureManager("掲示_掲示種別CD_GET")
            spm.AddPrmIn("@掲示種別名", Data.SqlDbType.VarChar, 100, kindName)
            spm.AddPrmOut("@掲示種別CD", Data.SqlDbType.VarChar, 20)
            spm.Exec()

            kindCd = spm.GetValue("@掲示種別CD").ToString()

        End Using

        Return kindCd

    End Function

End Class
