/// <summary>
        /// Initializes a new instance of the <see cref="ReservationHistory" /> class.
        /// </summary>
        /// <param name="reservation">The <see cref="AssetReservation" />.</param>
        /// <exception cref="ArgumentNullException"><paramref name="reservation" /> is null.</exception>
        public ReservationHistory(AssetReservation reservation)
        {
            if (reservation == null)
            {
                throw new ArgumentNullException(nameof(reservation));
            }

            AssetId     = reservation.AssetId;
            ReservedFor = reservation.ReservedFor.Contains("@") ? reservation.ReservedFor : reservation.ReservedBy;
            Start       = reservation.Start;
            End         = reservation.End;
        }
示例#2
0
        protected string GetReservationKey()
        {
            AssetReservation current = Reservations.OrderBy(n => n.Start).FirstOrDefault(n => n.End >= DateTime.Now);

            if (current != null)
            {
                return(string.IsNullOrEmpty(current.SessionId) ? current.ReservedFor : current.SessionId);
            }
            else
            {
                return(null);
            }
        }