Imports System.Data
Imports AppCommon
Imports AppVariable


Partial Class training_documentregister
    Inherits System.Web.UI.Page

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

    Private _bytesOfLimitFileSize As Integer
    Private _fileExtensions As Hashtable
    Private _limitFileCount課題演習資料 As Integer
    Private _limitFileCountその他 As Integer
#End Region

#Region "******************** プロパティ ********************"
    Protected ReadOnly Property StringOfLimitFileSize As String
        Get
            Return (_bytesOfLimitFileSize / 1024 / 1024).ToString & "MB"
        End Get
    End Property

    Protected ReadOnly Property StringOfFileExtensions As String
        Get
            Dim extensions As String = ""
            For i As Integer = 0 To _fileExtensions.Count - 1
                If Not String.Empty.Equals(extensions) Then
                    extensions &= ","
                End If
                extensions &= _fileExtensions.Keys(i).ToString
            Next

            Return extensions
        End Get
    End Property
#End Region

#Region "******************** ページイベント ********************"
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        _param = DirectCast(Session(S_Training_Seleted_Param), TrainingParam)
        _user = DirectCast(Session(S_COM_LoginUser), LoginUser)

        _bytesOfLimitFileSize = GetFileSize()
        _fileExtensions = GetFileExtensions()
        _limitFileCount課題演習資料 = GetFileCount("研修申込_添付ファイル_上限数_課題演習資料")
        _limitFileCountその他 = GetFileCount("研修申込_添付ファイル_上限数_その他")
        uc_TitleBar_その他.Text = "その他　※添付ファイルは" & CStr(_limitFileCountその他) & "個まで"

        If Not IsPostBack() Then
            InitResultMessage()
            uc_TrainingInfo.Create研修詳細()
            CreateControls()
            AdjustButtons()
            Refresh書類添付()
            Bind書類()
            CreateList書類添付(lv_書類添付_課題演習資料, "課題演習資料")
            CreateList書類添付(lv_書類添付_その他, "その他")

            If lv_書類添付_課題演習資料.Items.Count >= _limitFileCount課題演習資料 Then
                div_fileupload_課題演習資料.Visible = False
            End If

            If lv_書類添付_その他.Items.Count >= _limitFileCountその他 Then
                div_fileupload_その他.Visible = False
            End If
        End If
    End Sub
#End Region

