示例#1
0
        private string GetBagEquiptmentAsString(BaggageType type)
        {
            string typeAsString = type.ToString();
            int    index        = typeAsString.ToLower().IndexOf("equipment");

            return(typeAsString.Substring(0, index));
        }
示例#2
0
        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);
        }
示例#3
0
 private void AddOtherBaggageToBooking(Booking booking, BaggageType type, decimal price)
 {
     booking.Baggage.Add(new Baggage()
     {
         Type  = type,
         Price = price
     });
 }
示例#4
0
        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);
        }
示例#5
0
        protected string ShowEquipmentBags(int bookingId, BaggageType type)
        {
            this.OnEquipmentBagsInfoShow?.Invoke(
                null,
                new ItineraryEventArgs()
            {
                BookingId   = bookingId,
                BaggageType = type
            });

            return(this.Model.EquipmentBagsInfo);
        }
示例#6
0
        /// <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));
        }
示例#7
0
        // 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 = "&#8364; " + string.Format("{0:0.00}", equipment.Price);
                totalCost        += equipment.Price;
            }
        }