コード例 #1
0
        /// <summary>
        /// An exception thrown whenever a parking operator already exists within the given roaming network.
        /// </summary>
        /// <param name="RoamingNetwork">The roaming network.</param>
        /// <param name="ParkingOperatorId">The parking operator identification.</param>
        public ParkingOperatorAlreadyExists(RoamingNetwork RoamingNetwork,
                                            ParkingOperator_Id ParkingOperatorId)

            : base(RoamingNetwork,
                   "The given parking operator identification '" + ParkingOperatorId + "' already exists within the given '" + RoamingNetwork.Id + "' roaming network!")

        {
        }
コード例 #2
0
        /// <summary>
        /// Parse the given string as a parking reservation identification.
        /// </summary>
        public static Boolean TryParse(String Text, out ParkingReservation_Id ReservationId)
        {
            #region Initial checks

            if (Text.IsNullOrEmpty())
            {
                ReservationId = default(ParkingReservation_Id);
                return(false);
            }

            #endregion

            try
            {
                ReservationId = default(ParkingReservation_Id);

                var _MatchCollection = ReservationId_RegEx.Matches(Text);

                if (_MatchCollection.Count != 1)
                {
                    return(false);
                }

                ParkingOperator_Id _OperatorId;

                // New format...
                if (ParkingOperator_Id.TryParse(_MatchCollection[0].Groups[1].Value, out _OperatorId))
                {
                    ReservationId = new ParkingReservation_Id(_OperatorId,
                                                              _MatchCollection[0].Groups[2].Value);

                    return(true);
                }

                if (ParkingOperator_Id.TryParse(_MatchCollection[0].Groups[3].Value, out _OperatorId))
                {
                    ReservationId = new ParkingReservation_Id(_OperatorId,
                                                              _MatchCollection[0].Groups[4].Value);

                    return(true);
                }
            }
#pragma warning disable RCS1075  // Avoid empty catch clause that catches System.Exception.
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
            catch (Exception e)
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
#pragma warning restore RCS1075  // Avoid empty catch clause that catches System.Exception.
            { }

            ReservationId = default(ParkingReservation_Id);
            return(false);
        }
コード例 #3
0
        /// <summary>
        /// Generate a new parking reservation identification
        /// based on the given parking station operator and identification suffix.
        /// </summary>
        /// <param name="OperatorId">The unique identification of a parking station operator.</param>
        /// <param name="Suffix">The suffix of the parking reservation identification.</param>
        private ParkingReservation_Id(ParkingOperator_Id OperatorId,
                                      String Suffix)
        {
            #region Initial checks

            if (Suffix.IsNullOrEmpty())
            {
                throw new ArgumentNullException(nameof(Suffix), "The parking reservation identification suffix must not be null or empty!");
            }

            #endregion

            this.OperatorId = OperatorId;
            this.Suffix     = Suffix;
        }
コード例 #4
0
        /// <summary>
        /// Parse the given string as a parking reservation identification.
        /// </summary>
        /// <param name="Text">A text representation of a parking reservation identification.</param>
        public static ParkingReservation_Id Parse(String Text)
        {
            #region Initial checks

            if (Text.IsNullOrEmpty())
            {
                throw new ArgumentNullException(nameof(Text), "The given text representation of a parking reservation identification must not be null or empty!");
            }

            #endregion

            var MatchCollection = ReservationId_RegEx.Matches(Text);

            ParkingOperator_Id _OperatorId;

            if (ParkingOperator_Id.TryParse(MatchCollection[0].Groups[1].Value, out _OperatorId))
            {
                return(new ParkingReservation_Id(_OperatorId,
                                                 MatchCollection[0].Groups[2].Value));
            }

            throw new ArgumentException("Illegal parking reservation identification '" + Text + "'!",
                                        nameof(Text));
        }
コード例 #5
0
        /// <summary>
        /// Parse the given string as a parking reservation identification.
        /// </summary>
        public static Boolean TryParse(ParkingOperator_Id OperatorId,
                                       String Suffix,
                                       out ParkingReservation_Id ReservationId)

        => TryParse(OperatorId.ToString() + "*R" + Suffix, out ReservationId);
コード例 #6
0
        /// <summary>
        /// Parse the given string as a parking reservation identification.
        /// </summary>
        /// <param name="OperatorId">The unique identification of a parking station operator.</param>
        /// <param name="Suffix">The suffix of the parking reservation identification.</param>
        public static ParkingReservation_Id Parse(ParkingOperator_Id OperatorId,
                                                  String Suffix)

        => Parse(OperatorId.ToString() + "*R" + Suffix);