一、Common层
二、DataAccess层
三、Rule层
四、BusinessFacade层
五、UI层
代码实现
一、Common层
Model类定义
代码
Imports Common.ServerData
<Serializable()> _
Public Class BillModel
#Region "New"
Public Sub New()
Me.data = New BillBase()
End Sub
Public Sub New(ByVal data As BillBase)
Me.data = data
'Me.Itms = New List(Of GuestModel)(data.Itms)
If data.Itms Is Nothing Then Exit Sub
Me.Itms = New List(Of GuestModel)
For Each itm As GuestBase In data.Itms
Dim gs As GuestModel = New GuestModel(itm)
Me.Itms.Add(gs)
Next
End Sub
Public Sub New(ByVal data As DataRow)
Me.data = New BillBase(data)
Me.Itms = New List(Of GuestModel)()
End Sub
Public Sub New(ByVal dr As DataRow, ByVal data As DataTable, ByVal billNew As HotelDelegate.BillModelDelegate)
Me.data = New BillBase(dr)
Me.Itms = billNew.Invoke(Me.data.Id, data)
End Sub
#End Region
#Region "Field"
Public data As BillBase
Public Itms As List(Of GuestModel) ' GuestCollection
''' <summary>
''' 客帐余额.
''' </summary>
''' <value>The account left.</value>
Public ReadOnly Property AccountLeft() As Decimal
Get
Return Me.data.AccountEnd - Me.data.AccountPrecash
End Get
End Property
#End Region
End Class
<Serializable()> _
Public Class BillModel
#Region "New"
Public Sub New()
Me.data = New BillBase()
End Sub
Public Sub New(ByVal data As BillBase)
Me.data = data
'Me.Itms = New List(Of GuestModel)(data.Itms)
If data.Itms Is Nothing Then Exit Sub
Me.Itms = New List(Of GuestModel)
For Each itm As GuestBase In data.Itms
Dim gs As GuestModel = New GuestModel(itm)
Me.Itms.Add(gs)
Next
End Sub
Public Sub New(ByVal data As DataRow)
Me.data = New BillBase(data)
Me.Itms = New List(Of GuestModel)()
End Sub
Public Sub New(ByVal dr As DataRow, ByVal data As DataTable, ByVal billNew As HotelDelegate.BillModelDelegate)
Me.data = New BillBase(dr)
Me.Itms = billNew.Invoke(Me.data.Id, data)
End Sub
#End Region
#Region "Field"
Public data As BillBase
Public Itms As List(Of GuestModel) ' GuestCollection
''' <summary>
''' 客帐余额.
''' </summary>
''' <value>The account left.</value>
Public ReadOnly Property AccountLeft() As Decimal
Get
Return Me.data.AccountEnd - Me.data.AccountPrecash
End Get
End Property
#End Region
End Class
代码
Imports HNA.Common.ServerData
<Serializable()> _
Public Class GuestModel
#Region "New"
Public Sub New()
Me.data = New GuestBase()
End Sub
'Public Sub New(ByVal rm As RoomModel, ByVal vGuestDelegate As HotelDelegate.GuestModelDelegate(Of RoomModel))
' Me.data = New GuestBase()
' vGuestDelegate.Invoke(Me, rm)
'End Sub
Public Sub New(ByVal user As UserModel, ByVal rm As RoomModel, ByVal vGuestDelegate As HotelDelegate.GuestModelDelegate(Of RoomModel))
Me.data = New GuestBase()
'vGuestDelegate.Invoke(Me, rm)
'Dim b As GuestBase = vGuestDelegate.Invoke(rm)
Me.data = vGuestDelegate.Invoke(rm)
End Sub
Public Sub New(ByVal user As UserModel, ByVal data As GuestModel, ByVal vGuestDelegate As HotelDelegate.GuestModelDelegate(Of GuestModel))
'Me.data = New GuestBase()
'vGuestDelegate.Invoke(Me, data)
Me.data = New GuestBase()
Me.data = vGuestDelegate.Invoke(data)
End Sub
Public Sub New(ByVal data As DataRow)
Me.data = New GuestBase(data)
End Sub
Public Sub New(ByVal data As GuestBase)
Me.data = data
End Sub
#End Region
#Region "Field"
Public data As GuestBase
Public ReadOnly Property SexName() As String
Get
Return IIf(Me.data.Sex, "男", "女")
End Get
End Property
Private _roomKindName As String
Public Property RoomKindName() As String
<Obsolete("获取该数据请使用Guest中的方法【RoomKindName】", True)> _
Get
Return _roomKindName
End Get
Set(ByVal value As String)
_roomKindName = value
End Set
End Property
'当前房型ID
Private _roomKindId As String
Public Property RoomKindId() As Integer
Set(ByVal value As Integer)
_roomKindId = value
End Set
<Obsolete("获取该数据请使用Guest中的方法【RoomKindId】", True)> _
Get
Return _roomKindId
End Get
End Property
'由散客步入查询产品
Private _curSingleProducts As ProductBaseCollection
Public Property CurSingleProducts() As ProductBaseCollection
<Obsolete("获取该数据请使用Guest中的方法【CurSingleProducts】", True)> _
Get
Return _curSingleProducts
End Get
Set(ByVal value As ProductBaseCollection)
_curSingleProducts = value
End Set
End Property
Private _curProducts As ProductBaseCollection
Public Property CurProducts() As ProductBaseCollection
Set(ByVal value As ProductBaseCollection)
_curProducts = value
End Set
<Obsolete("获取该数据请使用Guest中的方法【CurProducts】", True)> _
Get
Return _curProducts
End Get
End Property
''' <summary>
''' 客帐余额.
''' </summary>
''' <value>The account left.</value>
Public ReadOnly Property AccountLeft() As Decimal
Get
Return Me.data.AccountEnd - Me.data.AccountPrecash
End Get
End Property
Public ReadOnly Property BillTypeName() As String
Get
Return IIf(Me.data.IsTeam, "团客", "散客")
End Get
End Property
Public ReadOnly Property ArrivedTStr() As String
Get
Return Me.data.ArrivedTime.ToString("yyyy-MM-dd") '.Year.ToString + Me.data.ArrivedTime.Month.ToString + Me.data.ArrivedTime.Day.ToString
End Get
End Property
Public ReadOnly Property LeftTStr() As String
Get
Return Me.data.LeftTime.ToString("yyyy-MM-dd") '.Year.ToString + Me.data.LeftTime.Month.ToString + Me.data.LeftTime.Day.ToString
End Get
End Property
Public ReadOnly Property GuestGroup() As String
Get
Return Me.data.GuestGroupName + ":" + Me.data.GuestGroupId.ToString()
End Get
End Property
Public ReadOnly Property StayCount() As Integer
Get
Return (Me.data.LeftTime - Me.data.ArrivedTime).Days
End Get
End Property
Public RoomKindCode As String
#End Region
End Class
<Serializable()> _
Public Class GuestModel
#Region "New"
Public Sub New()
Me.data = New GuestBase()
End Sub
'Public Sub New(ByVal rm As RoomModel, ByVal vGuestDelegate As HotelDelegate.GuestModelDelegate(Of RoomModel))
' Me.data = New GuestBase()
' vGuestDelegate.Invoke(Me, rm)
'End Sub
Public Sub New(ByVal user As UserModel, ByVal rm As RoomModel, ByVal vGuestDelegate As HotelDelegate.GuestModelDelegate(Of RoomModel))
Me.data = New GuestBase()
'vGuestDelegate.Invoke(Me, rm)
'Dim b As GuestBase = vGuestDelegate.Invoke(rm)
Me.data = vGuestDelegate.Invoke(rm)
End Sub
Public Sub New(ByVal user As UserModel, ByVal data As GuestModel, ByVal vGuestDelegate As HotelDelegate.GuestModelDelegate(Of GuestModel))
'Me.data = New GuestBase()
'vGuestDelegate.Invoke(Me, data)
Me.data = New GuestBase()
Me.data = vGuestDelegate.Invoke(data)
End Sub
Public Sub New(ByVal data As DataRow)
Me.data = New GuestBase(data)
End Sub
Public Sub New(ByVal data As GuestBase)
Me.data = data
End Sub
#End Region
#Region "Field"
Public data As GuestBase
Public ReadOnly Property SexName() As String
Get
Return IIf(Me.data.Sex, "男", "女")
End Get
End Property
Private _roomKindName As String
Public Property RoomKindName() As String
<Obsolete("获取该数据请使用Guest中的方法【RoomKindName】", True)> _
Get
Return _roomKindName
End Get
Set(ByVal value As String)
_roomKindName = value
End Set
End Property
'当前房型ID
Private _roomKindId As String
Public Property RoomKindId() As Integer
Set(ByVal value As Integer)
_roomKindId = value
End Set
<Obsolete("获取该数据请使用Guest中的方法【RoomKindId】", True)> _
Get
Return _roomKindId
End Get
End Property
'由散客步入查询产品
Private _curSingleProducts As ProductBaseCollection
Public Property CurSingleProducts() As ProductBaseCollection
<Obsolete("获取该数据请使用Guest中的方法【CurSingleProducts】", True)> _
Get
Return _curSingleProducts
End Get
Set(ByVal value As ProductBaseCollection)
_curSingleProducts = value
End Set
End Property
Private _curProducts As ProductBaseCollection
Public Property CurProducts() As ProductBaseCollection
Set(ByVal value As ProductBaseCollection)
_curProducts = value
End Set
<Obsolete("获取该数据请使用Guest中的方法【CurProducts】", True)> _
Get
Return _curProducts
End Get
End Property
''' <summary>
''' 客帐余额.
''' </summary>
''' <value>The account left.</value>
Public ReadOnly Property AccountLeft() As Decimal
Get
Return Me.data.AccountEnd - Me.data.AccountPrecash
End Get
End Property
Public ReadOnly Property BillTypeName() As String
Get
Return IIf(Me.data.IsTeam, "团客", "散客")
End Get
End Property
Public ReadOnly Property ArrivedTStr() As String
Get
Return Me.data.ArrivedTime.ToString("yyyy-MM-dd") '.Year.ToString + Me.data.ArrivedTime.Month.ToString + Me.data.ArrivedTime.Day.ToString
End Get
End Property
Public ReadOnly Property LeftTStr() As String
Get
Return Me.data.LeftTime.ToString("yyyy-MM-dd") '.Year.ToString + Me.data.LeftTime.Month.ToString + Me.data.LeftTime.Day.ToString
End Get
End Property
Public ReadOnly Property GuestGroup() As String
Get
Return Me.data.GuestGroupName + ":" + Me.data.GuestGroupId.ToString()
End Get
End Property
Public ReadOnly Property StayCount() As Integer
Get
Return (Me.data.LeftTime - Me.data.ArrivedTime).Days
End Get
End Property
Public RoomKindCode As String
#End Region
End Class
代码
Namespace ServerData
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
<Serializable()> _
Public Class BillBase
Inherits RecordBase
Public Sub New()
MyBase.New()
Me.MemberCardNo = ""
Me.Company = ""
Me.Code = ""
Me.Computer = ""
Me.AddressCompany = ""
Me.AddressHome = ""
Me.BalanceNo = ""
Me.GuestName = ""
Me.MobileNo = ""
Me.PactCompany = ""
Me.PactNo = ""
Me.Remark = ""
Me.TeamName = ""
Me.TelphoneCompany = ""
Me.TelphoneHome = ""
End Sub
Public Sub New(ByVal data As DataRow)
MyBase.New(data)
CList.SetFieldValue(CList.clnBill, data, Me)
' If data.Table.Columns.Contains("cTeamName") Then
' Me.TeamCode = IIf(data("cTeamName") Is DBNull.Value, "", data("cTeamName"))
'End If
End Sub
Public Sub New(ByVal dr As DataRow, ByVal data As DataTable)
MyBase.New(dr)
CList.SetFieldValue(CList.clnBill, dr, Me)
Me.Itms = New GuestBaseCollection()
If data Is Nothing Then Exit Sub
For Each rw As DataRow In data.Rows
If rw("nBillId") = Me.Id Then
Dim itm As GuestBase = New GuestBase(rw)
Me.Itms.Add(itm)
End If
Next
End Sub
#Region "field"
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public Code As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public ReserveId As Integer
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public ReserveCode As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public BillStateId As Integer
''' <summary>
''' ''' </summary>
Public BillStateName As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public TeamName As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public TeamCode As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public MemberId As Integer
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public MemberCardNo As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public Company As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public PactNo As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public PactCompany As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public GuestName As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public MobileNo As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public TelphoneHome As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public TelphoneCompany As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public AddressHome As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public AddressCompany As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public BalanceId As Integer
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public BalanceNo As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public RentKindId As Integer
''' <summary>
'''
''' </summary>
Public RentKindName As String
''' <summary>
'''
''' </summary>
Public RentKindCode As String
''' <summary>
'''
''' </summary>
''' <remarks></remarks>
Public LicensedId As Integer
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public ArrivedTime As DateTime
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public LeftTime As DateTime
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public IsTeam As Boolean
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public SalesmanId As Integer
''' <summary>
''' ''' </summary>
Public AuthorizerId As Integer
''' <summary>
''' ''' </summary>
Public AccountTypeId As Integer
''' <summary>
''' ''' </summary>
Public AccountAll As Decimal
''' <summary>
''' ''' </summary>
Public AccountEnd As Decimal
''' <summary>
''' ''' </summary>
Public AccountPrecash As Decimal
Public UserName As String
Public AccountTypeName As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public ReserveName As String = ""
Public Itms As GuestBaseCollection
#End Region
#Region "Function"
Public Overridable Function CheckAccntCtrl(ByVal consumeKindId As Integer) As Boolean
Throw New Exception("调用未实现方法:ServerData.BillBase.CheckAccntCtrl()")
End Function
#End Region
End Class
End Namespace
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
<Serializable()> _
Public Class BillBase
Inherits RecordBase
Public Sub New()
MyBase.New()
Me.MemberCardNo = ""
Me.Company = ""
Me.Code = ""
Me.Computer = ""
Me.AddressCompany = ""
Me.AddressHome = ""
Me.BalanceNo = ""
Me.GuestName = ""
Me.MobileNo = ""
Me.PactCompany = ""
Me.PactNo = ""
Me.Remark = ""
Me.TeamName = ""
Me.TelphoneCompany = ""
Me.TelphoneHome = ""
End Sub
Public Sub New(ByVal data As DataRow)
MyBase.New(data)
CList.SetFieldValue(CList.clnBill, data, Me)
' If data.Table.Columns.Contains("cTeamName") Then
' Me.TeamCode = IIf(data("cTeamName") Is DBNull.Value, "", data("cTeamName"))
'End If
End Sub
Public Sub New(ByVal dr As DataRow, ByVal data As DataTable)
MyBase.New(dr)
CList.SetFieldValue(CList.clnBill, dr, Me)
Me.Itms = New GuestBaseCollection()
If data Is Nothing Then Exit Sub
For Each rw As DataRow In data.Rows
If rw("nBillId") = Me.Id Then
Dim itm As GuestBase = New GuestBase(rw)
Me.Itms.Add(itm)
End If
Next
End Sub
#Region "field"
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public Code As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public ReserveId As Integer
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public ReserveCode As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public BillStateId As Integer
''' <summary>
''' ''' </summary>
Public BillStateName As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public TeamName As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public TeamCode As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public MemberId As Integer
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public MemberCardNo As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public Company As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public PactNo As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public PactCompany As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public GuestName As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public MobileNo As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public TelphoneHome As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public TelphoneCompany As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public AddressHome As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public AddressCompany As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public BalanceId As Integer
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public BalanceNo As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public RentKindId As Integer
''' <summary>
'''
''' </summary>
Public RentKindName As String
''' <summary>
'''
''' </summary>
Public RentKindCode As String
''' <summary>
'''
''' </summary>
''' <remarks></remarks>
Public LicensedId As Integer
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public ArrivedTime As DateTime
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public LeftTime As DateTime
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public IsTeam As Boolean
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public SalesmanId As Integer
''' <summary>
''' ''' </summary>
Public AuthorizerId As Integer
''' <summary>
''' ''' </summary>
Public AccountTypeId As Integer
''' <summary>
''' ''' </summary>
Public AccountAll As Decimal
''' <summary>
''' ''' </summary>
Public AccountEnd As Decimal
''' <summary>
''' ''' </summary>
Public AccountPrecash As Decimal
Public UserName As String
Public AccountTypeName As String
''' <summary>
''' ''' </summary>
''' <remarks></remarks>
Public ReserveName As String = ""
Public Itms As GuestBaseCollection
#End Region
#Region "Function"
Public Overridable Function CheckAccntCtrl(ByVal consumeKindId As Integer) As Boolean
Throw New Exception("调用未实现方法:ServerData.BillBase.CheckAccntCtrl()")
End Function
#End Region
End Class
End Namespace