Imports System.Data
Imports AppCommon
Imports AppVariable

Partial Class training_uc_traininginfo
    Inherits System.Web.UI.UserControl

#Region "******************** メンバ変数 ********************"
    Private _param As TrainingParam
    Private _user As LoginUser
#End Region

#Region "********************** プロパティ **********************"
    Private _horizontal As Boolean
    Public WriteOnly Property Horizontal() As Boolean
        Set(ByVal value As Boolean)
            _horizontal = value
        End Set
    End Property

    Public ReadOnly Property 回名() As String
        Get
            Return DirectCast(frm_研修詳細.FindControl("lb_回"), Label).Text
        End Get
    End Property

    Public ReadOnly Property 履修年度() As String
        Get
            Return DirectCast(frm_研修詳細.FindControl("lb_履修年度"), Label).Text
        End Get
    End Property

    Public ReadOnly Property 成績年度() As String
        Get
            Return DirectCast(frm_研修詳細.FindControl("lb_成績年度"), Label).Text
        End Get
    End Property

    Public ReadOnly Property 分野CD() As String
        Get
            Return DirectCast(frm_研修詳細.FindControl("lb_分野CD"), Label).Text
        End Get
    End Property
    Public ReadOnly Property 科目CD() As String
        Get
            Return DirectCast(frm_研修詳細.FindControl("lb_科目CD"), Label).Text
        End Get
    End Property
    Public ReadOnly Property 講座CD() As String
        Get
            Return DirectCast(frm_研修詳細.FindControl("lb_講座CD"), Label).Text
        End Get
    End Property

    Public ReadOnly Property 研修区分() As String
        Get
            Return DirectCast(frm_研修詳細.FindControl("lb_研修区分"), Label).Text
        End Get
    End Property

    Public ReadOnly Property 申込期限超過() As String
        Get
            Return DirectCast(frm_研修詳細.FindControl("lb_申込期限超過"), Label).Text
        End Get
    End Property

    '20240422 未定表示の追加対応 Add/S.Iguchi
    Public ReadOnly Property 未定表示() As String
        Get
            Return DirectCast(frm_研修詳細.FindControl("lb_未定表示"), Label).Text
        End Get
    End Property

    Public ReadOnly Property 未定可() As String
        Get
            Return DirectCast(frm_研修詳細.FindControl("lb_未定可"), Label).Text
        End Get
    End Property

    Public ReadOnly Property 新規申込NG() As String
        Get
            Return DirectCast(frm_研修詳細.FindControl("lb_新規申込NG"), Label).Text
        End Get
    End Property

    '研修開始日 ADD Start 20251118 S.Iguchi
    Public ReadOnly Property 研修開始日() As String
        Get
            Return DirectCast(frm_研修詳細.FindControl("lb_研修期間開始"), Label).Text
        End Get
    End Property
    '研修開始日 ADD End 20251118 S.Iguchi

#End Region

#Region "******************** ページイベント ********************"
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If _horizontal Then
            frm_研修詳細.Attributes("align") = "left"
            frm_研修詳細.Attributes("style") = "margin-right:10px;"
        End If
    End Sub
#End Region

#Region "******************* Sub及びFunction ********************"
    Public Sub Create研修詳細()
        'Page_Load イベントの前に呼ばれる為
        _param = DirectCast(Session(S_Training_Seleted_Param), TrainingParam)
        _user = DirectCast(Session(S_COM_LoginUser), LoginUser)

        'セッション空の場合ログイン画面にリダイレクト
        If _param Is Nothing Then
            Response.Redirect(Request.ApplicationPath & Logout_FilePath)
            Return
        End If

        Using spm As New StoredProcedureManager("申込_研修詳細_SELECT")
            spm.AddPrmIn("@履修年度", SqlDbType.SmallInt, _param.履修年度)
            spm.AddPrmIn("@成績年度", SqlDbType.SmallInt, _param.成績年度)
            spm.AddPrmIn("@分野CD", SqlDbType.VarChar, _param.分野CD)
            spm.AddPrmIn("@科目CD", SqlDbType.VarChar, _param.科目CD)
            spm.AddPrmIn("@講座CD", SqlDbType.VarChar, _param.講座CD)
            spm.Fill()

            frm_研修詳細.DataSource = spm.ds.Tables(0)
        End Using

        frm_研修詳細.DataBind()

        DirectCast(frm_研修詳細.FindControl("lb_市区町村CD"), Label).Text = _user.市区町村CD
        DirectCast(frm_研修詳細.FindControl("lb_市区町村名"), Label).Text = _user.市区町村名
    End Sub
#End Region

End Class
