Dim ltbox As WinForm.ListBox = e.Form.Controls("zjListBox1")
Dim fdr As Row = Tables("桩基资料").current
If fdr IsNot Nothing Then
If fdr.IsNull("桩位编号") Then
MessageBox.Show("请先输入桩位编号!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
For Each flt As String In ltbox.Items
Dim ndr As Row = Tables("桩基资料.桩基图像").AddNew
Dim i As Integer = Tables("桩基资料.桩基图像").rows.count
Dim fl = fdr("桩位编号") & "号-" & format(i, "00")
ndr("图像名称") = fl
ndr("图像类型") = flt.SubString(flt.LastIndexOf("."))
ndr.Save '必须先保存
ndr.DataRow.SQLInsertFile("附件",flt) '插入文件
ndr.DataRow.SQLSetValue("CRC", CRCCheckFile(flt)) '保存crc检验值
'==============图像本地保存===============
If fdr.IsNull("单位工程") = False Then
Dim pth As String = ProjectPath & "Attachments\用户工程\" & fdr("项目编号") & fdr("工程名称") & "\现场图像\" & fdr("单位工程") & "\" & fdr("分部分项") & "\"
If FileSys.DirectoryExists(pth) = False Then
FileSys.CreateDirectory(pth)
End If
Dim th As String = pth & ndr("图像名称") & ndr("图像类型")
Else
Dim pth As String = ProjectPath & "Attachments\用户工程\" & fdr("项目编号") & fdr("工程名称") & "\现场图像\" & fdr("分部分项") & "\"
If FileSys.DirectoryExists(pth) = False Then
FileSys.CreateDirectory(pth)
'这里***
End If
End If
Next
End If
End If
ltbox.Items.Clear() '清除列表数据