Mini Kabibi Habibi

Current Path : C:/Users/Public/Documents/DXperience 13.1 Demos/ASP.NET/VB/HotelBooking/App_Code/
Upload File :
Current File : C:/Users/Public/Documents/DXperience 13.1 Demos/ASP.NET/VB/HotelBooking/App_Code/BusinessObjects.vb

Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web

Public Class Hotel
	Public Sub New(ByVal title As String)
		Me.Title = title
		Me.Rooms = New List(Of Room)()
		Me.RoomServices = New List(Of String)()
		Me.HotelServices = New List(Of String)()
		Me.VoteAdresses = New Dictionary(Of String, Decimal)()
		Me.IsExclusive = False
	End Sub

	Private privateTitle As String
	Public Property Title() As String
		Get
			Return privateTitle
		End Get
		Set(ByVal value As String)
			privateTitle = value
		End Set
	End Property
	Private privateCountry As Country
	Public Property Country() As Country
		Get
			Return privateCountry
		End Get
		Set(ByVal value As Country)
			privateCountry = value
		End Set
	End Property
	Private privateCity As String
	Public Property City() As String
		Get
			Return privateCity
		End Get
		Set(ByVal value As String)
			privateCity = value
		End Set
	End Property
	Private privateStars As Integer
	Public Property Stars() As Integer
		Get
			Return privateStars
		End Get
		Set(ByVal value As Integer)
			privateStars = value
		End Set
	End Property
	Private privateRooms As List(Of Room)
	Public Property Rooms() As List(Of Room)
		Get
			Return privateRooms
		End Get
		Set(ByVal value As List(Of Room))
			privateRooms = value
		End Set
	End Property
	Private privateRoomServices As List(Of String)
	Public Property RoomServices() As List(Of String)
		Get
			Return privateRoomServices
		End Get
		Set(ByVal value As List(Of String))
			privateRoomServices = value
		End Set
	End Property
	Private privateHotelServices As List(Of String)
	Public Property HotelServices() As List(Of String)
		Get
			Return privateHotelServices
		End Get
		Set(ByVal value As List(Of String))
			privateHotelServices = value
		End Set
	End Property
	Private privateImageUrl As String
	Public Property ImageUrl() As String
		Get
			Return privateImageUrl
		End Get
		Set(ByVal value As String)
			privateImageUrl = value
		End Set
	End Property
	Private privateRating As Decimal
	Public Property Rating() As Decimal
		Get
			Return privateRating
		End Get
		Set(ByVal value As Decimal)
			privateRating = value
		End Set
	End Property
	Private privateVoteCounter As Integer
	Public Property VoteCounter() As Integer
		Get
			Return privateVoteCounter
		End Get
		Set(ByVal value As Integer)
			privateVoteCounter = value
		End Set
	End Property
	Private privateVoteAdresses As Dictionary(Of String, Decimal)
	Public Property VoteAdresses() As Dictionary(Of String, Decimal)
		Get
			Return privateVoteAdresses
		End Get
		Set(ByVal value As Dictionary(Of String, Decimal))
			privateVoteAdresses = value
		End Set
	End Property
	Private privateIsExclusive As Boolean
	Public Property IsExclusive() As Boolean
		Get
			Return privateIsExclusive
		End Get
		Set(ByVal value As Boolean)
			privateIsExclusive = value
		End Set
	End Property
	Private privateDescriptionIndex As Integer()
	Public Property DescriptionIndex() As Integer()
		Get
			Return privateDescriptionIndex
		End Get
		Set(ByVal value As Integer())
			privateDescriptionIndex = value
		End Set
	End Property
	Public ReadOnly Property Description() As String
		Get
		Return String.Format("<p>{0}</p><p>{1}</p><p>{2}</p>", Data.Instance.CommonDescriptions(DescriptionIndex(0)), Data.Instance.HotelDescriptions(DescriptionIndex(1)), Data.Instance.RoomDescriptions(DescriptionIndex(2)))
		End Get
	End Property

	Public ReadOnly Property MinPrice() As Decimal
		Get
			Return Rooms.Min(Function(room) room.Price)
		End Get
	End Property
	Public ReadOnly Property MaxPrice() As Decimal
		Get
			Return Rooms.Max(Function(room) room.Price)
		End Get
	End Property
End Class

Public Class Room
	Public Sub New(ByVal type As String, ByVal adults As Integer, ByVal children As Integer, ByVal price As Decimal)
		Me.Type = type
		Me.Adults = adults
		Me.Children = children
		Me.Price = price
		Me.Id = Guid.NewGuid().ToString()
	End Sub

	Private privateType As String
	Public Property Type() As String
		Get
			Return privateType
		End Get
		Set(ByVal value As String)
			privateType = value
		End Set
	End Property
	Private privateChildren As Integer
	Public Property Children() As Integer
		Get
			Return privateChildren
		End Get
		Protected Set(ByVal value As Integer)
			privateChildren = value
		End Set
	End Property
	Private privateAdults As Integer
	Public Property Adults() As Integer
		Get
			Return privateAdults
		End Get
		Protected Set(ByVal value As Integer)
			privateAdults = value
		End Set
	End Property
	Private privatePrice As Decimal
	Public Property Price() As Decimal
		Get
			Return privatePrice
		End Get
		Protected Set(ByVal value As Decimal)
			privatePrice = value
		End Set
	End Property
	Private privateId As String
	Public Property Id() As String
		Get
			Return privateId
		End Get
		Set(ByVal value As String)
			privateId = value
		End Set
	End Property
End Class

Public Class Country
	Public Sub New(ByVal name As String, ByVal imageCode As String, ByVal cities As IEnumerable(Of String), ByVal popularity As Integer)
		Me.Name = name
		Me.ImageCode = imageCode
		Me.Cities = cities.ToList()
		Me.Popularity = popularity
	End Sub

	Private privateName As String
	Public Property Name() As String
		Get
			Return privateName
		End Get
		Protected Set(ByVal value As String)
			privateName = value
		End Set
	End Property
	Private privateImageCode As String
	Protected Property ImageCode() As String
		Get
			Return privateImageCode
		End Get
		Set(ByVal value As String)
			privateImageCode = value
		End Set
	End Property
	Public ReadOnly Property ImageUrl() As String
		Get
			Return String.Format("~/Content/Images/Flags/{0}.png", ImageCode)
		End Get
	End Property
	Private privatePopularity As Integer
	Public Property Popularity() As Integer
		Get
			Return privatePopularity
		End Get
		Protected Set(ByVal value As Integer)
			privatePopularity = value
		End Set
	End Property
	Public ReadOnly Property IsPopular() As Boolean
		Get
			Return Popularity > 0
		End Get
	End Property
	Private privateCities As List(Of String)
	Public Property Cities() As List(Of String)
		Get
			Return privateCities
		End Get
		Protected Set(ByVal value As List(Of String))
			privateCities = value
		End Set
	End Property
End Class