// Restrictions, guarantee, cancellation, and deposit policy support properties and methods public string RateRestrictions(AvCalRoomRate objRoomRate, AvCalRate objRate) { StringBuilder sb = new StringBuilder(); if (objRate.MinLOS > 1) { sb.Append((String)GetGlobalResourceObject("SiteResources", "MinLengthOfStay")); sb.Append(" "); } if (objRate.MaxLOS != 9999) { sb.Append((String)GetGlobalResourceObject("SiteResources", "MaxLengthOfStay")); sb.Append(" "); } if (objRoomRate.MinAdvBook != 0) { sb.Append((String)GetGlobalResourceObject("SiteResources", "MinAPDays")); sb.Append(" "); } if (objRoomRate.MaxAdvBook != 9999) { sb.Append((String)GetGlobalResourceObject("SiteResources", "MaxAPDays")); sb.Append(" "); } if (objRate.Status == AvailStatus.ClosedToArrival) { sb.Append((String)GetGlobalResourceObject("SiteResources", "ClosedToArrival")); sb.Append(" "); } string strRestrictions = sb.ToString(); strRestrictions = strRestrictions.Replace("{min_los_days}", objRate.MinLOS.ToString()); strRestrictions = strRestrictions.Replace("{max_los_days}", objRate.MaxLOS.ToString()); strRestrictions = strRestrictions.Replace("{min_ap_days}", objRoomRate.MinAdvBook.ToString()); strRestrictions = strRestrictions.Replace("{max_ap_days}", objRoomRate.MaxAdvBook.ToString()); return strRestrictions; }
private bool IsAvCalRoomRateAvailable(int intDayID, AvCalRoomRate objRoomRate, AvCalRatePlan[] objRatePlans, DateTime dtCalendarBase, DateTime dtToday) { // Returns true if room rate is available in single calendar instance for room rate and day identified DateTime dtCalendarDate = dtCalendarBase.AddDays(intDayID - 1).Date; if (dtCalendarDate < dtToday) return false; if (ConfigurationManager.AppSettings["EnableRoomRateDescriptionModel"] == "1") { // Must be "active" or negotiated / consortia rate to appear in calendar if (objRoomRate.DescriptionStatus != RoomRateDescriptionStatus.Active) { for (int i = 0; i < objRatePlans.Length; i++) { if (objRatePlans[i].RatePlanCode == objRoomRate.RatePlanCode) { if (objRatePlans[i].RatePlanType != RatePlanType.Negotiated && objRatePlans[i].RatePlanType != RatePlanType.Consortia) { return false; } break; } } } } if (objRoomRate.MinAdvBook != 0) { if (((TimeSpan)dtCalendarDate.Subtract(dtToday)).Days < objRoomRate.MinAdvBook) return false; } if (objRoomRate.MaxAdvBook != 9999) { if (((TimeSpan)dtCalendarDate.Subtract(dtToday)).Days > objRoomRate.MaxAdvBook) return false; } for (int i = 0; i < objRoomRate.Rates.Length; i++) { if (objRoomRate.Rates[i].DayNum == intDayID) { if (objRoomRate.Rates[i].Status == AvailStatus.Open || objRoomRate.Rates[i].Status == AvailStatus.ClosedToArrival) return true; else return false; } } return false; }