public bool CanBeCancelledBy(UserComplex user)
        {
            if (user == null)
            {
                throw new ArgumentNullException();
            }

            return(user == MadeBy || user.IsAdmin);
        }
 /// <summary>
 /// Method that checks whether the reservation can be paid or not and if it is possible it proceeds to pay the reservation.
 /// </summary>
 /// <param name="user">User to pay the reservation</param>
 /// <returns>0 if the reservation is paid and the price of the reservation is substracted from the money of the user,</returns>
 public float PayReservation(UserComplex user)
 {
     if (user.Money >= Price)
     {
         user.Money -= Price;
         return(0);
     }
     return(-1);
 }
        public bool CanBeCancelledBy(UserComplex user)
        {
            if (user.IsAdmin)
            {
                return(true);
            }

            if (user == MadeBy)
            {
                return(true);
            }

            return(false);
        }
예제 #4
0
        /// <summary>
        /// Method that checks whether the reservation can be paid or not and if it is possible it proceeds to pay the reservatio.
        /// </summary>
        /// <param name="user">User to pay the reservation</param>
        /// <returns>0 if the reservation is paid and the price of the reservation is substracted from the money of the user,</returns>
        public float?PayReservation(UserComplex user)
        {
            float?valor = 0.0f;

            if (user.Money == null)
            {
                valor = null;
            }
            if (user.Money < Price)
            {
                valor = Price - user.Money;
            }

            return(valor);
        }
예제 #5
0
        /// <summary>
        /// Method that checks whether the reservation can be paid or not and if it is possible it proceeds to pay the reservatio.
        /// </summary>
        /// <param name="user">User to pay the reservation</param>
        /// <returns>0 if the reservation is paid and the price of the reservation is substracted from the money of the user,</returns>
        public float PayReservation(UserComplex user)
        {
            if (user == null)
            {
                throw new ArgumentNullException();
            }

            if (user.Money >= this.Price)
            {
                return(0);
            }
            else
            {
                throw new ArgumentOutOfRangeException();
            }
        }
예제 #6
0
        /// <summary>
        /// Method that checks whether the reservation can be paid or not and if it is possible it proceeds to pay the reservatio.
        /// </summary>
        /// <param name="user">User to pay the reservation</param>
        /// <returns>0 if the reservation is paid and the price of the reservation is substracted from the money of the user,</returns>
        public float PayReservation(UserComplex user)
        {
            if (user == null)
            {
                throw new ArgumentNullException();
            }

            if (user != MadeBy)
            {
                return(2);
            }
            if (Price > user.Money)
            {
                return(1);
            }

            user.Money -= Price;
            return(0);
        }
예제 #7
0
 /// <summary>
 /// Method that checks whether the reservation can be paid or not and if it is possible it proceeds to pay the reservatio.
 /// </summary>
 /// <param name="user">User to pay the reservation</param>
 /// <returns>0 if the reservation is paid and the price of the reservation is substracted from the money of the user,</returns>
 public float PayReservation(UserComplex user)
 {
     throw new NotImplementedException();
 }