Dim dr As DataRow = e.DataRow
Select Case e.DataCol.Name
Case "图像上传" '插入文件
Dim path As String = "/JLZL2018/"
If e.DataCol.FTPClient.DirExists(path) = False Then
e.DataCol.FTPClient.MakeDir(path)
End If
path = "/JLZL2018/" & dr("项目编号") & dr("工程名称") & "/" & dr("单位工程") & "/" & dr("分部分项")
If e.DataCol.FTPClient.DirExists(path) = False Then
e.DataCol.FTPClient.MakeDir(path)
End If
e.DataCol.FTPClient.ChangeDir(path)
If Forms("现场图像").Opened Then
Dim fm As WinForm.FileManager = Forms("现场图像").Controls("FileManager1") '改为自己建的窗口名称和控件名称
fm.FTPclient.ChangeDir(path)
End If
e.SubFolder = path '指定存放文件的子目录
If dr.IsNull("部位") = False AndAlso dr.IsNull("单位类别") = False Then
e.FileName = GetPy(dr("单位类别").SubString(0,2),True) & "-" & dr("部位") '修改文件名
Else
MessageBox.Show("部位及单位类别不能为空!")
e.Cancel = True
End If
Dim cnt As Integer = 1
If FileSys.DirectoryExists(path) Then
For Each file As String In FileSys.GetFiles(path)
If file Like "*" & e.FileName.SubString(0,2) & "*" Then
cnt += 1
End If
Next
End If
e.FileName &= "-" & Format(cnt, "00") & ".jpg"
End Select