示例#1
0
        public bool isExpired(TicketState ticketState)
        {
            if (ticketState.getCountOfUses() == 0 &&
                (System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() < this.timeToKillInMilliSeconds))
            {
                //if (log.isDebugEnabled())
                //{
                //    log
                //        .debug("Ticket is not expired due to a count of zero and the time being less than the timeToKillInMilliseconds");
                //}
                return(false);
            }

            if ((System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() >= this.timeToKillInMilliSeconds))
            {
                //if (log.isDebugEnabled())
                //{
                //    log
                //        .debug("Ticket is expired due to the time being greater than the timeToKillInMilliseconds");
                //}
                return(true);
            }

            if ((System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() <= this.timeInBetweenUsesInMilliSeconds))
            {
                //log
                //    .warn("Ticket is expired due to the time being less than the waiting period.");
                return(true);
            }

            return(false);
        }
        public bool isExpired(TicketState ticketState)
        {
            if (ticketState.getCountOfUses() == 0
                && (System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() < this.timeToKillInMilliSeconds))
            {
                //if (log.isDebugEnabled())
                //{
                //    log
                //        .debug("Ticket is not expired due to a count of zero and the time being less than the timeToKillInMilliseconds");
                //}
                return false;
            }

            if ((System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() >= this.timeToKillInMilliSeconds))
            {
                //if (log.isDebugEnabled())
                //{
                //    log
                //        .debug("Ticket is expired due to the time being greater than the timeToKillInMilliseconds");
                //}
                return true;
            }

            if ((System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() <= this.timeInBetweenUsesInMilliSeconds))
            {
                //log
                //    .warn("Ticket is expired due to the time being less than the waiting period.");
                return true;
            }

            return false;
        }
 public bool isExpired(TicketState ticketState)
 {
     return (ticketState == null)
            || (ticketState.getCountOfUses() >= this.numberOfUses)
            || (System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() >= this.timeToKillInMilliSeconds);
 }
 public bool isExpired(TicketState ticketState)
 {
     return((ticketState == null) ||
            (ticketState.getCountOfUses() >= this.numberOfUses) ||
            (System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() >= this.timeToKillInMilliSeconds));
 }