Imports System.Data
Imports AppVariable
Imports AppCommon
Imports uc_SearchBankCd
Imports uc_SearchBranchCd
Imports AppVariable_teacher

Partial Class teacher_Profile
    Inherits System.Web.UI.Page

#Region "************************* 定数 *************************"
    Const CONST_SUMMITTED_MES As String = "プロフィールは既に提出済みです。"

#End Region

#Region "******************** ページイベント ********************"

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If IsPostBack = False Then
            BindAllListViews()
        End If
        '提出済の場合は操作無効
        If lv_基本情報.Items.Count > 0 Then
            Dim lbl_提出日時 As Label = CType(lv_基本情報.Items(0).FindControl("lbl_提出日時"), Label)

            If lbl_提出日時 IsNot Nothing AndAlso Not String.IsNullOrWhiteSpace(lbl_提出日時.Text) Then
                DisabledButton(btn_提出)
                AllListViewOff()
                lbl_errMes.Text = CONST_SUMMITTED_MES
                lbl_errMes.Visible = True
            End If
        End If
    End Sub

#End Region

#Region "***************** コントロールイベント *****************"
    Protected Sub lv_基本情報_ItemEditing(sender As Object, e As ListViewEditEventArgs) Handles lv_基本情報.ItemEditing
        lv_基本情報.EditIndex = e.NewEditIndex
        BindListView(lv_基本情報)
    End Sub
    Protected Sub lv_基本情報_ItemCanceling(ByVal sender As Object, ByVal e As ListViewCancelEventArgs) Handles lv_基本情報.ItemCanceling
        lv_基本情報.EditIndex = -1
        BindListView(lv_基本情報)
    End Sub
    Protected Sub lv_基本情報_ItemCommand(sender As Object, e As ListViewCommandEventArgs) Handles lv_基本情報.ItemCommand
        If e.CommandName = "cmd_Update" Then '更新ボタン
            Try
                Dim item As ListViewItem = CType(e.Item, ListViewItem)
                Dim txt_氏名 As TextBox = CType(item.FindControl("txt_氏名"), TextBox)
                Dim txt_ふりがな As TextBox = CType(item.FindControl("txt_ふりがな"), TextBox)
                Dim ddl_性別 As DropDownList = CType(item.FindControl("ddl_性別"), DropDownList)
                Dim txt_生年月日 As TextBox = CType(item.FindControl("txt_生年月日"), TextBox)
                Dim txt_携帯番号 As TextBox = CType(item.FindControl("txt_携帯番号"), TextBox)
                Dim txt_URL As TextBox = CType(item.FindControl("txt_URL"), TextBox)
                Dim txt_講師肩書01 As TextBox = CType(item.FindControl("txt_講師肩書01"), TextBox)
                Dim txt_講師肩書02 As TextBox = CType(item.FindControl("txt_講師肩書02"), TextBox)

                Dim 氏名 As String = txt_氏名.Text
                Dim ふりがな As String = txt_ふりがな.Text
                Dim 性別 As String = ddl_性別.SelectedValue
                Dim 生年月日 As String = txt_生年月日.Text
                Dim 携帯番号 As String = txt_携帯番号.Text
                Dim URL As String = txt_URL.Text
                Dim 講師肩書01 As String = txt_講師肩書01.Text
                Dim 講師肩書02 As String = txt_講師肩書02.Text

                ' 一時保存
                SaveToTemporary(氏名:=氏名, ふりがな:=ふりがな, 性別:=性別, 生年月日:=生年月日, 携帯番号:=携帯番号, URL:=URL, 講師肩書01:=講師肩書01, 講師肩書02:=講師肩書02)

                ' 編集モード解除
                lv_基本情報.EditIndex = -1
                BindListView(lv_基本情報)

            Catch ex As Exception
                ' エラー処理
                Dim mes = ex.Message
            End Try
        End If
    End Sub
    Protected Sub lv_基本情報_ItemDataBound(sender As Object, e As ListViewItemEventArgs) Handles lv_基本情報.ItemDataBound
        If e.Item.ItemType = ListViewItemType.DataItem Then
            Dim dataItem As ListViewDataItem = DirectCast(e.Item, ListViewDataItem)

            '編集モード時 DDL作成
            If lv_基本情報.EditIndex = dataItem.DisplayIndex Then
                Dim ddl_性別 As DropDownList = DirectCast(e.Item.FindControl("ddl_性別"), DropDownList)
                Dim data As DataRowView = DirectCast(dataItem.DataItem, DataRowView)

                ddl_性別.DataSource = Com_Get_変数TABLE("性")
                ddl_性別.DataTextField = "内容"
                ddl_性別.DataValueField = "内容"
                ddl_性別.DataBind()
                ' 空行
                ddl_性別.Items.Insert(0, New ListItem("", ""))

                If Not IsDBNull(data("性別")) Then
                    ddl_性別.SelectedValue = Convert.ToString(data("性別"))
                End If
            End If
        End If
    End Sub
    Protected Sub lv_勤務先_ItemEditing(sender As Object, e As ListViewEditEventArgs) Handles lv_勤務先.ItemEditing
        lv_勤務先.EditIndex = e.NewEditIndex
        BindListView(lv_勤務先)
    End Sub
    Protected Sub lv_勤務先_ItemCanceling(ByVal sender As Object, ByVal e As ListViewCancelEventArgs) Handles lv_勤務先.ItemCanceling
        lv_勤務先.EditIndex = -1
        BindListView(lv_勤務先)
    End Sub
    Protected Sub lv_勤務先_ItemCommand(sender As Object, e As ListViewCommandEventArgs) Handles lv_勤務先.ItemCommand
        If e.CommandName = "cmd_Update" Then '更新ボタン
            Try
                Dim item As ListViewItem = CType(e.Item, ListViewItem)
                Dim txt_郵便1 As TextBox = CType(item.FindControl("txt_勤務先郵便1"), TextBox)
                Dim txt_郵便2 As TextBox = CType(item.FindControl("txt_勤務先郵便2"), TextBox)
                Dim txt_住所01 As TextBox = CType(item.FindControl("txt_勤務先住所01"), TextBox)
                Dim txt_住所02 As TextBox = CType(item.FindControl("txt_勤務先住所02"), TextBox)
                Dim txt_住所03 As TextBox = CType(item.FindControl("txt_勤務先住所03"), TextBox)
                Dim txt_EMAIL As TextBox = CType(item.FindControl("txt_勤務先EMAIL"), TextBox)
                Dim txt_TEL As TextBox = CType(item.FindControl("txt_勤務先TEL"), TextBox)
                Dim txt_FAX As TextBox = CType(item.FindControl("txt_勤務先FAX"), TextBox)

                Dim 郵便 As String = txt_郵便1.Text & txt_郵便2.Text
                Dim 住所01 As String = txt_住所01.Text
                Dim 住所02 As String = txt_住所02.Text
                Dim 住所03 As String = txt_住所03.Text
                Dim EMAIL As String = txt_EMAIL.Text
                Dim TEL As String = txt_TEL.Text
                Dim FAX As String = txt_FAX.Text

                ' 一時保存
                SaveToTemporary(勤務先郵便:=郵便, 勤務先住所01:=住所01, 勤務先住所02:=住所02, 勤務先住所03:=住所03, 勤務先EMAIL:=EMAIL, 勤務先TEL:=TEL, 勤務先FAX:=FAX)

                ' 編集モード解除
                lv_勤務先.EditIndex = -1
                BindListView(lv_勤務先)

            Catch ex As Exception
                ' エラー処理
                Dim mes = ex.Message
            End Try
        End If
    End Sub
    Protected Sub lv_自宅_ItemEditing(sender As Object, e As ListViewEditEventArgs) Handles lv_自宅.ItemEditing
        lv_自宅.EditIndex = e.NewEditIndex
        BindListView(lv_自宅)
    End Sub
    Protected Sub lv_自宅_ItemCanceling(ByVal sender As Object, ByVal e As ListViewCancelEventArgs) Handles lv_自宅.ItemCanceling
        lv_自宅.EditIndex = -1
        BindListView(lv_自宅)
    End Sub
    Protected Sub lv_自宅_ItemCommand(sender As Object, e As ListViewCommandEventArgs) Handles lv_自宅.ItemCommand
        If e.CommandName = "cmd_Update" Then '更新ボタン
            Try
                Dim item As ListViewItem = CType(e.Item, ListViewItem)
                Dim txt_郵便1 As TextBox = CType(item.FindControl("txt_自宅郵便1"), TextBox)
                Dim txt_郵便2 As TextBox = CType(item.FindControl("txt_自宅郵便2"), TextBox)
                Dim txt_住所01 As TextBox = CType(item.FindControl("txt_自宅住所01"), TextBox)
                Dim txt_住所02 As TextBox = CType(item.FindControl("txt_自宅住所02"), TextBox)
                Dim txt_住所03 As TextBox = CType(item.FindControl("txt_自宅住所03"), TextBox)
                Dim txt_EMAIL As TextBox = CType(item.FindControl("txt_自宅EMAIL"), TextBox)
                Dim txt_TEL As TextBox = CType(item.FindControl("txt_自宅TEL"), TextBox)
                Dim txt_FAX As TextBox = CType(item.FindControl("txt_自宅FAX"), TextBox)

                Dim 郵便 As String = txt_郵便1.Text & txt_郵便2.Text
                Dim 住所01 As String = txt_住所01.Text
                Dim 住所02 As String = txt_住所02.Text
                Dim 住所03 As String = txt_住所03.Text
                Dim EMAIL As String = txt_EMAIL.Text
                Dim TEL As String = txt_TEL.Text
                Dim FAX As String = txt_FAX.Text

                ' 一時保存
                SaveToTemporary(自宅郵便:=郵便, 自宅住所01:=住所01, 自宅住所02:=住所02, 自宅住所03:=住所03, 自宅EMAIL:=EMAIL, 自宅TEL:=TEL, 自宅FAX:=FAX)

                ' 編集モード解除
                lv_自宅.EditIndex = -1
                BindListView(lv_自宅)

            Catch ex As Exception
                ' エラー処理
                Dim mes = ex.Message
            End Try
        End If
    End Sub
    Protected Sub lv_その他_ItemEditing(sender As Object, e As ListViewEditEventArgs) Handles lv_その他.ItemEditing
        lv_その他.EditIndex = e.NewEditIndex
        BindListView(lv_その他)
    End Sub
    Protected Sub lv_その他_ItemCanceling(ByVal sender As Object, ByVal e As ListViewCancelEventArgs) Handles lv_その他.ItemCanceling
        lv_その他.EditIndex = -1
        BindListView(lv_その他)
    End Sub
    Protected Sub lv_その他_ItemCommand(sender As Object, e As ListViewCommandEventArgs) Handles lv_その他.ItemCommand
        If e.CommandName = "cmd_Update" Then '更新ボタン
            Try
                Dim item As ListViewItem = CType(e.Item, ListViewItem)
                Dim txt_郵便1 As TextBox = CType(item.FindControl("txt_他郵便1"), TextBox)
                Dim txt_郵便2 As TextBox = CType(item.FindControl("txt_他郵便2"), TextBox)
                Dim txt_住所01 As TextBox = CType(item.FindControl("txt_他住所01"), TextBox)
                Dim txt_住所02 As TextBox = CType(item.FindControl("txt_他住所02"), TextBox)
                Dim txt_住所03 As TextBox = CType(item.FindControl("txt_他住所03"), TextBox)
                Dim txt_TEL As TextBox = CType(item.FindControl("txt_他TEL"), TextBox)
                Dim txt_FAX As TextBox = CType(item.FindControl("txt_他FAX"), TextBox)

                Dim 郵便 As String = txt_郵便1.Text & txt_郵便2.Text
                Dim 住所01 As String = txt_住所01.Text
                Dim 住所02 As String = txt_住所02.Text
                Dim 住所03 As String = txt_住所03.Text
                Dim TEL As String = txt_TEL.Text
                Dim FAX As String = txt_FAX.Text

                ' 一時保存
                SaveToTemporary(他郵便:=郵便, 他住所01:=住所01, 他住所02:=住所02, 他住所03:=住所03, 他TEL:=TEL, 他FAX:=FAX)

                ' 編集モード解除
                lv_その他.EditIndex = -1
                BindListView(lv_その他)

            Catch ex As Exception
                ' エラー処理
                Dim mes = ex.Message
            End Try
        End If
    End Sub
    Protected Sub lv_個人支払先_ItemEditing(sender As Object, e As ListViewEditEventArgs) Handles lv_個人支払先.ItemEditing
        lv_個人支払先.EditIndex = e.NewEditIndex
        BindListView(lv_個人支払先)
    End Sub
    Protected Sub lv_個人支払先_ItemCanceling(ByVal sender As Object, ByVal e As ListViewCancelEventArgs) Handles lv_個人支払先.ItemCanceling
        lv_個人支払先.EditIndex = -1
        BindListView(lv_個人支払先)
    End Sub
    Protected Sub lv_個人支払先_ItemCommand(sender As Object, e As ListViewCommandEventArgs) Handles lv_個人支払先.ItemCommand
        If e.CommandName = "cmd_Update" Then '更新ボタン
            Try
                Dim item As ListViewItem = CType(e.Item, ListViewItem)
                Dim txt_銀行CD As TextBox = CType(item.FindControl("txt_個銀行CD"), TextBox)
                Dim txt_銀行名 As TextBox = CType(item.FindControl("txt_個銀行名"), TextBox)
                Dim txt_支店CD As TextBox = CType(item.FindControl("txt_個支店CD"), TextBox)
                Dim txt_支店名 As TextBox = CType(item.FindControl("txt_個支店名"), TextBox)
                Dim txt_口座種別 As TextBox = CType(item.FindControl("txt_個口座種別"), TextBox)
                Dim ddl_口座種別 As DropDownList = CType(item.FindControl("ddl_個口座種別"), DropDownList)
                Dim txt_口座番号 As TextBox = CType(item.FindControl("txt_個口座番号"), TextBox)
                Dim txt_名義カナ As TextBox = CType(item.FindControl("txt_個名義カナ"), TextBox)
                Dim ddl_事業者種別 As DropDownList = CType(item.FindControl("ddl_個事業者種別"), DropDownList)
                Dim txt_登録番号 As TextBox = CType(item.FindControl("txt_個登録番号"), TextBox)
                Dim lbl_登録番号Mes As Label = CType(item.FindControl("lbl_登録番号Mes"), Label)

                Dim chk_変更01 As CheckBox = CType(item.FindControl("chk_変更01"), CheckBox)
                Dim chk_変更02 As CheckBox = CType(item.FindControl("chk_変更02"), CheckBox)
                Dim chk_変更03 As CheckBox = CType(item.FindControl("chk_変更03"), CheckBox)

                Dim 銀行CD As String = txt_銀行CD.Text
                Dim 銀行名 As String = txt_銀行名.Text
                Dim 支店CD As String = txt_支店CD.Text
                Dim 支店名 As String = txt_支店名.Text
                Dim 口座種別 As String = ddl_口座種別.SelectedValue
                Dim 口座番号 As String = txt_口座番号.Text
                Dim 名義カナ As String = txt_名義カナ.Text
                Dim 事業者種別 As String = ddl_事業者種別.SelectedValue
                Dim 登録番号 As String = txt_登録番号.Text

                ' 一時保存
                Dim chkVal01 As Boolean = chk_変更01.Checked
                Dim chkVal02 As Boolean = chk_変更02.Checked
                Dim chkVal03 As Boolean = chk_変更03.Checked

                lbl_登録番号Mes.Visible = False
                lbl_登録番号Mes.Text = ""

                If chkVal02 And chkVal03 AndAlso 事業者種別 = "課税事業者" And String.IsNullOrEmpty(登録番号) Then
                    lbl_登録番号Mes.Text = "課税事業者の方は登録番号を入力してください。"
                    lbl_登録番号Mes.Visible = True
                End If

                ' 一時保存
                If chkVal01 Then
                    SaveToTemporary(個銀行CD:=銀行CD, 個銀行名:=銀行名)
                End If
                If chkVal02 Then
                    SaveToTemporary(個支店CD:=支店CD, 個支店名:=支店名, 個種目:=口座種別, 個口座NO:=口座番号, 個口座名カナ:=名義カナ, 個事業者種別:=事業者種別)
                End If
                If chkVal03 Then
                    SaveToTemporary(個登録番号:=登録番号)
                End If

                ' 編集モード解除
                lv_個人支払先.EditIndex = -1
                BindListView(lv_個人支払先)

            Catch ex As Exception
                ' エラー処理
                Dim mes = ex.Message
            End Try
        End If
    End Sub
    Protected Sub lv_個人支払先_ItemDataBound(sender As Object, e As ListViewItemEventArgs) Handles lv_個人支払先.ItemDataBound
        If e.Item.ItemType = ListViewItemType.DataItem Then

            Dim dataItem As ListViewDataItem = DirectCast(e.Item, ListViewDataItem)

            '編集モード時 DDL作成
            If lv_個人支払先.EditIndex = dataItem.DisplayIndex Then
                Dim ddl_個口座種別 As DropDownList = DirectCast(e.Item.FindControl("ddl_個口座種別"), DropDownList)
                Dim ddl_個事業者種別 As DropDownList = DirectCast(e.Item.FindControl("ddl_個事業者種別"), DropDownList)

                ddl_個口座種別.DataSource = GetDDLData("口座種別")
                ddl_個口座種別.DataTextField = "内容"
                ddl_個口座種別.DataValueField = "内容"
                ddl_個口座種別.DataBind()
                ' 空行
                ddl_個口座種別.Items.Insert(0, New ListItem("", ""))

                ddl_個事業者種別.DataSource = GetDDLData("事業者種別")
                ddl_個事業者種別.DataTextField = "内容"
                ddl_個事業者種別.DataValueField = "内容"
                ddl_個事業者種別.DataBind()
                ' 空行
                ddl_個事業者種別.Items.Insert(0, New ListItem("", ""))
            End If
        End If
    End Sub
    Protected Sub btn_個支店検索_Click(sender As Object, e As EventArgs)
        ' 送信元のボタンから、親のListViewItemを取得
        Dim btn As Button = CType(sender, Button)
        Dim item As ListViewItem = CType(btn.NamingContainer, ListViewItem)

        ' 同じアイテム内のコントロールを取得
        Dim txtBankCD As TextBox = CType(item.FindControl("txt_個銀行CD"), TextBox)
        Dim ucSearchBranch As uc_SearchBranchCd = CType(item.FindControl("uc_SearchBranchCd個"), uc_SearchBranchCd)
        Dim modalPopup As AjaxControlToolkit.ModalPopupExtender = CType(item.FindControl("ModalPopupBranch個"), AjaxControlToolkit.ModalPopupExtender)

        If String.IsNullOrEmpty(txtBankCD.Text) Then
            ScriptManager.RegisterStartupScript(Me, Me.GetType(), "alert", "alert('先に銀行を選択してください');", True)
            Return
        End If

        ' ユーザーコントロールを初期化
        ucSearchBranch.Initialize(txtBankCD.Text)

        ' モーダルを表示
        modalPopup.Show()
    End Sub
    Protected Sub lv_法人支払先_ItemEditing(sender As Object, e As ListViewEditEventArgs) Handles lv_法人支払先.ItemEditing
        lv_法人支払先.EditIndex = e.NewEditIndex
        BindListView(lv_法人支払先)
    End Sub
    Protected Sub lv_法人支払先_ItemCanceling(ByVal sender As Object, ByVal e As ListViewCancelEventArgs) Handles lv_法人支払先.ItemCanceling
        lv_法人支払先.EditIndex = -1
        BindListView(lv_法人支払先)
    End Sub
    Protected Sub lv_法人支払先_ItemCommand(sender As Object, e As ListViewCommandEventArgs) Handles lv_法人支払先.ItemCommand
        If e.CommandName = "cmd_Update" Then '更新ボタン
            Try
                Dim item As ListViewItem = CType(e.Item, ListViewItem)
                Dim txt_銀行CD As TextBox = CType(item.FindControl("txt_法銀行CD"), TextBox)
                Dim txt_銀行名 As TextBox = CType(item.FindControl("txt_法銀行名"), TextBox)
                Dim txt_支店CD As TextBox = CType(item.FindControl("txt_法支店CD"), TextBox)
                Dim txt_支店名 As TextBox = CType(item.FindControl("txt_法支店名"), TextBox)
                Dim ddl_口座種別 As DropDownList = CType(item.FindControl("ddl_法口座種別"), DropDownList)
                Dim txt_口座番号 As TextBox = CType(item.FindControl("txt_法口座番号"), TextBox)
                Dim txt_名義カナ As TextBox = CType(item.FindControl("txt_法名義カナ"), TextBox)
                Dim ddl_事業者種別 As DropDownList = CType(item.FindControl("ddl_法事業者種別"), DropDownList)
                Dim txt_登録番号 As TextBox = CType(item.FindControl("txt_法登録番号"), TextBox)

                Dim chk_変更01 As CheckBox = CType(item.FindControl("chk_変更01"), CheckBox)
                Dim chk_変更02 As CheckBox = CType(item.FindControl("chk_変更02"), CheckBox)
                Dim chk_変更03 As CheckBox = CType(item.FindControl("chk_変更03"), CheckBox)


                Dim 銀行CD As String = txt_銀行CD.Text
                Dim 銀行名 As String = txt_銀行名.Text
                Dim 支店CD As String = txt_支店CD.Text
                Dim 支店名 As String = txt_支店名.Text
                Dim 口座種別 As String = ddl_口座種別.SelectedValue
                Dim 口座番号 As String = txt_口座番号.Text
                Dim 名義カナ As String = txt_名義カナ.Text
                Dim 事業者種別 As String = ddl_事業者種別.SelectedValue
                Dim 登録番号 As String = txt_登録番号.Text

                Dim chkVal01 As Boolean = chk_変更01.Checked
                Dim chkVal02 As Boolean = chk_変更02.Checked
                Dim chkVal03 As Boolean = chk_変更03.Checked
                ' 一時保存
                If chkVal01 Then
                    SaveToTemporary(法銀行CD:=銀行CD, 法銀行名:=銀行名)
                End If
                If chkVal02 Then
                    SaveToTemporary(法支店CD:=支店CD, 法支店名:=支店名, 法種目:=口座種別, 法口座NO:=口座番号, 法口座名カナ:=名義カナ, 法事業者種別:=事業者種別)
                End If
                If chkVal03 Then
                    SaveToTemporary(法登録番号:=登録番号)
                End If
                ' 編集モード解除
                lv_法人支払先.EditIndex = -1
                BindListView(lv_法人支払先)

            Catch ex As Exception
                ' エラー処理
                Dim mes = ex.Message
            End Try
        End If
    End Sub
    Protected Sub lv_法人支払先_ItemDataBound(sender As Object, e As ListViewItemEventArgs) Handles lv_法人支払先.ItemDataBound
        If e.Item.ItemType = ListViewItemType.DataItem Then
            Dim dataItem As ListViewDataItem = DirectCast(e.Item, ListViewDataItem)

            '編集モード時 DDL作成
            If lv_法人支払先.EditIndex = dataItem.DisplayIndex Then
                Dim ddl_法口座種別 As DropDownList = DirectCast(e.Item.FindControl("ddl_法口座種別"), DropDownList)
                Dim ddl_法事業者種別 As DropDownList = DirectCast(e.Item.FindControl("ddl_法事業者種別"), DropDownList)

                ddl_法口座種別.DataSource = GetDDLData("口座種別")
                ddl_法口座種別.DataTextField = "内容"
                ddl_法口座種別.DataValueField = "内容"
                ddl_法口座種別.DataBind()
                ' 空行
                ddl_法口座種別.Items.Insert(0, New ListItem("", ""))

                ddl_法事業者種別.DataSource = GetDDLData("事業者種別")
                ddl_法事業者種別.DataTextField = "内容"
                ddl_法事業者種別.DataValueField = "内容"
                ddl_法事業者種別.DataBind()
                ' 空行
                ddl_法事業者種別.Items.Insert(0, New ListItem("", ""))

            End If
        End If
    End Sub
    Protected Sub btn_法支店検索_Click(sender As Object, e As EventArgs)
        Dim btn As Button = CType(sender, Button)
        Dim item As ListViewItem = CType(btn.NamingContainer, ListViewItem)
        Dim txtBankCD As TextBox = CType(item.FindControl("txt_法銀行CD"), TextBox)
        Dim bankCode As String = txtBankCD.Text
        Dim ucSearchBranch As uc_SearchBranchCd = CType(item.FindControl("uc_SearchBranchCd法"), uc_SearchBranchCd)
        Dim modalPopup As AjaxControlToolkit.ModalPopupExtender = CType(item.FindControl("ModalPopupBranch法"), AjaxControlToolkit.ModalPopupExtender)

        If String.IsNullOrEmpty(bankCode) AndAlso item.DataItem IsNot Nothing Then
            bankCode = DataBinder.Eval(item.DataItem, "法銀行CD").ToString()
        End If

        If String.IsNullOrEmpty(bankCode) Then
            ScriptManager.RegisterStartupScript(Me, Me.GetType(), "alert", "alert('先に銀行を選択してください');", True)
            Return
        End If

        ucSearchBranch.Initialize(bankCode)
        modalPopup.Show()
    End Sub
    Protected Sub lv_支払先口座_ItemEditing(sender As Object, e As ListViewEditEventArgs) Handles lv_支払先口座.ItemEditing
        lv_支払先口座.EditIndex = e.NewEditIndex
        BindListView(lv_支払先口座)
    End Sub
    Protected Sub lv_支払先口座_ItemCanceling(ByVal sender As Object, ByVal e As ListViewCancelEventArgs) Handles lv_支払先口座.ItemCanceling
        lv_支払先口座.EditIndex = -1
        BindListView(lv_支払先口座)
    End Sub
    Protected Sub lv_支払先口座_ItemCommand(sender As Object, e As ListViewCommandEventArgs) Handles lv_支払先口座.ItemCommand
        If e.CommandName = "cmd_Update" Then '更新ボタン
            Try
                Dim item As ListViewItem = CType(e.Item, ListViewItem)
                Dim ddl_謝金 As DropDownList = CType(item.FindControl("ddl_謝金支払先"), DropDownList)
                Dim ddl_旅費 As DropDownList = CType(item.FindControl("ddl_旅費支払先"), DropDownList)

                Dim 謝金支払先 As String = ddl_謝金.SelectedValue
                Dim 旅費支払先 As String = ddl_旅費.SelectedValue

                ' 一時保存
                SaveToTemporary(謝金支払先:=謝金支払先, 旅費支払先:=旅費支払先)

                ' 編集モード解除
                lv_支払先口座.EditIndex = -1
                BindListView(lv_支払先口座)

            Catch ex As Exception
                ' エラー処理
                Dim mes = ex.Message
            End Try
        End If
    End Sub
    Protected Sub lv_支払先口座_ItemDataBound(sender As Object, e As ListViewItemEventArgs) Handles lv_支払先口座.ItemDataBound
        If e.Item.ItemType = ListViewItemType.DataItem Then
            Dim dataItem As ListViewDataItem = DirectCast(e.Item, ListViewDataItem)

            '編集モード時 DDL作成
            If lv_支払先口座.EditIndex = dataItem.DisplayIndex Then
                Dim ddl_謝金 As DropDownList = DirectCast(e.Item.FindControl("ddl_謝金支払先"), DropDownList)
                Dim ddl_旅費 As DropDownList = DirectCast(e.Item.FindControl("ddl_旅費支払先"), DropDownList)
                Dim data As DataRowView = DirectCast(dataItem.DataItem, DataRowView)

                ddl_謝金.DataSource = GetDDLData("支払先")
                ddl_謝金.DataTextField = "内容"
                ddl_謝金.DataValueField = "内容"
                ddl_謝金.DataBind()
                ' 空行
                ddl_謝金.Items.Insert(0, New ListItem("", ""))

                If Not IsDBNull(data("支払先")) Then
                    ddl_謝金.SelectedValue = Convert.ToString(data("支払先"))
                End If

                ddl_旅費.DataSource = GetDDLData("支払先")
                ddl_旅費.DataTextField = "内容"
                ddl_旅費.DataValueField = "内容"
                ddl_旅費.DataBind()
                ' 空行
                ddl_旅費.Items.Insert(0, New ListItem("", ""))

                If Not IsDBNull(data("旅費支払先")) Then
                    ddl_旅費.SelectedValue = Convert.ToString(data("旅費支払先"))
                End If
            End If
        End If
    End Sub
    Protected Sub lv_プロフ_ItemEditing(sender As Object, e As ListViewEditEventArgs) Handles lv_プロフ.ItemEditing
        lv_プロフ.EditIndex = e.NewEditIndex
        BindListView(lv_プロフ)
    End Sub
    Protected Sub lv_プロフ_ItemCanceling(ByVal sender As Object, ByVal e As ListViewCancelEventArgs) Handles lv_プロフ.ItemCanceling
        lv_プロフ.EditIndex = -1
        BindListView(lv_プロフ)
    End Sub
    Protected Sub lv_プロフ_ItemCommand(sender As Object, e As ListViewCommandEventArgs) Handles lv_プロフ.ItemCommand
        If e.CommandName = "cmd_Update" Then '更新ボタン
            Try
                Dim item As ListViewItem = CType(e.Item, ListViewItem)
                Dim txt_最終学歴 As TextBox = CType(item.FindControl("txt_最終学歴"), TextBox)
                Dim txt_経歴 As TextBox = CType(item.FindControl("txt_経歴"), TextBox)
                Dim txt_著作01 As TextBox = CType(item.FindControl("txt_著作01"), TextBox)
                Dim txt_著作02 As TextBox = CType(item.FindControl("txt_著作02"), TextBox)
                Dim txt_著作03 As TextBox = CType(item.FindControl("txt_著作03"), TextBox)
                Dim txt_著作04 As TextBox = CType(item.FindControl("txt_著作04"), TextBox)
                Dim txt_著作05 As TextBox = CType(item.FindControl("txt_著作05"), TextBox)
                Dim txt_著作06 As TextBox = CType(item.FindControl("txt_著作06"), TextBox)
                Dim txt_著作07 As TextBox = CType(item.FindControl("txt_著作07"), TextBox)
                Dim txt_著作08 As TextBox = CType(item.FindControl("txt_著作08"), TextBox)
                Dim txt_著作09 As TextBox = CType(item.FindControl("txt_著作09"), TextBox)
                Dim txt_著作10 As TextBox = CType(item.FindControl("txt_著作10"), TextBox)

                Dim 最終学歴 As String = txt_最終学歴.Text
                Dim 経歴 As String = txt_経歴.Text
                Dim 著作01 As String = txt_著作01.Text
                Dim 著作02 As String = txt_著作02.Text
                Dim 著作03 As String = txt_著作03.Text
                Dim 著作04 As String = txt_著作04.Text
                Dim 著作05 As String = txt_著作05.Text
                Dim 著作06 As String = txt_著作06.Text
                Dim 著作07 As String = txt_著作07.Text
                Dim 著作08 As String = txt_著作08.Text
                Dim 著作09 As String = txt_著作09.Text
                Dim 著作10 As String = txt_著作10.Text

                ' 一時保存
                SaveToTemporary(最終学歴:=最終学歴, 経歴:=経歴, 著作01:=著作01, 著作02:=著作02, 著作03:=著作03, 著作04:=著作04, 著作05:=著作05, 著作06:=著作06, 著作07:=著作07, 著作08:=著作08, 著作09:=著作09, 著作10:=著作10)

                ' 編集モード解除
                lv_プロフ.EditIndex = -1
                BindListView(lv_プロフ)

            Catch ex As Exception
                ' エラー処理
                Dim mes = ex.Message
            End Try
        End If
    End Sub
    Protected Sub btn_戻る_Click(ByVal sender As Object, ByVal e As EventArgs)
        'ページ遷移
        Response.Redirect(Com_Get_Content("menu_ks_001"))
    End Sub
    Protected Sub btn_提出_Click(ByVal sender As Object, ByVal e As EventArgs)

        '必須項目チェック
        'Dim errMes As String = GetErrMes()
        Dim errMes As String = String.Empty 'エラーチェックはなしとする 20260227 S.Iguchi

        If Not String.IsNullOrEmpty(errMes) Then
            lbl_errMes.Text = errMes
            lbl_errMes.Visible = True
            Return
        End If
        lbl_errMes.Visible = False

        'データ登録と一時保存データの削除
        Try
            '提出日時の更新
            RegistTeacherProf()

            '研修担当職員IDの取得
            Dim lbl As Label = CType(lv_基本情報.Items(0).FindControl("lbl_担当教職員ID01"), Label)
            Dim 教職員ID01 As String = lbl.Text
            'PKeyの取得
            Dim lbl_履修年度 As Label = CType(lv_基本情報.Items(0).FindControl("lbl_履修年度"), Label)
            Dim lbl_成績年度 As Label = CType(lv_基本情報.Items(0).FindControl("lbl_成績年度"), Label)
            Dim lbl_分野CD As Label = CType(lv_基本情報.Items(0).FindControl("lbl_分野CD"), Label)
            Dim lbl_科目CD As Label = CType(lv_基本情報.Items(0).FindControl("lbl_科目CD"), Label)
            Dim lbl_講座CD As Label = CType(lv_基本情報.Items(0).FindControl("lbl_講座CD"), Label)
            Dim userCd As String = Session(S_COM_UserCD)

            Dim 出講師PKey As String = lbl_履修年度.Text & "_" & lbl_成績年度.Text & "_" & lbl_分野CD.Text & "_" & lbl_科目CD.Text & "_" & lbl_講座CD.Text & "_" & userCd
            'メール送信
            If Not String.IsNullOrEmpty(教職員ID01) Then
                AppMail.SendUpdateTeacherProfMail(教職員ID01, userCd, 出講師PKey)
            End If
            lbl = CType(lv_基本情報.Items(0).FindControl("lbl_担当教職員ID02"), Label)
            Dim 教職員ID02 As String = lbl.Text
            If Not String.IsNullOrEmpty(教職員ID02) Then
                AppMail.SendUpdateTeacherProfMail(教職員ID02, userCd, 出講師PKey)
            End If

            If String.IsNullOrEmpty(教職員ID01) And String.IsNullOrEmpty(教職員ID02) Then
                Dim defaultStaff As String = Com_Get_変数("PT_QA_TO_DEFAULT_USERCD") '送信先デフォルトユーザ
                AppMail.SendUpdateTeacherProfMail(defaultStaff, userCd, 出講師PKey)
            End If

            DisabledButton(btn_提出)
            '各編集ボタンも無効化
            AllListViewOff()

            'メッセージの表示
            Dim script As String = "alert('プロフィールを提出しました。');"
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), script, True)
            lbl_errMes.Text = "プロフィールは既に提出済みです。"
            lbl_errMes.Visible = True
        Catch ex As Exception
            lbl_errMes.Text = "提出に失敗しました。"
            lbl_errMes.Visible = True
        End Try

    End Sub
