Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="vehicle"></param>
        /// <returns></returns>
        public int Parking(Vehicle vehicle)
        {
            int tockenNo = 0;

            try
            {
                foreach (var level in parkingLevels)
                {
                    if (IsPossibleToParking(level.Key, vehicle.Type))
                    {
                        Tocken tocken = new Tocken();
                        tocken.levelId  = level.Key;
                        tocken.ParkedId = level.Value.ParkTheVehicle(vehicle);
                        tockens.Add(tockens.Count + 1, tocken);
                        tockenNo = tockens.Count;
                        break;
                    }
                    else
                    {
                        continue;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }


            return(tockenNo);
        }
Пример #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="tokenNo"></param>
 /// <param name="parkedId"></param>
 /// <returns></returns>
 public int AddTocken(Tocken tocken)
 {
     tockens.Add(tockens.Count + 1, tocken);
     return(tockens.Count);
 }