Mini Kabibi Habibi
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports DevExpress.Web.ASPxEditors
Public NotInheritable Class Utils
Public Const GridImageSize As Integer = 200
Public Const OrderImageSize As Integer = 260
Public Const PopupImageSize As Integer = 600
Private Sub New()
End Sub
Public Shared Function GetOrderFormUrl(ByVal hotel As Object) As String
Dim title As String = (TryCast(hotel, Hotel)).Title
Return String.Format("Order.aspx?h={0}", title.Replace(" ", "_").Replace("&", "AMP"))
End Function
Public Shared Sub ValidateCheckInDate(ByVal e As ValidationEventArgs)
If CDate(e.Value) < DateTime.Now Then
e.IsValid = False
e.ErrorText = "Date should be later then current"
End If
End Sub
Public Shared Sub ValidateCheckOutDate(ByVal checkInDate As DateTime, ByVal e As ValidationEventArgs)
If CDate(e.Value) < checkInDate Then
e.IsValid = False
e.ErrorText = "Checkout date should be later then checkin date"
End If
End Sub
Public Shared Function GetImageUrl(ByVal url As String, ByVal size As Integer) As String
Return String.Format("Thumb.ashx?i={0}&size={1}", url, size)
End Function
Public Shared Function GetPageTitle(ByVal currentTitle As String) As String
If String.IsNullOrEmpty(currentTitle) Then
Return "Hotel Booking - Powered by DevExpres Inc"
End If
Return String.Format("{0} - Hotel Booking - Powered by DevExpres Inc", HttpUtility.HtmlEncode(currentTitle))
End Function
Public Shared Sub SetDefaultDateEditValues(ByVal deCheckIn As ASPxDateEdit, ByVal deCheckOut As ASPxDateEdit)
deCheckIn.Value = DateTime.Now.AddDays(3)
deCheckOut.Value = DateTime.Now.AddDays(6)
deCheckIn.MinDate = DateTime.Now
deCheckOut.MinDate = DateTime.Now.AddDays(1)
End Sub
End Class