#End Region

#Region "******************* Sub及びFunction ********************"

    Function GetData() As DataTable
        Using spm As New StoredProcedureManager("連絡票_TMP講師貼付_SELECT")
            spm.AddPrmIn("@USERCD", Data.SqlDbType.VarChar, 20, Session(S_COM_UserCD))
            spm.AddPrmIn("@CNT", Data.SqlDbType.Int, Session(S_TeacherProf_Selected_ID))
            spm.Fill()

            Dim dt As DataTable = spm.ds.Tables(0)

            Return dt

        End Using
    End Function
    ' ========================================
    ' 一時保存処理（共通）
    ' ========================================
    Private Sub SaveToTemporary(
    Optional 氏名 As String = Nothing,
    Optional ふりがな As String = Nothing,
    Optional 性別 As String = Nothing,
    Optional 生年月日 As String = Nothing,
    Optional 携帯番号 As String = Nothing,
    Optional URL As String = Nothing,
    Optional 講師肩書01 As String = Nothing,
    Optional 講師肩書02 As String = Nothing,
    Optional 勤務先郵便 As String = Nothing,
    Optional 勤務先住所01 As String = Nothing,
    Optional 勤務先住所02 As String = Nothing,
    Optional 勤務先住所03 As String = Nothing,
    Optional 勤務先EMAIL As String = Nothing,
    Optional 勤務先TEL As String = Nothing,
    Optional 勤務先FAX As String = Nothing,
    Optional 自宅郵便 As String = Nothing,
    Optional 自宅住所01 As String = Nothing,
    Optional 自宅住所02 As String = Nothing,
    Optional 自宅住所03 As String = Nothing,
    Optional 自宅EMAIL As String = Nothing,
    Optional 自宅TEL As String = Nothing,
    Optional 自宅FAX As String = Nothing,
    Optional 他郵便 As String = Nothing,
    Optional 他住所01 As String = Nothing,
    Optional 他住所02 As String = Nothing,
    Optional 他住所03 As String = Nothing,
    Optional 他TEL As String = Nothing,
    Optional 他FAX As String = Nothing,
    Optional 個銀行CD As String = Nothing,
    Optional 個銀行名 As String = Nothing,
    Optional 個支店CD As String = Nothing,
    Optional 個支店名 As String = Nothing,
    Optional 個種目 As String = Nothing,
    Optional 個口座NO As String = Nothing,
    Optional 個口座名カナ As String = Nothing,
    Optional 個事業者種別 As String = Nothing,
    Optional 個登録番号 As String = Nothing,
    Optional 法銀行CD As String = Nothing,
    Optional 法銀行名 As String = Nothing,
    Optional 法支店CD As String = Nothing,
    Optional 法支店名 As String = Nothing,
    Optional 法種目 As String = Nothing,
    Optional 法口座NO As String = Nothing,
    Optional 法口座名カナ As String = Nothing,
    Optional 法事業者種別 As String = Nothing,
    Optional 法登録番号 As String = Nothing,
    Optional 謝金支払先 As String = Nothing,
    Optional 旅費支払先 As String = Nothing,
    Optional 最終学歴 As String = Nothing,
    Optional 経歴 As String = Nothing,
    Optional 著作01 As String = Nothing,
    Optional 著作02 As String = Nothing,
    Optional 著作03 As String = Nothing,
    Optional 著作04 As String = Nothing,
    Optional 著作05 As String = Nothing,
    Optional 著作06 As String = Nothing,
    Optional 著作07 As String = Nothing,
    Optional 著作08 As String = Nothing,
    Optional 著作09 As String = Nothing,
    Optional 著作10 As String = Nothing
)
        Using spm As New StoredProcedureManager("連絡票_TMP講師貼付_UPDATE")
            spm.AddPrmIn("@USERCD", Data.SqlDbType.VarChar, 20, Session(S_COM_UserCD))
            spm.AddPrmIn("@CNT", Data.SqlDbType.Int, Session(S_TeacherProf_Selected_ID))
            '基本情報
            spm.AddPrmIn("@氏名", Data.SqlDbType.NVarChar, 50, ToDbValue(氏名))
            spm.AddPrmIn("@ふりがな", Data.SqlDbType.NVarChar, 50, ToDbValue(ふりがな))
            spm.AddPrmIn("@性別", Data.SqlDbType.VarChar, 20, ToDbValue(性別))
            spm.AddPrmIn("@生年月日", Data.SqlDbType.DateTime, ToDbDate(生年月日))
            spm.AddPrmIn("@携帯番号", Data.SqlDbType.VarChar, 30, ToDbValue(携帯番号))
            spm.AddPrmIn("@URL", Data.SqlDbType.VarChar, 4000, ToDbValue(URL))
            spm.AddPrmIn("@講師肩書01", Data.SqlDbType.VarChar, 500, ToDbValue(講師肩書01))
            spm.AddPrmIn("@講師肩書02", Data.SqlDbType.VarChar, 500, ToDbValue(講師肩書02))
            '勤務先
            spm.AddPrmIn("@勤務先郵便", Data.SqlDbType.VarChar, 20, ToDbValue(勤務先郵便))
            spm.AddPrmIn("@勤務先住所01", Data.SqlDbType.VarChar, 10, ToDbValue(勤務先住所01))
            spm.AddPrmIn("@勤務先住所02", Data.SqlDbType.VarChar, 120, ToDbValue(勤務先住所02))
            spm.AddPrmIn("@勤務先住所03", Data.SqlDbType.VarChar, 120, ToDbValue(勤務先住所03))
            spm.AddPrmIn("@勤務先EMAIL", Data.SqlDbType.VarChar, 100, ToDbValue(勤務先EMAIL))
            spm.AddPrmIn("@勤務先TEL", Data.SqlDbType.VarChar, 20, ToDbValue(勤務先TEL))
            spm.AddPrmIn("@勤務先FAX", Data.SqlDbType.VarChar, 20, ToDbValue(勤務先FAX))
            '自宅
            spm.AddPrmIn("@自宅郵便", Data.SqlDbType.VarChar, 7, ToDbValue(自宅郵便))
            spm.AddPrmIn("@自宅住所01", Data.SqlDbType.VarChar, 10, ToDbValue(自宅住所01))
            spm.AddPrmIn("@自宅住所02", Data.SqlDbType.VarChar, 120, ToDbValue(自宅住所02))
            spm.AddPrmIn("@自宅住所03", Data.SqlDbType.VarChar, 120, ToDbValue(自宅住所03))
            spm.AddPrmIn("@自宅EMAIL", Data.SqlDbType.VarChar, 100, ToDbValue(自宅EMAIL))
            spm.AddPrmIn("@自宅TEL", Data.SqlDbType.VarChar, 20, ToDbValue(自宅TEL))
            spm.AddPrmIn("@自宅FAX", Data.SqlDbType.VarChar, 20, ToDbValue(自宅FAX))
            'その他
            spm.AddPrmIn("@他郵便", Data.SqlDbType.VarChar, 7, ToDbValue(他郵便))
            spm.AddPrmIn("@他住所01", Data.SqlDbType.NVarChar, 50, ToDbValue(他住所01))
            spm.AddPrmIn("@他住所02", Data.SqlDbType.NVarChar, 50, ToDbValue(他住所02))
            spm.AddPrmIn("@他住所03", Data.SqlDbType.NVarChar, 50, ToDbValue(他住所03))
            spm.AddPrmIn("@他TEL", Data.SqlDbType.VarChar, 20, ToDbValue(他TEL))
            spm.AddPrmIn("@他FAX", Data.SqlDbType.VarChar, 20, ToDbValue(他FAX))
            '個人支払先
            spm.AddPrmIn("@個銀行CD", Data.SqlDbType.VarChar, 20, ToDbValue(個銀行CD))
            spm.AddPrmIn("@個銀行名", Data.SqlDbType.VarChar, 100, ToDbValue(個銀行名))
            spm.AddPrmIn("@個支店CD", Data.SqlDbType.VarChar, 20, ToDbValue(個支店CD))
            spm.AddPrmIn("@個支店名", Data.SqlDbType.VarChar, 100, ToDbValue(個支店名))
            spm.AddPrmIn("@個種目", Data.SqlDbType.VarChar, 20, ToDbValue(個種目))
            spm.AddPrmIn("@個口座NO", Data.SqlDbType.VarChar, 20, ToDbValue(個口座NO))
            spm.AddPrmIn("@個口座名カナ", Data.SqlDbType.NVarChar, 100, ToDbValue(個口座名カナ))
            spm.AddPrmIn("@個事業者種別", Data.SqlDbType.VarChar, 20, ToDbValue(個事業者種別))
            spm.AddPrmIn("@個登録番号", Data.SqlDbType.VarChar, 20, ToDbValue(個登録番号))
            '法人支払先
            spm.AddPrmIn("@法銀行CD", Data.SqlDbType.VarChar, 20, ToDbValue(法銀行CD))
            spm.AddPrmIn("@法銀行名", Data.SqlDbType.VarChar, 100, ToDbValue(法銀行名))
            spm.AddPrmIn("@法支店CD", Data.SqlDbType.VarChar, 20, ToDbValue(法支店CD))
            spm.AddPrmIn("@法支店名", Data.SqlDbType.VarChar, 100, ToDbValue(法支店名))
            spm.AddPrmIn("@法種目", Data.SqlDbType.VarChar, 20, ToDbValue(法種目))
            spm.AddPrmIn("@法口座NO", Data.SqlDbType.VarChar, 20, ToDbValue(法口座NO))
            spm.AddPrmIn("@法口座名カナ", Data.SqlDbType.NVarChar, 100, ToDbValue(法口座名カナ))
            spm.AddPrmIn("@法事業者種別", Data.SqlDbType.VarChar, 20, ToDbValue(法事業者種別))
            spm.AddPrmIn("@法登録番号", Data.SqlDbType.VarChar, 20, ToDbValue(法登録番号))
            '支払先口座
            spm.AddPrmIn("@謝金支払先", Data.SqlDbType.VarChar, 10, ToDbValue(謝金支払先))
            spm.AddPrmIn("@旅費支払先", Data.SqlDbType.VarChar, 10, ToDbValue(旅費支払先))
            'プロフィール
            spm.AddPrmIn("@最終学歴", Data.SqlDbType.VarChar, 100, ToDbValue(最終学歴))
            spm.AddPrmIn("@経歴", Data.SqlDbType.NVarChar, 3000, ToDbValue(経歴))
            spm.AddPrmIn("@著作01", Data.SqlDbType.VarChar, 2000, ToDbValue(著作01))
            spm.AddPrmIn("@著作02", Data.SqlDbType.VarChar, 2000, ToDbValue(著作02))
            spm.AddPrmIn("@著作03", Data.SqlDbType.VarChar, 2000, ToDbValue(著作03))
            spm.AddPrmIn("@著作04", Data.SqlDbType.VarChar, 2000, ToDbValue(著作04))
            spm.AddPrmIn("@著作05", Data.SqlDbType.VarChar, 2000, ToDbValue(著作05))
            spm.AddPrmIn("@著作06", Data.SqlDbType.VarChar, 2000, ToDbValue(著作06))
            spm.AddPrmIn("@著作07", Data.SqlDbType.VarChar, 2000, ToDbValue(著作07))
            spm.AddPrmIn("@著作08", Data.SqlDbType.VarChar, 2000, ToDbValue(著作08))
            spm.AddPrmIn("@著作09", Data.SqlDbType.VarChar, 2000, ToDbValue(著作09))
            spm.AddPrmIn("@著作10", Data.SqlDbType.VarChar, 2000, ToDbValue(著作10))
            spm.Exec()

        End Using
    End Sub

    Private Function GetErrMes() As String
        Dim mes As String = ""
        Using spm As New StoredProcedureManager("連絡票_TMP講師貼付_SELECT")
            spm.AddPrmIn("@USERCD", Data.SqlDbType.VarChar, 20, Session(S_COM_UserCD))
            spm.AddPrmIn("@CNT", Data.SqlDbType.Int, Session(S_TeacherProf_Selected_ID))
            spm.Fill()

            Dim dt As DataTable = spm.ds.Tables(0)

            '基本情報
            mes = addMes(mes, dt, "氏名")
            mes = addMes(mes, dt, "ふりがな")
            mes = addMes(mes, dt, "性別")
            mes = addMes(mes, dt, "生年月日")
            mes = addMes(mes, dt, "携帯番号")
            mes = addMes(mes, dt, "URL")

            '勤務先'自宅　いずれか必須
            mes = addMesAddressInfo(mes, dt)
            '口座情報 個人、法人いずれか必須
            mes = addMesBankInfo(mes, dt)

            '支払先
            mes = addMes(mes, dt, "支払先")
            mes = addMes(mes, dt, "旅費支払先")
            'プロフィール
            mes = addMes(mes, dt, "最終学歴")
            mes = addMes(mes, dt, "経歴")

        End Using
        Return mes
    End Function

    Private Function addMes(mes As String, dt As DataTable, itemName As String) As String
        Dim message As String = mes

        If String.IsNullOrEmpty(Convert.ToString(dt.Rows(0)(itemName))) Then
            message &= itemName & "を入力してください。"
        End If

        Return message
    End Function

    Private Function addMesAddressInfo(mes As String, dt As DataTable) As String
        Dim message As String = mes
        Dim 勤務先未入力FLG As Boolean = False
        Dim 自宅未入力FLG As Boolean = False
        Dim 勤務先郵便 As String = Convert.ToString(dt.Rows(0)("勤務先郵便"))
        Dim 勤務先住所 As String = Convert.ToString(dt.Rows(0)("勤務先住所01")) & Convert.ToString(dt.Rows(0)("勤務先住所02")) & Convert.ToString(dt.Rows(0)("勤務先住所03"))
        Dim 勤務先EMAIL As String = Convert.ToString(dt.Rows(0)("勤務先EMAIL"))
        Dim 勤務先TEL As String = Convert.ToString(dt.Rows(0)("勤務先TEL"))
        Dim 勤務先FAX As String = Convert.ToString(dt.Rows(0)("勤務先FAX"))

        勤務先未入力FLG = String.IsNullOrEmpty(勤務先郵便) Or String.IsNullOrEmpty(勤務先住所) Or String.IsNullOrEmpty(勤務先TEL) Or String.IsNullOrEmpty(勤務先FAX)

        Dim 自宅郵便 As String = Convert.ToString(dt.Rows(0)("自宅郵便"))
        Dim 自宅住所 As String = Convert.ToString(dt.Rows(0)("自宅住所01")) & Convert.ToString(dt.Rows(0)("自宅住所02")) & Convert.ToString(dt.Rows(0)("自宅住所03"))
        Dim 自宅EMAIL As String = Convert.ToString(dt.Rows(0)("自宅EMAIL"))
        Dim 自宅TEL As String = Convert.ToString(dt.Rows(0)("自宅TEL"))
        Dim 自宅FAX As String = Convert.ToString(dt.Rows(0)("自宅FAX"))

        自宅未入力FLG = String.IsNullOrEmpty(自宅郵便) Or String.IsNullOrEmpty(自宅住所) Or String.IsNullOrEmpty(自宅TEL) Or String.IsNullOrEmpty(自宅FAX)

        If 勤務先未入力FLG And 自宅未入力FLG Then
            message &= "勤務先または自宅いずれかの情報を入力してください。"
        End If

        Return message
    End Function
    Private Function addMesBankInfo(mes As String, dt As DataTable) As String
        Dim message As String = mes
        Dim 個未入力FLG As Boolean = False
        Dim 法未入力FLG As Boolean = False
        Dim 個銀行名 As String = Convert.ToString(dt.Rows(0)("銀行名"))
        Dim 個支店名 As String = Convert.ToString(dt.Rows(0)("支店名"))
        Dim 個種目 As String = Convert.ToString(dt.Rows(0)("口座種別"))
        Dim 個口座NO As String = Convert.ToString(dt.Rows(0)("口座NO"))
        Dim 個口座名 As String = Convert.ToString(dt.Rows(0)("口座名義"))

        個未入力FLG = String.IsNullOrEmpty(個銀行名) Or String.IsNullOrEmpty(個支店名) Or String.IsNullOrEmpty(個口座NO) Or String.IsNullOrEmpty(個口座名)

        Dim 法銀行名 As String = Convert.ToString(dt.Rows(0)("法銀行名"))
        Dim 法支店名 As String = Convert.ToString(dt.Rows(0)("法支店名"))
        Dim 法種目 As String = Convert.ToString(dt.Rows(0)("法口座種別"))
        Dim 法口座NO As String = Convert.ToString(dt.Rows(0)("法口座NO"))
        Dim 法口座名 As String = Convert.ToString(dt.Rows(0)("法口座名義"))

        法未入力FLG = String.IsNullOrEmpty(法銀行名) Or String.IsNullOrEmpty(法支店名) Or String.IsNullOrEmpty(法口座NO) Or String.IsNullOrEmpty(法口座名)

        If 個未入力FLG And 法未入力FLG Then
            message &= "個人口座または法人口座のいずれかを入力してください。"
        End If

        Return message
    End Function

    Private Sub RegistTeacherProf()
        Using spm As New StoredProcedureManager("連絡票_TMP講師貼付_UPDATE")
            spm.AddPrmIn("@USERCD", Data.SqlDbType.VarChar, 20, Session(S_COM_UserCD))
            spm.AddPrmIn("@CNT", Data.SqlDbType.Int, Session(S_TeacherProf_Selected_ID))
            spm.AddPrmIn("@プロフ提出日時", Data.SqlDbType.DateTime, DateTime.Now())
            spm.Exec()
        End Using
    End Sub
    Private Sub BindListView(lv As ListView)
        lv.DataSource = GetData()
        lv.DataBind()
    End Sub
    Private Sub BindAllListViews()
        Dim dt As DataTable = GetData()
        lv_基本情報.DataSource = dt
        lv_基本情報.DataBind()

        lv_勤務先.DataSource = dt
        lv_勤務先.DataBind()

        lv_自宅.DataSource = dt
        lv_自宅.DataBind()

        lv_その他.DataSource = dt
        lv_その他.DataBind()

        lv_個人支払先.DataSource = dt
        lv_個人支払先.DataBind()

        lv_法人支払先.DataSource = dt
        lv_法人支払先.DataBind()

        lv_支払先口座.DataSource = dt
        lv_支払先口座.DataBind()

        lv_プロフ.DataSource = dt
        lv_プロフ.DataBind()
    End Sub
    ' 郵便番号の前3桁を取得
    Protected Function GetZipcodePart1(value As Object) As String
        If value Is Nothing OrElse IsDBNull(value) OrElse String.IsNullOrEmpty(value.ToString()) Then
            Return ""
        End If

        Dim zipcode As String = value.ToString().Replace("-", "").Replace("ー", "").Trim()

        If zipcode.Length >= 3 Then
            Return zipcode.Substring(0, 3)
        Else
            Return zipcode
        End If
    End Function

    Private Sub AllListViewOff()
        '各編集ボタンも無効化
        lv_基本情報.Enabled = False
        lv_勤務先.Enabled = False
        lv_自宅.Enabled = False
        lv_その他.Enabled = False
        lv_個人支払先.Enabled = False
        lv_法人支払先.Enabled = False
        lv_支払先口座.Enabled = False
        lv_プロフ.Enabled = False
    End Sub

    ' 郵便番号の後ろ4桁を取得
    Protected Function GetZipcodePart2(value As Object) As String
        If value Is Nothing OrElse IsDBNull(value) OrElse String.IsNullOrEmpty(value.ToString()) Then
            Return ""
        End If

        Dim zipcode As String = value.ToString().Replace("-", "").Replace("ー", "").Trim()

        If zipcode.Length = 7 Then
            Return zipcode.Substring(3, 4)
        ElseIf zipcode.Length > 3 Then
            Return zipcode.Substring(3)
        Else
            Return ""
        End If
    End Function

    Private Function GetDDLData(itemName As String) As DataTable
        Using spm As New StoredProcedureManager("連絡票_入力_DDL")
            spm.AddPrmIn("@項目名", Data.SqlDbType.VarChar, 130, itemName)
            spm.Fill()

            Return spm.ds.Tables(0)
        End Using

    End Function
    Private Sub DisabledButton(ByRef btn As Button)
        btn.Enabled = False
        btn.CssClass = "training-button training-button-disabled"
    End Sub

#End Region





End Class
