Exemplo n.º 1
0
        public MongoSessionDocument()
        {
            ApplicationName = "WinDemo.Mongodb";
            LockId          = 0;
            Locked          = false;
            Flags           = 0;
            User            = "******";
            Timeout         = 50;
            Created         = DateTime.UtcNow;
            LockDate        = DateTime.UtcNow;
            Expires         = Created.AddMinutes(Timeout);

            SessionStateItemCollection col = new SessionStateItemCollection();

            col["key1"] = new
            {
                ID   = new Random().Next(100, 100000),
                Name = "ZY",
                Age  = 11
            };
            col["key2"] = new
            {
                ID   = new Random().Next(100, 100000),
                Name = "ZY",
                Age  = 11
            };
            SessionItems = col;
        }
Exemplo n.º 2
0
 public virtual void EditDuration(int duration)
 {
     if (Ended == null)
     {
         throw new ArgumentException();
     }
     Ended = Created.AddMinutes(duration);
     CalculatePriceAndDuration();
 }
Exemplo n.º 3
0
        public bool IsExpired(int expiryLength)
        {
            if (Created.AddMinutes(expiryLength) < DateTime.Now)
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 4
0
 public SyncModel(string syncId, int total)
 {
     AgentsTiming = new ConcurrentDictionary <string, int?>();
     Created      = DateTime.Now;
     DeleteAt     = Created.AddMinutes(60);
     SyncId       = syncId;
     Total        = total;
     Timeout      = 3 * 60;
 }
Exemplo n.º 5
0
 public GameSessionListItem()
 {
     GameSessionId = null;
     Created       = DateTime.UtcNow;
     ValidUntil    = Created.AddMinutes(5);
 }