#Region "***************** コントロールイベント *****************"
    Protected Sub btn_戻る_Click(ByVal sender As Object, ByVal e As EventArgs)
        'ページ遷移
        Response.Redirect(Com_Get_Content(_param.Referer))
    End Sub

    Protected Sub btn_一時保存_Click(ByVal sender As Object, ByVal e As EventArgs)
        Regist書類("一時保存")

        Dim msg As String = ""
        msg &= "下書きを保存しました。"
        Session(S_Training_ClientMessage) = msg

        'ページ遷移
        Response.Redirect(Com_Get_Content(FunctionCd.TrainingApplyConfirm))
    End Sub

    Protected Sub btn_提出_Click(sender As Object, e As EventArgs)
        'バリデーションチェックを提出ボタン時も追加 #25004 Add Start 20251202 S.Iguchi
        If Not Page.IsValid Then
            Return
        End If
        '#25004 Add End 20251202 S.Iguchi 

        Regist書類("提出済み")

        Dim msg As String = ""
        msg &= "書類提出を受け付けました。"

        Session(S_Training_ClientMessage) = msg

        'ページ遷移
        Response.Redirect(Com_Get_Content(FunctionCd.TrainingDocumentConfirm))

    End Sub

    Protected Sub btn_更新_Click(ByVal sender As Object, ByVal e As EventArgs)

        If Not Page.IsValid Then
            Return
        End If

        Regist書類("提出済み")

        Dim msg As String = ""
        msg &= "書類の提出内容更新を受け付けました。"

        Session(S_Training_ClientMessage) = msg

        'ページ遷移
        Response.Redirect(Com_Get_Content(FunctionCd.TrainingDocumentConfirm))
    End Sub

    Protected Sub btn_ファイル追加_課題演習資料_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim lv As ListView = lv_書類添付_課題演習資料
        Dim fu As FileUpload = fu_課題演習資料
        Dim lb As Label = lb_file_message_課題演習資料
        Dim div As Control = div_fileupload_課題演習資料
        Dim columnName As String = "課題演習資料"

        'ファイル名の禁止文字チェック S.Iguchi 
        If Not ValidateFileUpload(fu, lb) Then
            lb.Visible = True
            Exit Sub
        Else
            lb.Visible = False
        End If

        Regist書類添付(fu, columnName)
        CreateList書類添付(lv, columnName)

        If lv.Items.Count >= _limitFileCount課題演習資料 Then
            div.Visible = False
        End If
    End Sub

    Protected Sub btn_ファイル追加_その他_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim lv As ListView = lv_書類添付_その他
        Dim fu As FileUpload = fu_その他
        Dim lb As Label = lb_file_message_その他
        Dim div As Control = div_fileupload_その他
        Dim columnName As String = "その他"

        If Not ValidateFileUpload(fu, lb) Then
            lb.Visible = True
            Exit Sub
        Else
            lb.Visible = False
        End If

        Regist書類添付(fu, columnName)
        CreateList書類添付(lv, columnName)

        If lv.Items.Count >= _limitFileCountその他 Then
            div.Visible = False
        End If
    End Sub

    Protected Sub CustomValidator1_ServerValidate(source As Object, args As ServerValidateEventArgs)

        'args.IsValid = String.IsNullOrEmpty(txt_現職開始年.Text) Or String.IsNullOrEmpty(txt_現職開始月.Text)
        args.IsValid = Not String.IsNullOrEmpty(txt_現職開始年.Text) AndAlso Not String.IsNullOrEmpty(txt_現職開始月.Text)
    End Sub

    Private Function ValidateFileUpload(ByRef fu As FileUpload, ByRef lv As Label) As Boolean
        If Not fu.HasFile Then
            Return False
        End If

        If Not ValidateFileSize(fu) Then
            lv.Text &= "アップロードするファイルサイズは" & StringOfLimitFileSize & "以内に収めてください。"
            Return False
        End If

        If Not ValidateFileExtension(fu) Then
            lv.Text = "許可された拡張子(" & StringOfFileExtensions & ")でアップロードしてください。"
            Return False
        End If

        'ファイル名チェック 20250714
        'AcccessからファイルDL時のエラー回避のため、禁止文字のチェック
        Dim mes As String = ""
        If Not ValidateFileName(fu.FileName, mes) Then
            lv.Text = mes
            Return False
        End If

        Return True
    End Function
    Protected Sub lv_書類添付_課題演習資料_ItemCommand(ByVal sender As Object, ByVal e As ListViewCommandEventArgs)
        Select Case e.CommandName
            Case "download"
                Dim dt As DataTable
                Using spm As New StoredProcedureManager("申込_書類添付TMP_SELECT")
                    spm.AddPrmIn("@id", SqlDbType.Int, DirectCast(e.Item.FindControl("lb_id"), Label).Text)
                    spm.Fill()

                    dt = spm.ds.Tables(0)
                End Using

                Response.ContentType = "application/octet-stream"
                Response.HeaderEncoding = System.Text.Encoding.GetEncoding("SHIFT-JIS")
                Response.AddHeader("Content-Disposition", "attachment; filename=" & DirectCast(e.Item.FindControl("lnkb_file_name"), LinkButton).Text)
                Response.BinaryWrite(CType(dt.Rows(0)("file_binary"), Byte()))
                Response.Flush()
                Response.End()
            Case "fileDelete"
                Using spm As New StoredProcedureManager("申込_書類添付TMP_DELETE")
                    spm.AddPrmIn("@id", SqlDbType.Int, DirectCast(e.Item.FindControl("lb_id"), Label).Text)
                    spm.Exec()
                End Using

                CreateList書類添付(lv_書類添付_課題演習資料, "課題演習資料")

                If lv_書類添付_課題演習資料.Items.Count < _limitFileCount課題演習資料 Then
                    div_fileupload_課題演習資料.Visible = True
                End If
        End Select
    End Sub

    Protected Sub lv_書類添付_その他_ItemCommand(ByVal sender As Object, ByVal e As ListViewCommandEventArgs)
        Select Case e.CommandName
            Case "download"
                Dim dt As DataTable
                Using spm As New StoredProcedureManager("申込_書類添付TMP_SELECT")
                    spm.AddPrmIn("@id", SqlDbType.Int, DirectCast(e.Item.FindControl("lb_id"), Label).Text)
                    spm.Fill()

                    dt = spm.ds.Tables(0)
                End Using

                Response.ContentType = "application/octet-stream"
                Response.HeaderEncoding = System.Text.Encoding.GetEncoding("SHIFT-JIS")
                Response.AddHeader("Content-Disposition", "attachment; filename=" & DirectCast(e.Item.FindControl("lnkb_file_name"), LinkButton).Text)
                Response.BinaryWrite(CType(dt.Rows(0)("file_binary"), Byte()))
                Response.Flush()
                Response.End()
            Case "fileDelete"
                Using spm As New StoredProcedureManager("申込_書類添付TMP_DELETE")
                    spm.AddPrmIn("@id", SqlDbType.Int, DirectCast(e.Item.FindControl("lb_id"), Label).Text)
                    spm.Exec()
                End Using

                CreateList書類添付(lv_書類添付_その他, "その他")

                If lv_書類添付_その他.Items.Count < _limitFileCountその他 Then
                    div_fileupload_その他.Visible = True
                End If
        End Select
    End Sub
