public static AmentyControl BindAmenties(Hotels hotels) { var result = new AmentyControl(); string tab = string.Empty; var amenties = hotels.AmentiesItem; double item = amenties.ActiveFeatures > 0 ? 12 / amenties.ActiveFeatures : 0; string itemClass = item.ToString(CultureInfo.InvariantCulture); if (12 % amenties.ActiveFeatures != 0) { itemClass = "2-5"; } string activeClass = "active"; const string strItem = "<div class=\"col-md-6 col-sm-6 col-xs-6 padding-left-0 padding-right-5\">{0}</div>" + "<div class=\"col-md-6 col-sm-6 col-xs-6 padding-left-5 padding-right-0\">{1}</div>"; var strPool = GetAmentiesString(ref tab, ref itemClass, ref activeClass, hotels.PoolFeatures, amenties.PoolActive, "restaurant", "/images/pool.png", "pool", false); result.PoolAmentyControl = string.Format(strItem, strPool.Item1, strPool.Item2); var strGym = GetAmentiesString(ref tab, ref itemClass, ref activeClass, hotels.GymFeatures, amenties.GymActive, "sports-club", "/images/gym-inactive.png", "fitness and<br/>activities", false); result.GymAmentyControl = string.Format(strItem, strGym.Item1, strGym.Item2); var strSpa = GetAmentiesString(ref tab, ref itemClass, ref activeClass, hotels.SpaFeatures, amenties.SpaActive, "spa-club", "/images/spa.png", "spa", false); result.SpaAmentyControl = string.Format(strItem, strSpa.Item1, strSpa.Item2); var strBusiness = GetAmentiesString(ref tab, ref itemClass, ref activeClass, hotels.OfficeFeatures, amenties.BusinessActive, "pick-up", "/images/handshake.png", "business<br/>services", true); result.BusinessCenterControl = string.Format(strItem, strBusiness.Item1, strBusiness.Item2); var strDinning = GetAmentiesString(ref tab, ref itemClass, ref activeClass, hotels.DinningFeatures, amenties.DinningActive, "dining", "/images/icon_dinning.png", "dining", true); result.DiningControl = string.Format(strItem, strDinning.Item1, strDinning.Item2); var strEvent = GetAmentiesString(ref tab, ref itemClass, ref activeClass, hotels.EventFeatures, amenties.EventActive, "event", "/images/icon_event.png", "events", true); result.EventControl = string.Format(strItem, strEvent.Item1, strEvent.Item2); result.MainTabString = tab; return(result); }
protected void SetHotelData(ref Hotels hotels, int hotelId) { var amentyItem = AmentiesList.First(x => x.HotelId == hotelId); hotels.AmentiesItem = amentyItem; hotels.PoolAmentyListses = AmentyListsList.Where(x => x.AmentyId == amentyItem.Id && x.IsActive.HasValue && x.IsActive.Value && x.IsAmenty.HasValue && x.IsAmenty.Value && x.AmentyTypeId.HasValue && x.AmentyTypeId.Value == (int)Enums.AmentyType.Pool).OrderBy(x => x.AmentyOrder); hotels.PoolAmentyUpgrages = AmentyListsList.Where(x => x.AmentyId == amentyItem.Id && x.IsActive.HasValue && x.IsActive.Value && x.IsAmenty.HasValue && !x.IsAmenty.Value && x.AmentyTypeId.HasValue && x.AmentyTypeId.Value == (int)Enums.AmentyType.Pool).OrderBy(x => x.AmentyOrder); hotels.GymAmentyListses = AmentyListsList.Where(x => x.AmentyId == amentyItem.Id && x.IsActive.HasValue && x.IsActive.Value && x.IsAmenty.HasValue && x.IsAmenty.Value && x.AmentyTypeId.HasValue && x.AmentyTypeId.Value == (int)Enums.AmentyType.Gym).OrderBy(x => x.AmentyOrder); hotels.GymAmentyUpgrages = AmentyListsList.Where(x => x.AmentyId == amentyItem.Id && x.IsActive.HasValue && x.IsActive.Value && x.IsAmenty.HasValue && !x.IsAmenty.Value && x.AmentyTypeId.HasValue && x.AmentyTypeId.Value == (int)Enums.AmentyType.Gym).OrderBy(x => x.AmentyOrder); hotels.SpaAmentyListses = AmentyListsList.Where(x => x.AmentyId == amentyItem.Id && x.IsActive.HasValue && x.IsActive.Value && x.IsAmenty.HasValue && x.IsAmenty.Value && x.AmentyTypeId.HasValue && x.AmentyTypeId.Value == (int)Enums.AmentyType.Spa).OrderBy(x => x.AmentyOrder); hotels.SpaAmentyUpgrages = AmentyListsList.Where(x => x.AmentyId == amentyItem.Id && x.IsActive.HasValue && x.IsActive.Value && x.IsAmenty.HasValue && !x.IsAmenty.Value && x.AmentyTypeId.HasValue && x.AmentyTypeId.Value == (int)Enums.AmentyType.Spa).OrderBy(x => x.AmentyOrder); hotels.BusinessCenterAmentyListses = AmentyListsList.Where(x => x.AmentyId == amentyItem.Id && x.IsActive.HasValue && x.IsActive.Value && x.IsAmenty.HasValue && x.IsAmenty.Value && x.AmentyTypeId.HasValue && x.AmentyTypeId.Value == (int)Enums.AmentyType.BusinessCenter).OrderBy(x => x.AmentyOrder); hotels.BusinessCenterAmentyUpgrages = AmentyListsList.Where(x => x.AmentyId == amentyItem.Id && x.IsActive.HasValue && x.IsActive.Value && x.IsAmenty.HasValue && !x.IsAmenty.Value && x.AmentyTypeId.HasValue && x.AmentyTypeId.Value == (int)Enums.AmentyType.BusinessCenter).OrderBy(x => x.AmentyOrder); hotels.DinningAmentyListes = AmentyListsList.Where(x => x.AmentyId == amentyItem.Id && x.IsActive.HasValue && x.IsActive.Value && x.IsAmenty.HasValue && x.IsAmenty.Value && x.AmentyTypeId.HasValue && x.AmentyTypeId.Value == (int)Enums.AmentyType.Dining).OrderBy(x => x.AmentyOrder); hotels.EventAmentyListes = AmentyListsList.Where(x => x.AmentyId == amentyItem.Id && x.IsActive.HasValue && x.IsActive.Value && x.IsAmenty.HasValue && x.IsAmenty.Value && x.AmentyTypeId.HasValue && x.AmentyTypeId.Value == (int)Enums.AmentyType.Event).OrderBy(x => x.AmentyOrder); hotels.OtherAmentyListses = AmentyListsList.Where(x => x.AmentyId == amentyItem.Id && x.IsActive.HasValue && x.IsActive.Value && x.IsAmenty.HasValue && x.IsAmenty.Value && x.AmentyTypeId.HasValue && x.AmentyTypeId.Value == (int)Enums.AmentyType.Other).OrderBy(x => x.AmentyOrder); hotels.OtherAmentyUpgrages = AmentyListsList.Where(x => x.AmentyId == amentyItem.Id && x.IsActive.HasValue && x.IsActive.Value && x.IsAmenty.HasValue && !x.IsAmenty.Value && x.AmentyTypeId.HasValue && x.AmentyTypeId.Value == (int)Enums.AmentyType.Other).OrderBy(x => x.AmentyOrder); hotels.PhotoList = PhotoList.Where(x => x.HotelId == hotelId && x.IsActive.HasValue && x.IsActive.Value).OrderBy(x => x.Order); }