457 lines
15 KiB
VB.net
457 lines
15 KiB
VB.net
Imports System.ComponentModel
|
||
|
||
Public Class FrmHotelList
|
||
|
||
#Region "多语种信息"
|
||
|
||
''' <summary>
|
||
''' 初始化界面控件文本
|
||
''' </summary>
|
||
Private Sub MultiLanguageInfo()
|
||
Text = LanguageData.StringList(MultiLanguageDAL.StringEnum.HotelList)
|
||
Button5.Text = LanguageData.StringList(MultiLanguageDAL.StringEnum.Checked)
|
||
Button1.Text = LanguageData.StringList(MultiLanguageDAL.StringEnum.HomeExit)
|
||
|
||
End Sub
|
||
|
||
|
||
#End Region
|
||
|
||
#Region "初始化信息"
|
||
|
||
Private _count As Integer = 0
|
||
Public FCsConfig As FrmCSeriesConfig
|
||
''' <summary>
|
||
''' 初始化酒店列表
|
||
''' </summary>
|
||
''' <param name="match"></param>
|
||
Public Sub InitHotelList(match As Boolean, mainfrom As FrmCSeriesConfig)
|
||
FCsConfig = mainfrom
|
||
If match = False Then
|
||
TreeView1.Nodes.Clear()
|
||
Grid5.NewFile()
|
||
InitHotelTable()
|
||
_count = 0
|
||
Button5.ForeColor = Color.Green
|
||
Button5.Text = $"{LanguageData.StringList(MultiLanguageDAL.StringEnum.Checked)}"
|
||
TreeView1.Enabled = True
|
||
Grid5.Enabled = True
|
||
End If
|
||
|
||
LblUserInfo.Text = $"{LanguageData.StringList(MultiLanguageDAL.StringEnum.WelcomeYou)}!{_userNames} {LanguageData.StringList(MultiLanguageDAL.StringEnum.PleaseSelectYourHotel)}!"
|
||
_count += 1
|
||
If _count = 1 Then
|
||
MultiLanguageInfo()
|
||
InitHotelInfo()
|
||
End If
|
||
InitLoadHotelInfo()
|
||
End Sub
|
||
|
||
|
||
#End Region
|
||
|
||
#Region "权限管理_酒店管理"
|
||
|
||
|
||
''' <summary>
|
||
''' 权限列表
|
||
''' </summary>
|
||
Enum EnAuthInfo
|
||
|
||
''' <summary> 空 </summary>
|
||
Null
|
||
''' <summary> 锁定权限 </summary>
|
||
Lock
|
||
''' <summary> 授权时间 </summary>
|
||
AuthorizedTime
|
||
|
||
Auth3
|
||
|
||
Auth4
|
||
|
||
Auth5
|
||
|
||
Auth6
|
||
|
||
Auth7
|
||
|
||
Auth8
|
||
|
||
Auth9
|
||
|
||
''' <summary> 升级/房态/季节 </summary>
|
||
UpdateAndRoomStateAndSeason
|
||
|
||
Auth11
|
||
|
||
Auth12
|
||
|
||
Auth13
|
||
|
||
Auth14
|
||
|
||
Auth15
|
||
|
||
Auth16
|
||
|
||
''' <summary> 研发管理 </summary>
|
||
ResearchManage
|
||
|
||
Auth18
|
||
|
||
''' <summary> 批量下发 </summary>
|
||
BatchIssued
|
||
|
||
End Enum
|
||
|
||
|
||
Private Sub Grid5_Click(Sender As Object, e As EventArgs) Handles Grid5.Click
|
||
If Grid5.ActiveCell.Row > 0 Then
|
||
_projectNumber = Grid5.Cell(Grid5.ActiveCell.Row, HotelDataCol.ProjectNumber).Text
|
||
_HotelName = Grid5.Cell(Grid5.ActiveCell.Row, HotelDataCol.HotelName).Text
|
||
End If
|
||
End Sub
|
||
|
||
|
||
''' <summary>
|
||
''' 选择酒店事件
|
||
''' </summary>
|
||
''' <param name="sender"></param>
|
||
''' <param name="e"></param>
|
||
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
|
||
Buttin5click()
|
||
End Sub
|
||
Public Sub Buttin5click()
|
||
FCsConfig.NoAuthority()
|
||
If Button5.Text = $"{LanguageData.StringList(MultiLanguageDAL.StringEnum.Checked)}" Then
|
||
If TipInfo() = False Then Return
|
||
AddAuthorityInfo()
|
||
|
||
Button5.ForeColor = Color.Red
|
||
Button5.Text = $"{LanguageData.StringList(MultiLanguageDAL.StringEnum.Loosen)}"
|
||
|
||
TreeView1.Enabled = False
|
||
Grid5.Enabled = False
|
||
ElseIf Button5.Text = $"{LanguageData.StringList(MultiLanguageDAL.StringEnum.Loosen)}" Then
|
||
Button5.ForeColor = Color.Green
|
||
Button5.Text = $"{LanguageData.StringList(MultiLanguageDAL.StringEnum.Checked)}"
|
||
|
||
TreeView1.Enabled = True
|
||
Grid5.Enabled = True
|
||
End If
|
||
|
||
FCsConfig.LblUserNames.Text = $"{LanguageData.StringList(MultiLanguageDAL.StringEnum.TheCurrentHotel)}:{_projectNumber}-{_HotelName} | {_userNames} {LanguageData.StringList(MultiLanguageDAL.StringEnum.WelcomeYou)}! "
|
||
FCsConfig.TextBox9.Text = _projectNumber
|
||
'FCsConfig.ComboBox16.Text = ""
|
||
FCsConfig.ComboBox16.Items.Clear()
|
||
FCsConfig.ComboBox17.Text = ""
|
||
FCsConfig.ComboBox17.Items.Clear()
|
||
FCsConfig.CBoRoomTpRemark.Checked = False
|
||
FCsConfig.CBoRoomNuRemark.Checked = False
|
||
FCsConfig.CheckBox37.Checked = False
|
||
FCsConfig.Network_cke.Checked = False
|
||
FCsConfig.Iptype_txt.Text = ""
|
||
FCsConfig.Loadip_txt.Text = ""
|
||
FCsConfig.IPMask_txt.Text = ""
|
||
FCsConfig.IPGateway_txt.Text = ""
|
||
FCsConfig.ServerIP_txt.Text = ""
|
||
FCsConfig.ipconfig_txt.Text = ""
|
||
FCsConfig.IpDns_txt.Text = ""
|
||
FCsConfig.IpPort_txt.Text = ""
|
||
FCsConfig.TextBox25.Text = ""
|
||
FCsConfig.TextBox21.Text = ""
|
||
AuthorityInfo(FCsConfig)
|
||
End Sub
|
||
|
||
|
||
''' <summary>
|
||
''' 提示信息
|
||
''' </summary>
|
||
''' <returns></returns>
|
||
Private Function TipInfo() As Boolean
|
||
If Grid5.Cell(Grid5.ActiveCell.Row, HotelDataCol.ProjectNumber).Text = Nothing Then
|
||
MsgBox($"{LanguageData.StringList(MultiLanguageDAL.StringEnum.PleaseSelectTheHotelUnderYourName)}!")
|
||
Return False
|
||
End If
|
||
If _projectNumber = $"" Then
|
||
MsgBox($"{LanguageData.StringList(MultiLanguageDAL.StringEnum.PleaseSelectTheHotelUnderYourName)}!")
|
||
Return False
|
||
End If
|
||
If _HotelName = $"" Then
|
||
MsgBox($"{LanguageData.StringList(MultiLanguageDAL.StringEnum.PleaseSelectTheHotelUnderYourName)}!")
|
||
Return False
|
||
End If
|
||
|
||
Return True
|
||
End Function
|
||
|
||
|
||
''' <summary>
|
||
''' 添加权限
|
||
''' </summary>
|
||
Public Sub AddAuthorityInfo()
|
||
_authorityInfo.Clear()
|
||
For index = 0 To _loginData.Values.Count - 1
|
||
If _HotelName = _loginData.Values(index).HotelName AndAlso _projectNumber = _loginData.Values(index).Code Then
|
||
|
||
_authorityInfo.Add(_loginData.Values(index).AuthorityId, _loginData.Values(index).AuthotypeId)
|
||
End If
|
||
Next
|
||
End Sub
|
||
|
||
|
||
''' <summary>
|
||
''' 添加上一次保存的酒店权限
|
||
''' </summary>
|
||
Public Sub AddLastTimeAuthorityInfo()
|
||
_authorityInfo.Clear()
|
||
For index = 0 To _loginData.Values.Count - 1
|
||
If My.Settings.HotelName = _loginData.Values(index).HotelName AndAlso My.Settings.ProjectCode = _loginData.Values(index).Code Then
|
||
_authorityInfo.Add(_loginData.Values(index).AuthorityId, _loginData.Values(index).AuthotypeId)
|
||
End If
|
||
Next
|
||
End Sub
|
||
|
||
|
||
|
||
''' <summary>
|
||
''' 权限管理_权限信息
|
||
''' </summary>
|
||
Public Sub AuthorityInfo(Config As FrmCSeriesConfig)
|
||
FCsConfig = Config
|
||
For index = 0 To _authorityInfo.Count - 1
|
||
Select Case _authorityInfo.Keys(index)
|
||
Case EnAuthInfo.Lock '锁定
|
||
FCsConfig.LockAuth(_authorityInfo.Values(index))
|
||
Case EnAuthInfo.AuthorizedTime '授权时间
|
||
FCsConfig.AuthorizedTimeAuth(_authorityInfo.Values(index))
|
||
Case EnAuthInfo.UpdateAndRoomStateAndSeason '升级&房态&季节
|
||
FCsConfig.UpdateRoomStateSeasonAuth(_authorityInfo.Values(index))
|
||
Case EnAuthInfo.ResearchManage '研发管理
|
||
FCsConfig.UpdateResearchManageAuth(_authorityInfo.Values(index))
|
||
Case EnAuthInfo.BatchIssued '批量下发
|
||
FCsConfig.UpdateBatchIssuedAuth(_authorityInfo.Values(index))
|
||
End Select
|
||
Next
|
||
End Sub
|
||
|
||
|
||
|
||
'''' <summary>
|
||
'''' 选择页面
|
||
'''' </summary>
|
||
'''' <param name="sender"></param>
|
||
'''' <param name="e"></param>
|
||
'Private Sub TabControl1_Selecting(sender As Object, e As TabControlCancelEventArgs) Handles TabControl1.Selecting
|
||
' If Button5.Text = $"{LanguageData.StringList(MultiLanguageDAL.StringEnum.Checked)}" Then
|
||
' MsgBox($"{LanguageData.StringList(MultiLanguageDAL.StringEnum.PleaseSelectTheHotelUnderYourName)}!")
|
||
' e.Cancel = True
|
||
' End If
|
||
'End Sub
|
||
|
||
|
||
''' <summary>
|
||
''' 初始化酒店区域信息
|
||
''' </summary>
|
||
Public Sub InitHotelInfo()
|
||
InitHotelTable()
|
||
Dim nodeOne As TreeNode = TreeView1.Nodes.Add($"{LanguageData.StringList(MultiLanguageDAL.StringEnum.AllHotel)}")
|
||
Dim dic As Dictionary(Of String, Integer) = AddHotelInfo()
|
||
For index = 0 To dic.Count - 1
|
||
nodeOne.Nodes.Add(dic.ElementAt(index).Key & "-(" & dic.ElementAt(index).Value & ")")
|
||
Next
|
||
|
||
End Sub
|
||
|
||
|
||
Public Function AddHotelInfo()
|
||
Dim dic As New Dictionary(Of String, Integer)
|
||
dic.Clear()
|
||
Dim txt As String
|
||
For index = 0 To _loginData.Count - 1
|
||
txt = _loginData.Values(index).HotelGroupsName
|
||
If dic.ContainsKey(txt) Then
|
||
dic(txt) += 1
|
||
Else
|
||
dic.Add(txt, 1)
|
||
'nodeOne.Nodes.Add(txt)
|
||
End If
|
||
Next
|
||
|
||
Return dic
|
||
End Function
|
||
|
||
|
||
''' <summary>
|
||
''' 树状目录点击事件
|
||
''' </summary>
|
||
''' <param name="sender"></param>
|
||
''' <param name="e"></param>
|
||
Private Sub TreeView1_NodeMouseClick(sender As Object, e As TreeNodeMouseClickEventArgs) Handles TreeView1.NodeMouseClick
|
||
'Console.WriteLine(e.Node.Text & " " & e.Node.Index & " " & e.Node.Level & " " & e.Node.FullPath)
|
||
'Grid5.DisplayRowNumber = True
|
||
Dim str As String() = e.Node.Text.Split($"-")
|
||
'Console.WriteLine($"点击酒店:" & str(0))
|
||
|
||
Grid5.NewFile()
|
||
InitHotelTable()
|
||
|
||
Dim rowCount As Integer = 0
|
||
Dim dic As New Dictionary(Of String, Integer)
|
||
For index = 0 To _loginData.Values.Count - 1
|
||
If str(0) = _loginData.Values(index).HotelGroupsName Then
|
||
'HotelGroupsName = _loginData.Values(index).HotelGroupsName
|
||
If dic.ContainsKey(_loginData.Values(index).Code) = False Then
|
||
dic.Add(_loginData.Values(index).Code, 1)
|
||
Grid5.Rows += 1
|
||
rowCount += 1
|
||
Grid5.Cell(rowCount, 1).Text = _loginData.Values(index).Code
|
||
|
||
Grid5.Cell(rowCount, 2).Text = _loginData.Values(index).HotelName
|
||
'Grid5.Cell(rowCount, 1).Text = _loginData.Values(_loginData.Values.Count - 1 - index).Code
|
||
'Grid5.Cell(rowCount, 2).Text = _loginData.Values(_loginData.Values.Count - 1 - index).HotelName
|
||
End If
|
||
ElseIf str(0) = $"{LanguageData.StringList(MultiLanguageDAL.StringEnum.AllHotel)}" Then
|
||
'HotelGroupsName = _loginData.Values(index).HotelGroupsName
|
||
If dic.ContainsKey(_loginData.Values(index).Code) = False Then
|
||
dic.Add(_loginData.Values(index).Code, 1)
|
||
Grid5.Rows += 1
|
||
rowCount += 1
|
||
Grid5.Cell(rowCount, 1).Text = _loginData.Values(index).Code
|
||
Grid5.Cell(rowCount, 2).Text = _loginData.Values(index).HotelName
|
||
'Grid5.Cell(rowCount, 1).Text = _loginData.Values(_loginData.Values.Count - 1 - index).Code
|
||
'Grid5.Cell(rowCount, 2).Text = _loginData.Values(_loginData.Values.Count - 1 - index).HotelName
|
||
End If
|
||
End If
|
||
Next
|
||
End Sub
|
||
|
||
|
||
''' <summary>
|
||
''' 酒店区域表列名_枚举
|
||
''' </summary>
|
||
Enum HotelDataCol
|
||
''' <summary> 空 </summary>
|
||
Null
|
||
|
||
''' <summary> 项目编码 </summary>
|
||
ProjectNumber
|
||
|
||
''' <summary> 酒店名称 </summary>
|
||
HotelName
|
||
End Enum
|
||
|
||
''' <summary>
|
||
''' 酒店区域表列名
|
||
''' </summary>
|
||
Private _hotelTable() As String = {$"0", $"{LanguageData.StringList(MultiLanguageDAL.StringEnum.ProjectCode)}", $"{LanguageData.StringList(MultiLanguageDAL.StringEnum.HotelName)}"}
|
||
|
||
''' <summary>
|
||
''' 初始化酒店表格
|
||
''' </summary>
|
||
Private Sub InitHotelTable()
|
||
Grid5.Column(0).Width = 0
|
||
Grid5.Cols = _hotelTable.Length
|
||
Grid5.Rows = 1
|
||
|
||
For index = 1 To Grid5.Cols - 1
|
||
With Grid5.Cell(0, index)
|
||
.ForeColor = Color.Blue
|
||
.Text = _hotelTable(index)
|
||
.ForeColor = Color.DarkCyan
|
||
End With
|
||
|
||
With Grid5.Column(index)
|
||
.Alignment = FlexCell.AlignmentEnum.CenterCenter
|
||
If index = HotelDataCol.ProjectNumber Then
|
||
.Width = 75
|
||
Else
|
||
.Width = 180
|
||
End If
|
||
End With
|
||
Next
|
||
Grid5.SelectionMode = FlexCell.SelectionModeEnum.ByRow '设置选中行
|
||
Grid5.AllowUserSort = True
|
||
End Sub
|
||
|
||
|
||
Private Sub InitLoadHotelInfo()
|
||
Dim amountGrpByDates = From row In _userData
|
||
Group row By dateGroup = New With {
|
||
Key .Code = row.Field(Of Integer)(_userData.Columns(8).ColumnName),
|
||
Key .Name = row.Field(Of String)(_userData.Columns(7).ColumnName)
|
||
} Into Group
|
||
Select New With {
|
||
Key .Code = dateGroup.Code,
|
||
.Name = dateGroup.Name}
|
||
Dim lst = amountGrpByDates.ToList
|
||
|
||
For index = 0 To lst.Count - 1
|
||
Grid5.Rows += 1
|
||
Grid5.Cell(index + 1, 1).Text = lst(index).Code '项目编码
|
||
Grid5.Cell(index + 1, 2).Text = lst(index).Name '酒店名称
|
||
Next
|
||
End Sub
|
||
|
||
|
||
''' <summary>
|
||
''' 关闭窗体
|
||
''' </summary>
|
||
''' <param name="sender"></param>
|
||
''' <param name="e"></param>
|
||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||
My.Settings.ProjectCode = _projectNumber
|
||
My.Settings.HotelName = _HotelName
|
||
My.Settings.UserName = _userNames
|
||
My.Settings.Save()
|
||
Close()
|
||
End Sub
|
||
|
||
#End Region
|
||
|
||
#Region "窗体关闭事件"
|
||
|
||
''' <summary>
|
||
''' 窗体关闭事件
|
||
''' </summary>
|
||
''' <param name="sender"></param>
|
||
''' <param name="e"></param>
|
||
Private Sub FrmHotelList_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
|
||
My.Settings.ProjectCode = _projectNumber
|
||
My.Settings.HotelName = _HotelName
|
||
My.Settings.UserName = _userNames
|
||
My.Settings.Save()
|
||
End Sub
|
||
|
||
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
||
If IsNothing(Grid5) AndAlso Grid5.Rows < 1 AndAlso String.IsNullOrEmpty(TextBox1.Text.Trim) Then Return
|
||
Dim tabstr As String
|
||
For index As Integer = 1 To Grid5.Rows - 1
|
||
tabstr = Grid5.Cell(index, 1).Text.Trim & Grid5.Cell(index, 2).Text.Trim
|
||
If tabstr.Contains(TextBox1.Text.Trim) Then
|
||
Grid5.Row(index).Position = 1
|
||
End If
|
||
Next
|
||
|
||
End Sub
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
#End Region
|
||
|
||
|
||
End Class |