#End Region

#Region "******************* Sub及びFunction ********************"
    Private Sub CreateControls()
        Create性別()
        Create職層() '20240401追加
        Create代表幹事承諾()
        Create副幹事承諾()
        Create座長承諾()
        Create教室委員承諾()
        Create意向確認()
    End Sub

    Private Sub Create性別()
        Using spm As New StoredProcedureManager("共通_変数_DDL")
            spm.AddPrmIn("@変数", SqlDbType.VarChar, "性")
            spm.Fill()

            rbl_性別.DataSource = spm.ds.Tables(0)
        End Using

        rbl_性別.DataBind()
    End Sub

    Private Sub Create代表幹事承諾()
        Using spm As New StoredProcedureManager("共通_変数_DDL")
            spm.AddPrmIn("@変数", SqlDbType.VarChar, "研修申込_承諾")
            spm.Fill()

            dd_代表幹事承諾.DataSource = spm.ds.Tables(0)
        End Using

        dd_代表幹事承諾.DataBind()
    End Sub

    Private Sub Create副幹事承諾()
        Using spm As New StoredProcedureManager("共通_変数_DDL")
            spm.AddPrmIn("@変数", SqlDbType.VarChar, "研修申込_承諾")
            spm.Fill()

            dd_副幹事承諾.DataSource = spm.ds.Tables(0)
        End Using

        dd_副幹事承諾.DataBind()
    End Sub

    Private Sub Create座長承諾()
        Using spm As New StoredProcedureManager("共通_変数_DDL")
            spm.AddPrmIn("@変数", SqlDbType.VarChar, "研修申込_承諾")
            spm.Fill()

            dd_座長承諾.DataSource = spm.ds.Tables(0)
        End Using

        dd_座長承諾.DataBind()
    End Sub

    Private Sub Create教室委員承諾()
        Using spm As New StoredProcedureManager("共通_変数_DDL")
            spm.AddPrmIn("@変数", SqlDbType.VarChar, "研修申込_承諾")
            spm.Fill()

            dd_教室委員承諾.DataSource = spm.ds.Tables(0)
        End Using

        dd_教室委員承諾.DataBind()
    End Sub

    Private Sub Create意向確認()
        Using spm As New StoredProcedureManager("共通_変数_DDL")
            spm.AddPrmIn("@変数", SqlDbType.VarChar, "研修申込_意向確認")
            spm.Fill()

            dd_意向確認.DataSource = spm.ds.Tables(0)
        End Using

        dd_意向確認.DataBind()
    End Sub

    '20240401追加
    Private Sub Create職層()
        Using spm As New StoredProcedureManager("共通_変数_DDL")
            spm.AddPrmIn("@変数", SqlDbType.VarChar, "研修申込_職層")
            spm.Fill()

            dd_職層.DataSource = spm.ds.Tables(0)
        End Using

        dd_職層.DataBind()
    End Sub


    Private Sub Regist書類(ByVal prm提出状況 As String)



        Using spm As New StoredProcedureManager("申込_書類_REGIST")
            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.AddPrmIn("@連番", SqlDbType.Int, _param.連番)

            spm.AddPrmIn("@EMAIL", SqlDbType.VarChar, txt_EMAIL.Text)

            spm.AddPrmIn("@団体名", SqlDbType.Varchar, txt_団体名.Text)
            spm.AddPrmIn("@氏名"	, SqlDbType.Varchar, txt_氏名.Text)
            spm.AddPrmIn("@ふりがな", SqlDbType.Varchar, txt_ふりがな.Text)
            spm.AddPrmIn("@年齢", SqlDbType.TinyInt, txt_年齢.Text)
            spm.AddPrmIn("@性別"	,SqlDbType.VarChar, rbl_性別.SelectedValue)

            spm.AddPrmIn("@職場郵便番号", SqlDbType.VarChar, txt_郵便番号.Text.Replace("-", ""))
            spm.AddPrmIn("@職場住所", SqlDbType.VarChar, txt_住所.Text)
            spm.AddPrmIn("@職場電話番号", SqlDbType.VarChar, txt_電話番号.Text)
            'spm.AddPrmIn("@研修担当EMAIL", SqlDbType.VarChar, txt_メールアドレス.Text)

            spm.AddPrmIn("@職歴1", SqlDbType.VarChar, txt_職歴1.Text)
            spm.AddPrmIn("@職歴1開始年", SqlDbType.SmallInt, txt_職歴1開始年.Text)
            spm.AddPrmIn("@職歴1開始月", SqlDbType.TinyInt, txt_職歴1開始月.Text)
            spm.AddPrmIn("@職歴1終了年", SqlDbType.SmallInt, txt_職歴1終了年.Text)
            spm.AddPrmIn("@職歴1終了月", SqlDbType.TinyInt, txt_職歴1終了月.Text)
            spm.AddPrmIn("@所属部課", SqlDbType.VarChar, txt_所属部課.Text)
            spm.AddPrmIn("@職名", SqlDbType.VarChar, txt_職名.Text)
            spm.AddPrmIn("@補職名", SqlDbType.VarChar, String.Empty)

            spm.AddPrmIn("@現職開始年", SqlDbType.SmallInt, txt_現職開始年.Text)
            spm.AddPrmIn("@現職開始月", SqlDbType.TinyInt, txt_現職開始月.Text)
            spm.AddPrmIn("@職層",SqlDbType.Varchar, dd_職層.SelectedValue)
            spm.AddPrmIn("@通算経験年数", SqlDbType.SmallInt, txt_実務経験年.Text)
            spm.AddPrmIn("@通算経験月数", SqlDbType.TinyInt, txt_実務経験月.Text)
            spm.AddPrmIn("@連絡事項", SqlDbType.VarChar, txt_連絡事項.Text)

            spm.AddPrmIn("@代表幹事承諾", SqlDbType.VarChar, dd_代表幹事承諾.SelectedValue)
            spm.AddPrmIn("@副幹事承諾", SqlDbType.VarChar, dd_副幹事承諾.SelectedValue)
            spm.AddPrmIn("@座長承諾", SqlDbType.VarChar, dd_座長承諾.SelectedValue)
            spm.AddPrmIn("@教室委員承諾", SqlDbType.VarChar, dd_教室委員承諾.SelectedValue)

             spm.AddPrmIn("@意向確認", SqlDbType.VarChar, dd_意向確認.SelectedValue)

            spm.AddPrmIn("@THEME", SqlDbType.VarChar, txt_THEME.Text)
            spm.AddPrmIn("@現状", SqlDbType.VarChar, txt_現状.Text)
            spm.AddPrmIn("@問題点", SqlDbType.VarChar, txt_問題点.Text)
            spm.AddPrmIn("@対応案", SqlDbType.VarChar, txt_対応案.Text)
            spm.AddPrmIn("@受講動機", SqlDbType.VarChar, txt_受講動機.Text)
            spm.AddPrmIn("@研修目標", SqlDbType.VarChar, txt_研修目標.Text)

            spm.AddPrmIn("@振返", SqlDbType.VarChar, txt_振返.Text)

            spm.AddPrmIn("@提出状況", SqlDbType.VarChar, prm提出状況)
            spm.AddPrmIn("@PORTAL区分", SqlDbType.VarChar, _user.PORTAL区分)
            spm.AddPrmIn("@USERCD", SqlDbType.VarChar, _user.USERCD)
            spm.AddPrmIn("@PORTALID", SqlDbType.VarChar, _user.PORTALID)

            spm.Exec()
        End Using
    End Sub

    Private Sub Regist書類添付(ByRef fu As FileUpload, ByVal columnName As String)
        Using spm As New StoredProcedureManager("申込_書類添付TMP_REGIST")
            spm.AddPrmIn("@PORTALID", SqlDbType.VarChar, _user.PORTALID)
            spm.AddPrmIn("@column_name", SqlDbType.NVarChar, columnName)

            spm.AddPrmIn("@file_binary", SqlDbType.VarBinary, fu.FileBytes)
            spm.AddPrmIn("@file_name", SqlDbType.NVarChar, fu.FileName)

            spm.Exec()
        End Using
    End Sub

    Private Sub Bind書類()

        '書類登録仕様変更のためコメントアウト
        'If _param.Mode = ScreenMode.Additions Then
        '    Exit Sub
        'End If

        Dim dt As DataTable
        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.AddPrmIn("@連番", SqlDbType.Int, _param.連番)
            spm.Fill()

            dt = spm.ds.Tables(0)
        End Using

        txt_EMAIL.Text = dt.Rows(0)("EMAIL").ToString()

        txt_団体名.Text = dt.Rows(0)("所属団体名").ToString()
        txt_氏名.Text = dt.Rows(0)("氏名").ToString()
        txt_ふりがな.Text = dt.Rows(0)("ふりがな").ToString()
        txt_年齢.Text = dt.Rows(0)("年齢").ToString()
        rbl_性別.SelectedValue = dt.Rows(0)("性別").ToString()

        txt_郵便番号.Text = dt.Rows(0)("郵便番号").ToString()  '初期表示はCD市区町村の値
        txt_住所.Text = dt.Rows(0)("住所").ToString() '初期表示はCD市区町村の値
        txt_電話番号.Text = dt.Rows(0)("電話番号").ToString().Replace("-", "") '初期表示はCD市区町村の値
        'txt_メールアドレス.Text = dt.Rows(0)("研修担当EMAIL").ToString()

        txt_職歴1.Text = dt.Rows(0)("職歴1").ToString()
        txt_職歴1開始年.Text = dt.Rows(0)("職歴1開始年").ToString()
        txt_職歴1開始月.Text = dt.Rows(0)("職歴1開始月").ToString()
        txt_職歴1終了年.Text = dt.Rows(0)("職歴1終了年").ToString()
        txt_職歴1終了月.Text = dt.Rows(0)("職歴1終了月").ToString()
        txt_所属部課.Text = dt.Rows(0)("所属部課").ToString()
        txt_職名.Text = dt.Rows(0)("職名").ToString()

        txt_現職開始年.Text = dt.Rows(0)("現職開始年").ToString()
        txt_現職開始月.Text = dt.Rows(0)("現職開始月").ToString()
        dd_職層.SelectedValue = dt.Rows(0)("職層").ToString()
        txt_実務経験年.Text = dt.Rows(0)("通算経験年数").ToString()
        txt_実務経験月.Text = dt.Rows(0)("通算経験月数").ToString()
        txt_連絡事項.Text = dt.Rows(0)("連絡事項").ToString()

        dd_意向確認.SelectedValue = dt.Rows(0)("意向確認").ToString()

        dd_代表幹事承諾.SelectedValue = dt.Rows(0)("代表幹事承諾").ToString()
        dd_副幹事承諾.SelectedValue = dt.Rows(0)("副幹事承諾").ToString()
        dd_座長承諾.SelectedValue = dt.Rows(0)("座長承諾").ToString()
        dd_教室委員承諾.SelectedValue = dt.Rows(0)("教室委員承諾").ToString()

        txt_THEME.Text = dt.Rows(0)("THEME").ToString()
        txt_現状.Text = dt.Rows(0)("現状").ToString()
        txt_問題点.Text = dt.Rows(0)("問題点").ToString()
        txt_対応案.Text = dt.Rows(0)("対応案").ToString()


        txt_受講動機.Text = dt.Rows(0)("受講動機").ToString()
        txt_研修目標.Text = dt.Rows(0)("研修目標").ToString()
        txt_振返.Text = dt.Rows(0)("振返").ToString()

    End Sub

    Private Sub Refresh書類添付()
        Using spm As New StoredProcedureManager("申込_書類添付TMP_REFRESH")
            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.AddPrmIn("@連番", SqlDbType.Int, _param.連番)
            spm.AddPrmIn("@PORTALID", SqlDbType.VarChar, _user.PORTALID)
            spm.Exec()
        End Using
    End Sub

    Private Sub CreateList書類添付(ByRef lv As ListView, ByVal columnName As String)
        Using spm As New StoredProcedureManager("申込_書類添付TMP一覧_SELECT")
            spm.AddPrmIn("@PORTALID", SqlDbType.VarChar, _user.PORTALID)
            spm.AddPrmIn("@column_name", SqlDbType.NVarChar, columnName)
            spm.Fill()

            lv.DataSource = spm.ds.Tables(0)
        End Using

        lv.DataBind()
    End Sub

    Private Sub AdjustButtons()
        If _param.Mode = ScreenMode.Edits Then
            div_button_add.Visible = False
        Else
            div_button_edit.Visible = False
        End If

        Dim str研修区分 = uc_TrainingInfo.研修区分


        If Not "一般研修".Equals(str研修区分) Then
            DisenabledControl({lb_所属部課}, {vdt_所属部課}, {txt_所属部課})
            DisenabledControl({lb_職層}, {vdt_職層}, {dd_職層})
            DisenabledControl({lb_実務経験年数}, {vdt_実務経験年, vdt_実務経験月, vdt_実務経験年半角, vdt_実務経験月半角}, {txt_実務経験年, txt_実務経験月})
        End If

        '研修開始日以降は、研修生情報を更新できない 20251118 ADD Start S.Iguchi
        Dim str研修開始日 = uc_TrainingInfo.研修開始日
        Dim 日付部分 As String = str研修開始日.Split("("c)(0).Trim()
        Dim 期限日 As DateTime
        Dim 現在日 As DateTime = DateTime.Today

        If DateTime.TryParse(日付部分, 期限日) Then
            If 期限日 <= 現在日 Then
                DisenabledControl({lb_氏名}, {vdt_氏名}, {txt_氏名})
                DisenabledControl({lb_ふりがな}, {vdt_ふりがな}, {txt_ふりがな})
                DisenabledControl({lb_年齢}, {vdt_年齢}, {txt_年齢})
                DisenabledControl({lb_性別}, {vdt_性別}, {rbl_性別})
                DisenabledControl({lb_所属部課}, {vdt_所属部課}, {txt_所属部課})
                DisenabledControl({lb_職名}, {vdt_職名}, {txt_職名})
            End If
        End If
        '20251118 ADD End S.Iguchi

    End Sub

    Private Sub DisenabledControl(
              Optional ByRef lbls As Label() = Nothing _
            , Optional ByRef vdts As BaseValidator() = Nothing _
            , Optional ByRef ipts As WebControl() = Nothing
    )
        If lbls.Length > 0 Then
            For Each lbl As Label In lbls
                lbl.Attributes("data-required") = "false"
            Next
        End If

        If vdts.Length > 0 Then
            For Each vdt As WebControl In vdts
                vdt.Enabled = False
            Next
        End If

        If ipts.Length > 0 Then
            For Each int As WebControl In ipts
                int.Enabled = False
            Next
        End If
    End Sub


    Private Function GetFileSize() As Integer
        Using spm As New StoredProcedureManager("共通_変数_DDL")
            spm.AddPrmIn("@変数", SqlDbType.VarChar, "研修申込_添付ファイル_上限サイズ")
            spm.Fill()

            Return Integer.Parse(spm.ds.Tables(0).Rows(0)("内容").ToString)
        End Using
    End Function

    Private Function GetFileExtensions() As Hashtable
        Using spm As New StoredProcedureManager("共通_変数_DDL")
            spm.AddPrmIn("@変数", SqlDbType.VarChar, "研修申込_添付ファイル_拡張子")
            spm.Fill()

            If spm.ds.Tables(0).Rows.Count = 0 Then
                Return Nothing
            End If

            Dim alist As New Hashtable
            For i As Integer = 0 To spm.ds.Tables(0).Rows.Count - 1
                alist.Add(spm.ds.Tables(0).Rows(i)("内容").ToString.ToUpper, "")
            Next
            Return alist
        End Using
    End Function

    Private Function GetFileCount(ByVal key As String) As Integer
        Using spm As New StoredProcedureManager("共通_変数_DDL")
            spm.AddPrmIn("@変数", SqlDbType.VarChar, key)
            spm.Fill()

            Return Integer.Parse(spm.ds.Tables(0).Rows(0)("内容").ToString)
        End Using
    End Function

    Private Function ValidateFileSize(fu As FileUpload) As Boolean
        If fu.PostedFile.ContentLength <= _bytesOfLimitFileSize Then
            Return True
        End If

        Return False
    End Function

    Private Function ValidateFileExtension(ByRef fu As FileUpload) As Boolean
        If IsNothing(_fileExtensions) OrElse _fileExtensions.Count = 0 Then
            Return True
        End If

        Dim target = System.IO.Path.GetExtension(fu.FileName)
        target = Replace(target, ".", "").ToUpper

        If Not _fileExtensions.Contains(target) Then
            Return False
        End If

        Return True
    End Function

    Private Sub InitResultMessage()
        lb_file_message_課題演習資料.Text = ""
        lb_file_message_その他.Text = ""
    End Sub
#End Region

End Class