892 lines
34 KiB
VB.net
892 lines
34 KiB
VB.net
|
|
Imports BLV_Studio.GridModel
|
|||
|
|
Imports BLV_Studio.UTSModule
|
|||
|
|
Imports FlexCell
|
|||
|
|
|
|||
|
|
|
|||
|
|
Public Class FrmMain
|
|||
|
|
''' <summary>
|
|||
|
|
''' 项目信息
|
|||
|
|
''' </summary>
|
|||
|
|
Private _project As ProjectInfo
|
|||
|
|
|
|||
|
|
''' <summary>
|
|||
|
|
''' 模型表格
|
|||
|
|
''' </summary>
|
|||
|
|
Private _grdModel As GridModel.DeviceEventModel
|
|||
|
|
|
|||
|
|
''' <summary>
|
|||
|
|
''' 账号
|
|||
|
|
''' </summary>
|
|||
|
|
Public Property Account As String
|
|||
|
|
|
|||
|
|
''' <summary>
|
|||
|
|
''' 账号权限
|
|||
|
|
''' </summary>
|
|||
|
|
Public Property AccountAuth As AccountAuth
|
|||
|
|
|
|||
|
|
''' <summary>
|
|||
|
|
''' 基类信息
|
|||
|
|
''' </summary>
|
|||
|
|
Private _basicClass As DeviceObjectClasses
|
|||
|
|
|
|||
|
|
''' <summary>
|
|||
|
|
''' 当前编辑的酒店房型 node index,等同于在 _project.RoomType list列表中的位置
|
|||
|
|
''' </summary>
|
|||
|
|
Private g_CurrentTreeNodeRoomTypeItemIndex As Integer = 0
|
|||
|
|
|
|||
|
|
''' <summary>
|
|||
|
|
''' 根据酒店组+酒店ID+酒店名称 确定XML文件存放目录
|
|||
|
|
''' </summary>
|
|||
|
|
Public g_Xml_FullPath_BaseedOnTempFolder As String
|
|||
|
|
|
|||
|
|
''' <summary>
|
|||
|
|
''' XML 临时文件文件名
|
|||
|
|
''' </summary>
|
|||
|
|
Public g_Xml_FullName As String '当前编辑中的文件名含完整路径
|
|||
|
|
Public g_Xml_Name As String '当前编辑中的文件名,不含路径
|
|||
|
|
Public g_Xml_FilePath As String '当前编辑中的文件路径
|
|||
|
|
Public g_Last_Edit_Xml_FileName As String '上次关闭程序前编辑的文件名,下次打开程序后恢复该文件
|
|||
|
|
|
|||
|
|
Public DBconnString As String = "Data Source=blv-oa.com;Initial Catalog=BLV_RCU_DB;User ID=sa;Password=9S844fK3;Integrated Security=false"
|
|||
|
|
|
|||
|
|
|
|||
|
|
'项目视图 true = 显示’
|
|||
|
|
Public g_IsProjectTreeView_Visable = False
|
|||
|
|
|
|||
|
|
Public Enum EnumTreeLevel
|
|||
|
|
HotelName = 0
|
|||
|
|
RoomType
|
|||
|
|
RCU
|
|||
|
|
Device
|
|||
|
|
End Enum
|
|||
|
|
|
|||
|
|
|
|||
|
|
Private Sub FrmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|||
|
|
AddHandler AppDomain.CurrentDomain.UnhandledException, Sub(s As Object, arg As UnhandledExceptionEventArgs)
|
|||
|
|
Dim ex As Exception = CType(arg.ExceptionObject, Exception)
|
|||
|
|
AppLog.WriteFatalLog($"{Application.ProductName} {Application.ProductVersion}未处理异常,{ex}")
|
|||
|
|
MsgBox($"{Application.ProductName} {Application.ProductVersion}未处理异常,{ex}")
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
AddHandler Application.ThreadException, Sub(s As Object, arg As System.Threading.ThreadExceptionEventArgs)
|
|||
|
|
AppLog.WriteFatalLog($"{Application.ProductName} {Application.ProductVersion}线程异常,{arg.Exception}")
|
|||
|
|
MsgBox($"{Application.ProductName} {Application.ProductVersion}线程异常,{arg.Exception}")
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
'读取项目信息
|
|||
|
|
_project = New ProjectInfo
|
|||
|
|
|
|||
|
|
Dim tmpResult As Boolean = LoadSettings()
|
|||
|
|
If tmpResult = False Then
|
|||
|
|
MsgBox("开始工作前请选择酒店项目!")
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
If String.IsNullOrEmpty(_project.HotelCode) = False Then
|
|||
|
|
'读取房型
|
|||
|
|
Dim RoomTypes As List(Of RoomType) = GetRoomType(_project.HotelIndex)
|
|||
|
|
|
|||
|
|
'填充酒店节点
|
|||
|
|
FillTreeView(_project.HotelName, RoomTypes)
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
'读取基类信息
|
|||
|
|
_basicClass = XmlSerializer.DeserializeFormXml(Of DeviceObjectClasses)($"{Application.StartupPath}\xml\DeviceObjectClass.Xml")
|
|||
|
|
|
|||
|
|
'初始化模型表格
|
|||
|
|
_grdModel = New GridModel.DeviceEventModel
|
|||
|
|
If _grdModel.Grid Is Nothing Then _grdModel.Grid = GrdEvent
|
|||
|
|
If _grdModel.BasicClasses Is Nothing Then _grdModel.BasicClasses = _basicClass
|
|||
|
|
AddHandler _grdModel.TipChanged, AddressOf EventGridTipChanged
|
|||
|
|
|
|||
|
|
UpdateHotelAndRoomtypeLab_text()
|
|||
|
|
|
|||
|
|
'生成文件夹
|
|||
|
|
CreateXmlPath()
|
|||
|
|
|
|||
|
|
'恢复上次编辑的文件
|
|||
|
|
g_Xml_FullName = g_Last_Edit_Xml_FileName
|
|||
|
|
|
|||
|
|
If Not String.IsNullOrEmpty(g_Xml_FullName) Then
|
|||
|
|
If FileExist(g_Xml_FullName) Then
|
|||
|
|
If _grdModel.Load(g_Xml_FullName) = False Then g_Xml_FullName = ""
|
|||
|
|
Else
|
|||
|
|
g_Xml_FullName = ""
|
|||
|
|
End If
|
|||
|
|
Else
|
|||
|
|
g_Xml_FullName = ""
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
UpdateWindowTitle()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
|
|||
|
|
Private Sub TsmiChangeUser_Click(sender As Object, e As EventArgs) Handles TsmiChangeUser.Click
|
|||
|
|
Dim frm As New FrmLogin
|
|||
|
|
frm.Show()
|
|||
|
|
Me.Close()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub TsmiQuit_Click(sender As Object, e As EventArgs) Handles TsmiQuit.Click
|
|||
|
|
Me.Close()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub TsBtnChangeProject_Click(sender As Object, e As EventArgs) Handles TsBtnChangeProject.Click
|
|||
|
|
Using frmHotel As New FrmChangeHotel
|
|||
|
|
frmHotel.VerderIndex = _project.VerderIndex
|
|||
|
|
frmHotel.VerderName = _project.VerdorName
|
|||
|
|
frmHotel.HotelIndex = _project.HotelIndex
|
|||
|
|
frmHotel.HotelName = _project.HotelName
|
|||
|
|
frmHotel.HotelCode = _project.HotelCode
|
|||
|
|
frmHotel.AccountAuth = AccountAuth
|
|||
|
|
|
|||
|
|
If frmHotel.ShowDialog() <> DialogResult.OK Then Return
|
|||
|
|
|
|||
|
|
_project.VerderIndex = frmHotel.VerderIndex
|
|||
|
|
_project.VerdorName = frmHotel.VerderName
|
|||
|
|
_project.HotelIndex = frmHotel.HotelIndex
|
|||
|
|
_project.HotelName = frmHotel.HotelName
|
|||
|
|
_project.HotelCode = frmHotel.HotelCode
|
|||
|
|
|
|||
|
|
'读取房型
|
|||
|
|
Dim roomtypes As List(Of RoomType) = GetRoomType(_project.HotelIndex)
|
|||
|
|
|
|||
|
|
'填充酒店节点
|
|||
|
|
FillTreeView(_project.HotelName, roomtypes)
|
|||
|
|
|
|||
|
|
'更新右上角项目和房型标签显示内容
|
|||
|
|
g_CurrentTreeNodeRoomTypeItemIndex = 0
|
|||
|
|
UpdateHotelAndRoomtypeLab_text()
|
|||
|
|
|
|||
|
|
''Momo 2022-04-03 创建FTP文件夹’
|
|||
|
|
'CreateXmlPath()
|
|||
|
|
|
|||
|
|
End Using
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub FillTreeView(hotel As String, RoomTypes As List(Of RoomType))
|
|||
|
|
TvwMain.Nodes.Clear()
|
|||
|
|
TvwMain.ItemHeight = 21
|
|||
|
|
TvwMain.CheckBoxes = False
|
|||
|
|
TvwMain.HideSelection = True
|
|||
|
|
TvwMain.SelectedImageKey = TvwMain.ImageKey
|
|||
|
|
|
|||
|
|
Dim pNode As TreeNode = TvwMain.Nodes.Add(hotel)
|
|||
|
|
pNode.ForeColor = Color.DarkGreen
|
|||
|
|
pNode.NodeFont = New Font("宋体", 10, FontStyle.Bold)
|
|||
|
|
pNode.ImageKey = "09664.ico"
|
|||
|
|
pNode.SelectedImageKey = "09664.ico"
|
|||
|
|
|
|||
|
|
|
|||
|
|
Dim i As Integer = 0
|
|||
|
|
Dim tmpRoomType As New ProjectInfo.StrutRoomType
|
|||
|
|
Dim retryCnt As Integer
|
|||
|
|
|
|||
|
|
_project.ReDim_RoomType(RoomTypes.Count)
|
|||
|
|
|
|||
|
|
For Each room_type As RoomType In RoomTypes
|
|||
|
|
retryCnt = 0
|
|||
|
|
Dim typeNode As TreeNode = pNode.Nodes.Add(room_type.RoomType)
|
|||
|
|
typeNode.ForeColor = Color.Black 'Color.DeepPink
|
|||
|
|
typeNode.NodeFont = New Font("宋体", 10, FontStyle.Bold)
|
|||
|
|
|
|||
|
|
Dim tmpPath As String = "\Temp\Config\" _
|
|||
|
|
& _project.VerdorName & "\" _
|
|||
|
|
& _project.HotelCode & "-" _
|
|||
|
|
& _project.HotelName
|
|||
|
|
|
|||
|
|
Dim tmp_Local_XmlFullName As String = Application.StartupPath & tmpPath & "\" & room_type.XmlFile
|
|||
|
|
Dim tmp_FTP_Xml_FullName As String = tmpPath & "\" & room_type.XmlFile
|
|||
|
|
|
|||
|
|
If String.IsNullOrEmpty(room_type.XmlFile) Then
|
|||
|
|
typeNode.ImageKey = "03716-gary.ico"
|
|||
|
|
typeNode.SelectedImageKey = "03716-gary.ico"
|
|||
|
|
typeNode.Nodes.Add("无配置文件") '增加一个空节点’
|
|||
|
|
typeNode.Nodes(0).ImageKey = "Others_gray.ico" '本地文件存在
|
|||
|
|
typeNode.Nodes(0).SelectedImageKey = "Others_gray.ico"
|
|||
|
|
Else
|
|||
|
|
typeNode.ImageKey = "03716.ico"
|
|||
|
|
typeNode.SelectedImageKey = "03716.ico"
|
|||
|
|
typeNode.Nodes.Add(room_type.XmlFile)
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
lab_CheckFileExist:
|
|||
|
|
If FileExist(tmp_Local_XmlFullName) Then
|
|||
|
|
typeNode.Nodes(0).ImageKey = "01087.ico" '本地文件存在
|
|||
|
|
typeNode.Nodes(0).SelectedImageKey = "01087.ico"
|
|||
|
|
typeNode.Nodes(0).ForeColor = Color.Black
|
|||
|
|
Else
|
|||
|
|
typeNode.Nodes(0).ImageKey = "01088.ico" '本地文件不存在’
|
|||
|
|
typeNode.Nodes(0).SelectedImageKey = "01088.ico" '本地文件不存在’
|
|||
|
|
typeNode.Nodes(0).ForeColor = Color.LightGray
|
|||
|
|
If retryCnt < 2 Then
|
|||
|
|
'’DownloadXmlFile(_project.VerdorName, _project.HotelCode, _project.HotelName, room_type.XmlFile)
|
|||
|
|
Console.WriteLine("Download XML: " & room_type.XmlFile & " ,Retry = " & retryCnt)
|
|||
|
|
retryCnt += 1
|
|||
|
|
GoTo lab_CheckFileExist
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
tmpRoomType.structRoomType_ID = room_type.RoomTypeIdx
|
|||
|
|
tmpRoomType.structRoomType_Name = room_type.RoomType
|
|||
|
|
tmpRoomType.structRoomType_XML_Filename = room_type.XmlFile
|
|||
|
|
|
|||
|
|
_project.RoomType(i) = tmpRoomType
|
|||
|
|
|
|||
|
|
i += 1
|
|||
|
|
Next
|
|||
|
|
|
|||
|
|
TvwMain.Nodes(0).Expand()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Function GetRoomType(strHotelId As String) As List(Of RoomType)
|
|||
|
|
Dim result As New List(Of RoomType)
|
|||
|
|
|
|||
|
|
Dim dt As DataTable
|
|||
|
|
Using db As New DbExecutor(DbExecutor.DbTypeEnum.Mssql, DBconnString)
|
|||
|
|
db.Open()
|
|||
|
|
dt = db.ExecuteDataTable(db.CmdHelper.SearchAll("TBL_ROOM_TYPE_LIST", $"[HOTEL_ID] = '{strHotelId}'"))
|
|||
|
|
db.Close()
|
|||
|
|
End Using
|
|||
|
|
|
|||
|
|
Dim roomtype As RoomType
|
|||
|
|
For Each dtRow As DataRow In dt.Rows
|
|||
|
|
roomtype = New RoomType
|
|||
|
|
roomtype.RoomTypeIdx = dtRow("ROOM_TYPE_ID").ToString
|
|||
|
|
roomtype.HotelID = dtRow("HOTEL_ID").ToString
|
|||
|
|
roomtype.RoomType = dtRow("ROOM_TYPE_NAME").ToString
|
|||
|
|
roomtype.BinFile = dtRow("CONFIG_BIN").ToString
|
|||
|
|
roomtype.BinFileMd5 = dtRow("CONFIG_BIN_MD5").ToString
|
|||
|
|
roomtype.XmlFile = dtRow("CONFIG_XML").ToString
|
|||
|
|
result.Add(roomtype)
|
|||
|
|
Next
|
|||
|
|
Return result
|
|||
|
|
End Function
|
|||
|
|
Private Function GetNodesRoomTypeItemIdx(argTreeNode As TreeNode, ByRef argRoomTypeNodeIdx As Integer) As Boolean
|
|||
|
|
|
|||
|
|
Try
|
|||
|
|
Dim tmpTreeNode As TreeNode = argTreeNode
|
|||
|
|
'S1:获取当前节点级数
|
|||
|
|
Dim tmpNodeLevel As Integer = tmpTreeNode.Level
|
|||
|
|
Console.WriteLine("tmpNodeLevel = " & tmpNodeLevel)
|
|||
|
|
|
|||
|
|
'S2:一直递归到第二级
|
|||
|
|
If tmpNodeLevel >= 2 Then
|
|||
|
|
Do
|
|||
|
|
tmpTreeNode = tmpTreeNode.Parent
|
|||
|
|
tmpNodeLevel = tmpTreeNode.Level
|
|||
|
|
argRoomTypeNodeIdx = tmpTreeNode.Index
|
|||
|
|
Console.WriteLine("tmpNodeLevel = " & tmpNodeLevel & " , node name = " & tmpTreeNode.Text)
|
|||
|
|
Loop While tmpNodeLevel > 1
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
Console.WriteLine("argRoomTypeNodeIdx = " & argRoomTypeNodeIdx)
|
|||
|
|
|
|||
|
|
Return True
|
|||
|
|
|
|||
|
|
Catch ex As Exception
|
|||
|
|
Return False
|
|||
|
|
End Try
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
Private Sub SetTreeNodeBackColor(argRoomTypeItemIdx As Integer)
|
|||
|
|
For i = 0 To TvwMain.Nodes(0).GetNodeCount(False) - 1
|
|||
|
|
TvwMain.Nodes(0).Nodes(i).BackColor = Color.White
|
|||
|
|
TvwMain.Nodes(0).Nodes(i).ForeColor = Color.Black 'Color.DeepPink
|
|||
|
|
Next
|
|||
|
|
TvwMain.Nodes(0).Nodes(argRoomTypeItemIdx).BackColor = Color.CornflowerBlue
|
|||
|
|
TvwMain.Nodes(0).Nodes(argRoomTypeItemIdx).ForeColor = Color.White
|
|||
|
|
End Sub
|
|||
|
|
Private Sub TvwMain_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles TvwMain.AfterSelect
|
|||
|
|
Dim tmpRoomTypeNodeIdx As Integer = 0
|
|||
|
|
Dim tmpXmlFullName As String = ""
|
|||
|
|
|
|||
|
|
Select Case e.Node.Level
|
|||
|
|
Case EnumTreeLevel.HotelName
|
|||
|
|
g_CurrentTreeNodeRoomTypeItemIndex = 0 '0 = error
|
|||
|
|
Return
|
|||
|
|
|
|||
|
|
Case EnumTreeLevel.RoomType
|
|||
|
|
_project.CurrentSelectedRoomTypeIdx = e.Node.Index
|
|||
|
|
SetTreeNodeBackColor(e.Node.Index)
|
|||
|
|
g_CurrentTreeNodeRoomTypeItemIndex = e.Node.Index
|
|||
|
|
|
|||
|
|
Case EnumTreeLevel.RCU
|
|||
|
|
|
|||
|
|
'获取当前房型item idx
|
|||
|
|
If (GetNodesRoomTypeItemIdx(e.Node, tmpRoomTypeNodeIdx) = True) Then
|
|||
|
|
SetTreeNodeBackColor(tmpRoomTypeNodeIdx)
|
|||
|
|
g_CurrentTreeNodeRoomTypeItemIndex = tmpRoomTypeNodeIdx
|
|||
|
|
UpdateHotelAndRoomtypeLab_text()
|
|||
|
|
Else
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
If _grdModel._isXmlModified = True Then
|
|||
|
|
MsgBox("当前文件尚未保存,请保存后再打开新的文件!", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "请先保存当前编辑的文件!")
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
'文件名
|
|||
|
|
'配置文件保存地址
|
|||
|
|
Dim tmpPath As String = "\Temp\Config\" _
|
|||
|
|
& _project.VerdorName & "\" _
|
|||
|
|
& _project.HotelCode & "-" _
|
|||
|
|
& _project.HotelName
|
|||
|
|
|
|||
|
|
If Not String.IsNullOrEmpty(_project.RoomType(g_CurrentTreeNodeRoomTypeItemIndex).structRoomType_XML_Filename) Then
|
|||
|
|
tmpXmlFullName = Application.StartupPath & tmpPath & "\" &
|
|||
|
|
_project.RoomType(g_CurrentTreeNodeRoomTypeItemIndex).structRoomType_XML_Filename
|
|||
|
|
Console.WriteLine("tmpFullName = " & tmpXmlFullName)
|
|||
|
|
|
|||
|
|
'本地是否有该文件存在
|
|||
|
|
If FileExist(tmpXmlFullName) Then
|
|||
|
|
g_Xml_FullName = tmpXmlFullName
|
|||
|
|
Console.WriteLine("g_Xml_FullName = " & g_Xml_FullName)
|
|||
|
|
If _grdModel.Load(tmpXmlFullName) = True Then g_Xml_FullName = tmpXmlFullName '打开成功就更新全局变量,确保显示正确
|
|||
|
|
Else
|
|||
|
|
MsgBox("本地没有此配置文件,请从服务器下载!", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "本地文件不存在!")
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
UpdateWindowTitle()
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
Case EnumTreeLevel.Device
|
|||
|
|
GetNodesRoomTypeItemIdx(e.Node, tmpRoomTypeNodeIdx)
|
|||
|
|
If (GetNodesRoomTypeItemIdx(e.Node, tmpRoomTypeNodeIdx) = True) Then
|
|||
|
|
SetTreeNodeBackColor(tmpRoomTypeNodeIdx)
|
|||
|
|
g_CurrentTreeNodeRoomTypeItemIndex = tmpRoomTypeNodeIdx
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
Case Else
|
|||
|
|
GetNodesRoomTypeItemIdx(e.Node, tmpRoomTypeNodeIdx)
|
|||
|
|
If (GetNodesRoomTypeItemIdx(e.Node, tmpRoomTypeNodeIdx) = True) Then
|
|||
|
|
SetTreeNodeBackColor(tmpRoomTypeNodeIdx)
|
|||
|
|
g_CurrentTreeNodeRoomTypeItemIndex = tmpRoomTypeNodeIdx
|
|||
|
|
End If
|
|||
|
|
End Select
|
|||
|
|
|
|||
|
|
UpdateHotelAndRoomtypeLab_text()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Function DealPasteData(str As String) As List(Of List(Of String))
|
|||
|
|
Dim result As New List(Of List(Of String))
|
|||
|
|
|
|||
|
|
Dim tmpStrings() As String = str.Split(New String() {vbCrLf}, StringSplitOptions.None)
|
|||
|
|
For Each tmpStr As String In tmpStrings
|
|||
|
|
Dim lst As New List(Of String)
|
|||
|
|
lst.AddRange(tmpStr.Split(vbTab))
|
|||
|
|
|
|||
|
|
result.Add(lst)
|
|||
|
|
Next
|
|||
|
|
|
|||
|
|
Return result
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
Private Sub TsBtnAddDev_Click(sender As Object, e As EventArgs) Handles TsBtnAddDev.Click
|
|||
|
|
If _grdModel Is Nothing Then Return
|
|||
|
|
Try
|
|||
|
|
_grdModel.AddDeviceObject()
|
|||
|
|
Catch ex As Exception
|
|||
|
|
MsgBox($"添加节点失败,{ex.Message}")
|
|||
|
|
End Try
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub TsBtnAddCondition_Click(sender As Object, e As EventArgs) Handles TsBtnAddCondition.Click
|
|||
|
|
If _grdModel Is Nothing Then Return
|
|||
|
|
Try
|
|||
|
|
_grdModel.AddEventContidion()
|
|||
|
|
Catch ex As Exception
|
|||
|
|
MsgBox($"添加节点失败,{ex.Message}")
|
|||
|
|
End Try
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub TsBtnAddAction_Click(sender As Object, e As EventArgs) Handles TsBtnAddAction.Click
|
|||
|
|
If _grdModel Is Nothing Then Return
|
|||
|
|
Try
|
|||
|
|
_grdModel.AddEventAction()
|
|||
|
|
Catch ex As Exception
|
|||
|
|
MsgBox($"添加节点失败,{ex.Message}")
|
|||
|
|
End Try
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub TsBtnRemoveNode_Click(sender As Object, e As EventArgs) Handles TsBtnRemoveNode.Click
|
|||
|
|
If _grdModel Is Nothing Then Return
|
|||
|
|
If MsgBox("确定删除当前节点吗?") <> MsgBoxResult.Ok Then Return
|
|||
|
|
Try
|
|||
|
|
_grdModel.RemoteNode()
|
|||
|
|
Catch ex As Exception
|
|||
|
|
MsgBox($"删除节点失败,{ex.Message}")
|
|||
|
|
End Try
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub TsmiAppDev_Click(sender As Object, e As EventArgs) Handles TsmiAppDev.Click
|
|||
|
|
TsBtnAddDev_Click(Nothing, Nothing)
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub TsmiAddCondition_Click(sender As Object, e As EventArgs) Handles TsmiAddCondition.Click
|
|||
|
|
TsBtnAddCondition_Click(Nothing, Nothing)
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub TsmiAddAction_Click(sender As Object, e As EventArgs) Handles TsmiAddAction.Click
|
|||
|
|
TsBtnAddAction_Click(Nothing, Nothing)
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub TsmiRemoveNode_Click(sender As Object, e As EventArgs) Handles TsmiRemoveNode.Click
|
|||
|
|
TsBtnRemoveNode_Click(Nothing, Nothing)
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private xmlPath As String = $"{Application.StartupPath}\xml\BLV.xml"
|
|||
|
|
Private Sub TsBtnSaveAs_Click(sender As Object, e As EventArgs) Handles TsBtnSaveAs.Click
|
|||
|
|
SaveFileAs()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub TsBtnLoad_Click(sender As Object, e As EventArgs) Handles TsBtnLoad.Click
|
|||
|
|
If _grdModel._isXmlModified = True Then
|
|||
|
|
MsgBox("当前文件尚未保存,请保存后再打开新的文件!", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "请先保存当前编辑的文件!")
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
Using openFileDialog As New OpenFileDialog
|
|||
|
|
Dim tmpInitDir As String = Application.StartupPath & "\Temp\Config\"
|
|||
|
|
openFileDialog.InitialDirectory = tmpInitDir
|
|||
|
|
openFileDialog.RestoreDirectory = True
|
|||
|
|
openFileDialog.Title = "打开文件"
|
|||
|
|
openFileDialog.Filter = $"配置文件(*.xml)|*.xml"
|
|||
|
|
|
|||
|
|
If openFileDialog.ShowDialog() = DialogResult.OK Then
|
|||
|
|
g_Xml_Name = openFileDialog.SafeFileName
|
|||
|
|
g_Xml_FullName = openFileDialog.FileName
|
|||
|
|
'MsgBox("g_Xml_FullName = " & g_Xml_FullName & vbCrLf & "g_Xml_Name = " & g_Xml_Name)
|
|||
|
|
If _grdModel.Load(g_Xml_FullName) = False Then
|
|||
|
|
g_Xml_FullName = ""
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
End Using
|
|||
|
|
|
|||
|
|
UpdateWindowTitle()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub TsBtnClean_Click(sender As Object, e As EventArgs) Handles TsBtnNewFile.Click
|
|||
|
|
If _grdModel._isXmlModified = True Then
|
|||
|
|
MsgBox("当前文件尚未保存,请保存后再打开新的文件!", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "请先保存当前编辑的文件!")
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
_grdModel.InitGrid()
|
|||
|
|
g_Xml_FullName = ""
|
|||
|
|
UpdateWindowTitle()
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
|
|||
|
|
Private Sub EventGridTipChanged(sender As Object, e As TipChangedEventArgs)
|
|||
|
|
RtxColTip.SuspendLayout()
|
|||
|
|
RtxColTip.Clear()
|
|||
|
|
RtxColTip.SelectionColor = Color.Black
|
|||
|
|
RtxColTip.AppendText(e.Title & vbCrLf)
|
|||
|
|
RtxColTip.SelectionColor = Color.Gray
|
|||
|
|
RtxColTip.AppendText(e.TipString)
|
|||
|
|
RtxColTip.ResumeLayout(False)
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub TsBtnAddModel_Click(sender As Object, e As EventArgs) Handles TsBtnAddModel.Click
|
|||
|
|
If _grdModel Is Nothing Then Return
|
|||
|
|
Try
|
|||
|
|
_grdModel.AddContextualModel()
|
|||
|
|
Catch ex As Exception
|
|||
|
|
MsgBox($"添加节点失败,{ex.Message}")
|
|||
|
|
End Try
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
#Region "数据库操作"
|
|||
|
|
Private Sub ReleaseConfigXmlToDB()
|
|||
|
|
'取当前时间
|
|||
|
|
Dim tmpModifiedTime As Date = DateAndTime.Now
|
|||
|
|
Dim strModifiedTime As String = Format(tmpModifiedTime, "yyMMddHHmmss") ' yyyyMMddHHmmss
|
|||
|
|
|
|||
|
|
'配置文件保存地址
|
|||
|
|
Dim tmpPath As String = "\Temp\Config\" _
|
|||
|
|
& _project.VerdorName & "\" _
|
|||
|
|
& _project.HotelCode & "-" _
|
|||
|
|
& _project.HotelName
|
|||
|
|
|
|||
|
|
''文件名
|
|||
|
|
Dim tmpXmlName = "Config-" &
|
|||
|
|
_project.HotelCode & "-" &
|
|||
|
|
_project.HotelName & "-" &
|
|||
|
|
_project.RoomType(g_CurrentTreeNodeRoomTypeItemIndex).structRoomType_Name & "-" &
|
|||
|
|
strModifiedTime & ".xml"
|
|||
|
|
|
|||
|
|
|
|||
|
|
'确认发布内容
|
|||
|
|
Dim tmpMsgBoxString As String = "请确认发布项目和房型:" & vbCrLf & vbCrLf & vbCrLf &
|
|||
|
|
"项目分组 : " & _project.VerdorName & vbCrLf &
|
|||
|
|
"项目编号 : " & _project.HotelCode & vbCrLf &
|
|||
|
|
"项目名称 : " & _project.HotelName & vbCrLf &
|
|||
|
|
"房 型 : " & _project.RoomType(g_CurrentTreeNodeRoomTypeItemIndex).structRoomType_Name & vbCrLf &
|
|||
|
|
"房型ID : " & _project.RoomType(g_CurrentTreeNodeRoomTypeItemIndex).structRoomType_ID & vbCrLf & vbCrLf &
|
|||
|
|
"配置文件名 : " & tmpXmlName & vbCrLf
|
|||
|
|
|
|||
|
|
If MsgBox(tmpMsgBoxString, MsgBoxStyle.OkCancel + vbExclamation, "请确认发布信息!") = MsgBoxResult.Ok Then
|
|||
|
|
''保存配置文件到本地
|
|||
|
|
'创建本地和FTP文件夹
|
|||
|
|
CreateXmlPath()
|
|||
|
|
|
|||
|
|
'保存文件’
|
|||
|
|
Dim tmp_Local_XmlFullName As String = Application.StartupPath & tmpPath & "\" & tmpXmlName
|
|||
|
|
Dim tmp_FTP_Xml_FullName As String = tmpPath & "\" & tmpXmlName
|
|||
|
|
|
|||
|
|
If _grdModel.Save(tmp_Local_XmlFullName) = True Then '保存配置文件成功
|
|||
|
|
g_Xml_FullName = tmp_Local_XmlFullName
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
''上传配置文件到FTP site
|
|||
|
|
UtsFtp.CreateObject.FtpUpload(tmp_FTP_Xml_FullName, tmp_Local_XmlFullName)
|
|||
|
|
|
|||
|
|
''写入配置文件名到数据库
|
|||
|
|
Dim tmpDestStr As String = "'" & tmpXmlName & "'"
|
|||
|
|
Dim tmpCondiction As String = "'" & _project.RoomType(g_CurrentTreeNodeRoomTypeItemIndex).structRoomType_ID & "'"
|
|||
|
|
Dim dt As DataTable
|
|||
|
|
Using db As New DbExecutor(DbExecutor.DbTypeEnum.Mssql, DBconnString)
|
|||
|
|
db.Open()
|
|||
|
|
dt = db.ExecuteDataTable(db.CmdHelper.DbUpdate("dbo",
|
|||
|
|
"TBL_ROOM_TYPE_LIST",
|
|||
|
|
"CONFIG_XML=" & tmpDestStr,
|
|||
|
|
"ROOM_TYPE_ID=" & tmpCondiction))
|
|||
|
|
db.Close()
|
|||
|
|
End Using
|
|||
|
|
|
|||
|
|
'更新窗口标题
|
|||
|
|
UpdateWindowTitle()
|
|||
|
|
|
|||
|
|
'更新treeview
|
|||
|
|
UpdateTreeView()
|
|||
|
|
Else
|
|||
|
|
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#End Region
|
|||
|
|
|
|||
|
|
#Region "MISC"
|
|||
|
|
Private Sub UpdateWindowTitle()
|
|||
|
|
If Not String.IsNullOrEmpty(g_Xml_FullName) Then
|
|||
|
|
If FileExist(g_Xml_FullName) Then
|
|||
|
|
g_Xml_Name = GetFileName(g_Xml_FullName)
|
|||
|
|
g_Xml_FilePath = GetFilePath(g_Xml_FullName)
|
|||
|
|
Text = $"{Application.ProductName} {Application.ProductVersion} Account:{Account}" & "-(" & g_Xml_Name & ")"
|
|||
|
|
Return
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
Text = $"{Application.ProductName} {Application.ProductVersion} Account:{Account}"
|
|||
|
|
End Sub
|
|||
|
|
Private Sub UpdateHotelAndRoomtypeLab_text()
|
|||
|
|
lab_HotelGroup_And_Hotel.Text = _project.VerdorName & ":" & _project.HotelCode & "-" & _project.HotelName
|
|||
|
|
|
|||
|
|
If _project.RoomType Is Nothing Then
|
|||
|
|
lab_RoomType.Text = "未选择房型"
|
|||
|
|
Else
|
|||
|
|
lab_RoomType.Text = _project.RoomType(g_CurrentTreeNodeRoomTypeItemIndex).structRoomType_ID & "-" &
|
|||
|
|
_project.RoomType(g_CurrentTreeNodeRoomTypeItemIndex).structRoomType_Name
|
|||
|
|
End If
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
'从完整的文件名中分理出文件名
|
|||
|
|
Public Function GetFileName(FilePathFileName As String) As String '获取文件名 aaa.txt
|
|||
|
|
Dim i As Integer, J As Integer
|
|||
|
|
i = Len(FilePathFileName)
|
|||
|
|
J = InStrRev(FilePathFileName, "\")
|
|||
|
|
Return Mid(FilePathFileName, J + 1, i)
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
'从完整的文件名中分理出路径
|
|||
|
|
Public Function GetFilePath(FilePathFileName As String) As String '获取路径路径 c:\dir1001\
|
|||
|
|
On Error Resume Next
|
|||
|
|
Dim J As Integer
|
|||
|
|
J = InStrRev(FilePathFileName, "\")
|
|||
|
|
Return Mid(FilePathFileName, 1, J)
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
'判断目录是否存在的函数 传入String值 返回Boolean值
|
|||
|
|
Private Function DirExist(ByVal Str_Path As String) As Boolean
|
|||
|
|
Return System.IO.Directory.Exists(Str_Path)
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
'判断文件是否存在的函数 传入String值 返回Boolean值
|
|||
|
|
Private Function FileExist(ByVal Str_File As String) As Boolean
|
|||
|
|
Return System.IO.File.Exists(Str_File)
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
'当房型数据发生变化时,刷新tree view
|
|||
|
|
Private Sub UpdateTreeView()
|
|||
|
|
'读取房型
|
|||
|
|
Dim roomtypes As List(Of RoomType) = GetRoomType(_project.HotelIndex)
|
|||
|
|
|
|||
|
|
'填充酒店节点
|
|||
|
|
FillTreeView(_project.HotelName, roomtypes)
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
'文件另存为
|
|||
|
|
Private Function SaveFileAs() As Boolean
|
|||
|
|
Try
|
|||
|
|
Using saveFileDialog As New SaveFileDialog
|
|||
|
|
|
|||
|
|
Dim tmpXmlFullName As String = ""
|
|||
|
|
Dim tmpInitDir As String = Application.StartupPath & "\Temp\Config\"
|
|||
|
|
|
|||
|
|
With saveFileDialog
|
|||
|
|
.InitialDirectory = tmpInitDir
|
|||
|
|
.RestoreDirectory = True
|
|||
|
|
.OverwritePrompt = True
|
|||
|
|
.AddExtension = True
|
|||
|
|
.DefaultExt = ".xml"
|
|||
|
|
.Title = "保存文件"
|
|||
|
|
.Filter = $"配置文件(*.xml)|*.xml"
|
|||
|
|
End With
|
|||
|
|
|
|||
|
|
If saveFileDialog.ShowDialog() = DialogResult.OK Then
|
|||
|
|
tmpXmlFullName = saveFileDialog.FileName
|
|||
|
|
|
|||
|
|
If _grdModel.Save(tmpXmlFullName) = True Then
|
|||
|
|
g_Xml_FullName = tmpXmlFullName '只有保存成功才会更新全局变量,确保全局变量的正确性
|
|||
|
|
UpdateWindowTitle()
|
|||
|
|
Return True
|
|||
|
|
End If
|
|||
|
|
End If
|
|||
|
|
End Using
|
|||
|
|
|
|||
|
|
UpdateWindowTitle()
|
|||
|
|
Return False
|
|||
|
|
|
|||
|
|
Catch ex As Exception
|
|||
|
|
Return False
|
|||
|
|
End Try
|
|||
|
|
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
#End Region
|
|||
|
|
|
|||
|
|
|
|||
|
|
#Region "SaveSetting"
|
|||
|
|
Private Sub SaveSettings()
|
|||
|
|
|
|||
|
|
My.Settings.HotelName = _project.HotelName
|
|||
|
|
My.Settings.HotelCode = _project.HotelCode
|
|||
|
|
My.Settings.VerdorName = _project.VerdorName
|
|||
|
|
My.Settings.HotelId = _project.HotelIndex
|
|||
|
|
My.Settings.VenderIndex = _project.VerderIndex
|
|||
|
|
My.Settings.LastEditXmlFile = g_Xml_FullName
|
|||
|
|
My.Settings.Save()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Function LoadSettings() As Boolean
|
|||
|
|
Try
|
|||
|
|
My.Settings.Reload()
|
|||
|
|
_project.HotelName = My.Settings.HotelName
|
|||
|
|
_project.HotelCode = My.Settings.HotelCode
|
|||
|
|
_project.VerdorName = My.Settings.VerdorName
|
|||
|
|
_project.HotelIndex = My.Settings.HotelId
|
|||
|
|
_project.VerderIndex = My.Settings.VenderIndex
|
|||
|
|
g_Last_Edit_Xml_FileName = My.Settings.LastEditXmlFile
|
|||
|
|
|
|||
|
|
Catch ex As Exception
|
|||
|
|
Return False
|
|||
|
|
End Try
|
|||
|
|
|
|||
|
|
Return True
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#End Region
|
|||
|
|
|
|||
|
|
|
|||
|
|
#Region "文件和目录操作"
|
|||
|
|
|
|||
|
|
'FTP地址:'blv-oa.com
|
|||
|
|
'账号:BLV_Studio
|
|||
|
|
'pw:37f5675t6R&5*
|
|||
|
|
'端口:50
|
|||
|
|
|
|||
|
|
Public FtpHost As String = "blv-oa.com"
|
|||
|
|
Public FtpPort As Integer = 50
|
|||
|
|
Public FtpUser As String = "BLV_Studio"
|
|||
|
|
Public FtpPwd As String = "37f5675t6R&5*"
|
|||
|
|
|
|||
|
|
'下载xml文件
|
|||
|
|
Private Function DownloadXmlFile(strVendorName As String, strHotelCode As String, strHotelName As String, strFileName As String) As Boolean
|
|||
|
|
Try
|
|||
|
|
Dim retry As Integer = 0
|
|||
|
|
Dim tmpPath As String = "\Temp\Config\" _
|
|||
|
|
& strVendorName & "\" _
|
|||
|
|
& strHotelCode & "-" _
|
|||
|
|
& strHotelName
|
|||
|
|
|
|||
|
|
Dim tmp_Local_XmlFullName As String = Application.StartupPath & tmpPath & "\" & strFileName
|
|||
|
|
Dim tmp_FTP_Xml_FullName As String = tmpPath & "\" & strFileName
|
|||
|
|
|
|||
|
|
Console.WriteLine("tmp_Local_XmlFullName: " & tmp_Local_XmlFullName)
|
|||
|
|
Console.WriteLine("tmp_FTP_Xml_FullName: " & tmp_FTP_Xml_FullName)
|
|||
|
|
|
|||
|
|
UtsFtp.InitConnectParams(FtpPort, FtpUser, FtpPwd)
|
|||
|
|
Dim ftp As UtsFtp = UtsFtp.CreateObject()
|
|||
|
|
ftp.FtpHost = FtpHost
|
|||
|
|
ftp.FtpDownload(tmp_FTP_Xml_FullName, tmp_Local_XmlFullName)
|
|||
|
|
Console.WriteLine("Function:DownloadXmlFile: " & strFileName & " ,Retry = " & retry)
|
|||
|
|
|
|||
|
|
Return True
|
|||
|
|
Catch ex As Exception
|
|||
|
|
Return False
|
|||
|
|
End Try
|
|||
|
|
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
'根据酒店组和酒店名称信息创建XML文件保存目录(同时创建FTP目录和本地目录)
|
|||
|
|
Private Function CreateXmlPath() As Boolean
|
|||
|
|
If String.IsNullOrEmpty(_project.HotelCode) Then
|
|||
|
|
MsgBox("请选择有效的酒店组")
|
|||
|
|
Return False
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
If String.IsNullOrEmpty(_project.VerdorName) Then
|
|||
|
|
MsgBox("请选择有效的酒店组")
|
|||
|
|
Return False
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
If String.IsNullOrEmpty(_project.HotelName) Then
|
|||
|
|
MsgBox("请选择有效的酒店名称")
|
|||
|
|
Return False
|
|||
|
|
End If
|
|||
|
|
|
|||
|
|
|
|||
|
|
'拼接文件名
|
|||
|
|
g_Xml_FullPath_BaseedOnTempFolder = "\Temp\Config\" _
|
|||
|
|
& _project.VerdorName & "\" _
|
|||
|
|
& _project.HotelCode & "-" _
|
|||
|
|
& _project.HotelName
|
|||
|
|
|
|||
|
|
UtsFtp.InitConnectParams(FtpPort, FtpUser, FtpPwd)
|
|||
|
|
Dim ftp As UtsFtp = UtsFtp.CreateObject()
|
|||
|
|
ftp.FtpHost = FtpHost
|
|||
|
|
|
|||
|
|
Try
|
|||
|
|
System.IO.Directory.CreateDirectory(Application.StartupPath & g_Xml_FullPath_BaseedOnTempFolder)
|
|||
|
|
ftp.CreateDir(g_Xml_FullPath_BaseedOnTempFolder) '创建文件夹
|
|||
|
|
Catch ex As Exception
|
|||
|
|
Throw New Exception($"创建客户Ftp文件夹失败,{ex.Message}")
|
|||
|
|
Return False
|
|||
|
|
End Try
|
|||
|
|
|
|||
|
|
Return True
|
|||
|
|
End Function
|
|||
|
|
|
|||
|
|
Private Sub FrmMain_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
|||
|
|
SaveSettings()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub TvwMain_ForeColorChanged(sender As Object, e As EventArgs) Handles TvwMain.ForeColorChanged
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub tsb_ReleaseToProjcet_Click(sender As Object, e As EventArgs) Handles tsb_ReleaseToProjcet.Click
|
|||
|
|
ReleaseConfigXmlToDB()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub tsb_SetTreeViewVisableOrNot_Click(sender As Object, e As EventArgs) Handles tsb_SetTreeViewVisableOrNot.Click
|
|||
|
|
g_IsProjectTreeView_Visable = Not g_IsProjectTreeView_Visable
|
|||
|
|
SplitContainer1.Panel1Collapsed = g_IsProjectTreeView_Visable
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub tsb_SaveFile_Click(sender As Object, e As EventArgs) Handles tsb_SaveFile.Click
|
|||
|
|
If FileExist(g_Xml_FullName) Then
|
|||
|
|
_grdModel.Save(g_Xml_FullName) '保存配置文件
|
|||
|
|
Else
|
|||
|
|
SaveFileAs() '如果文件名不存在则启动“另存为”
|
|||
|
|
End If
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub tsb_OpenFileFolder_Click(sender As Object, e As EventArgs) Handles tsb_OpenFileFolder.Click
|
|||
|
|
If FileExist(g_Xml_FullName) Then
|
|||
|
|
g_Xml_FilePath = GetFilePath(g_Xml_FullName)
|
|||
|
|
Shell("explorer.exe /select," & g_Xml_FullName, vbNormalFocus)
|
|||
|
|
Else
|
|||
|
|
MsgBox("文件尚未保存,必须保存后才能通过目录打开!", MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "文件尚未保存")
|
|||
|
|
End If
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub tsb_ExportToExcel_Click(sender As Object, e As EventArgs) Handles tsb_ExportToExcel.Click
|
|||
|
|
Using saveFileDialog As New SaveFileDialog
|
|||
|
|
|
|||
|
|
Dim tmpInitDir As String = Application.StartupPath & "\Temp\Config\"
|
|||
|
|
Dim tmpExcelFileName As String = ""
|
|||
|
|
|
|||
|
|
With saveFileDialog
|
|||
|
|
.InitialDirectory = tmpInitDir
|
|||
|
|
.RestoreDirectory = True
|
|||
|
|
.OverwritePrompt = True
|
|||
|
|
.AddExtension = True
|
|||
|
|
.DefaultExt = ".xls"
|
|||
|
|
.Title = "导出到Excel文件"
|
|||
|
|
.Filter = $"Excel文件(*.xls)|*.xls"
|
|||
|
|
End With
|
|||
|
|
|
|||
|
|
|
|||
|
|
If saveFileDialog.ShowDialog() = DialogResult.OK Then
|
|||
|
|
tmpExcelFileName = saveFileDialog.FileName
|
|||
|
|
_grdModel.ExportToXls(tmpExcelFileName)
|
|||
|
|
End If
|
|||
|
|
End Using
|
|||
|
|
|
|||
|
|
UpdateWindowTitle()
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub tsb_SyncConfigFiles_Click(sender As Object, e As EventArgs) Handles tsb_SyncConfigFiles.Click
|
|||
|
|
DownloadXmlFile(_project.VerdorName, _project.HotelCode, _project.HotelName, _project.RoomType(g_CurrentTreeNodeRoomTypeItemIndex).structRoomType_XML_Filename)
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
#End Region
|
|||
|
|
|
|||
|
|
|
|||
|
|
End Class
|
|||
|
|
|
|||
|
|
<Serializable>
|
|||
|
|
Public Class DemoClass
|
|||
|
|
Public Name As String
|
|||
|
|
Public Age As String
|
|||
|
|
Public Room As RoomType
|
|||
|
|
|
|||
|
|
Sub New()
|
|||
|
|
Name = "N"
|
|||
|
|
Age = "A"
|
|||
|
|
|
|||
|
|
Room = New RoomType
|
|||
|
|
|
|||
|
|
Room.HotelID = 1
|
|||
|
|
Room.RoomType = 2
|
|||
|
|
Room.XmlFile = 3
|
|||
|
|
Room.BinFile = 4
|
|||
|
|
Room.BinFileMd5 = 5
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Public Overrides Function ToString() As String
|
|||
|
|
Return $"Name:{Name},Age:{Age},HID:{Room.HotelID},HT:{Room.RoomType}"
|
|||
|
|
End Function
|
|||
|
|
End Class
|
|||
|
|
|
|||
|
|
<Serializable>
|
|||
|
|
Public Class RoomType
|
|||
|
|
Public Property HotelID As String
|
|||
|
|
Public Property HotelCode As String
|
|||
|
|
Public Property RoomType As String
|
|||
|
|
Public Property RoomTypeIdx As String
|
|||
|
|
Public Property XmlFile As String
|
|||
|
|
Public Property BinFile As String
|
|||
|
|
Public Property BinFileMd5 As String
|
|||
|
|
|
|||
|
|
End Class
|