private string GetBagEquiptmentAsString(BaggageType type) { string typeAsString = type.ToString(); int index = typeAsString.ToLower().IndexOf("equipment"); return(typeAsString.Substring(0, index)); }
private IList <Baggage> GetBaggages(int bookingId, BaggageType type) { if (bookingId <= 0) { throw new IndexOutOfRangeException(ErrorMessages.INVALID_ID); } var booking = this.bookingsServices.GetBooking(bookingId); if (booking == null) { throw new ArgumentNullException(ErrorMessages.ENTITY_CANNOT_BE_NULL); } var bags = booking.Baggage .Where(b => b.Type == type) .ToList(); if (type == BaggageType.Cabin && bags.Count == 0) { throw new ArgumentNullException(ErrorMessages.NULL_CABIN_BAGS); } return(bags); }
private void AddOtherBaggageToBooking(Booking booking, BaggageType type, decimal price) { booking.Baggage.Add(new Baggage() { Type = type, Price = price }); }
public BaggageMdl create(BaggageType aType, BaggageAction aAction, String aTickerCounter) { _mdl = new BaggageMdl(); _mdl.pController = this; _mdl.pType = aType; _mdl.pAction = aAction; _mdl.pTickerCounter = aTickerCounter; return(_mdl); }
protected string ShowEquipmentBags(int bookingId, BaggageType type) { this.OnEquipmentBagsInfoShow?.Invoke( null, new ItineraryEventArgs() { BookingId = bookingId, BaggageType = type }); return(this.Model.EquipmentBagsInfo); }
/// <summary> /// Converts baggage equipment type to string. /// </summary> /// <param name="type">Baggage type.</param> /// <returns>Baggage type as string.</returns> /// <example> /// BabyEquipment => baby equipment /// SportsEquipment => sports equipment /// MusicEquipment => music equipment /// </example> private string GetEqyipmentTypeAsString(BaggageType type) { if (type != BaggageType.BabyEquipment && type != BaggageType.SportsEquipment && type != BaggageType.MusicEquipment) { throw new ArgumentException(ErrorMessages.INVALID_BAGGAGE_EQUIPMENT_TYPE); } string typeAsString = type.ToString().ToLower(); int startIndex = typeAsString.IndexOf("equipment"); string intervalToInsert = " "; return(typeAsString.Insert(startIndex, intervalToInsert)); }
// Set baby, sports and music equipments to the itenerary info panel. private void SetBagEquipmentsToItinerary( Data.Models.Booking booking, ref decimal totalCost, BaggageType baggageType, Literal literalInfo, Literal literalPrice) { var equipment = booking.Baggage .FirstOrDefault(b => b.Type == baggageType); if (equipment != null) { literalInfo.Text = string.Format("{0} equipment included!", this.GetBagEquiptmentAsString(baggageType)); literalPrice.Text = "€ " + string.Format("{0:0.00}", equipment.Price); totalCost += equipment.Price; } }